pjrinaldi / wombatforensics

linux c++, fox-toolkit, multi-threaded forensic gui tool
GNU General Public License v2.0
46 stars 12 forks source link

verification speed #411

Closed pjrinaldi closed 1 year ago

pjrinaldi commented 2 years ago

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.

pjrinaldi commented 2 years 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

include <sys/sysinfo.h>

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 */ };