muep / joonos-sysmgr

0 stars 0 forks source link

Use unix.SysInfo() to get memory stats #21

Open muep opened 2 years ago

muep commented 2 years ago

This seems like a more convenient approach than reading from /proc/meminfo

muep commented 2 years ago

Actually not sure if this is a good interface to use. According to the man page:

struct sysinfo {
    long uptime;             /* Seconds since boot */
    unsigned long loads[3];  /* 1, 5, and 15 minute load averages */
    unsigned long totalram;  /* Total usable main memory size */
    unsigned long freeram;   /* Available memory size */
    unsigned long sharedram; /* Amount of shared memory */
    unsigned long bufferram; /* Memory used by buffers */
    unsigned long totalswap; /* Total swap space size */
    unsigned long freeswap;  /* swap space still available */
    unsigned short procs;    /* Number of current processes */
    unsigned long totalhigh; /* Total high memory size */
    unsigned long freehigh;  /* Available high memory size */
    unsigned int mem_unit;   /* Memory unit size in bytes */
    char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding to 64 bytes */
};

The amount of cached RAM does not seem to be available