Testing raw read speed, see if it's even worth pursuing

This commit is contained in:
Dan Snyder 2025-01-12 22:02:17 -05:00
parent 088ab5547a
commit 3974ce2be5

View File

@ -29,9 +29,21 @@ int main(int argc, char *argv[]) {
char *filedata = malloc(4096);
char *fname = malloc(1024);
FILE *file;
while ((pDirent = readdir(pDir)) != NULL) {
printf("[%s]\n", pDirent->d_name);
sprintf(fname, "/proc/%s/stat", pDirent->d_name);
file = fopen(fname, "rb");
fread(filedata, 1, 4096, file);
fclose(file);
strcat(fname, "us");
file = fopen(fname, "rb");
fread(filedata, 1, 4096, file);
fclose(file);
strtok(filedata, "\n");
printf("[%s]\n", filedata);
}
// Close directory and exit.