Testing raw read speed, see if it's even worth pursuing
This commit is contained in:
parent
088ab5547a
commit
3974ce2be5
14
src/server.c
14
src/server.c
@ -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.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user