Closed pjrinaldi closed 1 year ago
determine amount of free ram:
int GetRamInKB(void) { FILE *meminfo = fopen("/proc/meminfo", "r"); if(meminfo == NULL) ... // handle error
char line[256];
while(fgets(line, sizeof(line), meminfo))
{
int ram;
if(sscanf(line, "MemTotal: %d kB", &ram) == 1)
{
fclose(meminfo);
return ram;
}
}
// If we got here, then we couldn't find the proper line in the meminfo file:
// do something appropriate like return an error code, throw an exception, etc.
fclose(meminfo);
return -1;
}
OR
int sysinfo(struct sysinfo *info);
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-2sizeof(long)-sizeof(int)]; / Padding for libc5 */ };
Need to speed up verification speed...
ewfimage does 200MiB/s, so I need to use bigger buffer's and do the start biggest to smallest with what divides by total image size without remainder.