Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "TLB size" to /proc/cpuinfo parsing. #33

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion rescpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,12 @@ static int populate_cpuinfo(void *out, char *buffer, int total_len, int probe)
else
cpu->bogomips = atof(end2);
}
if (!strcmp(start, "TLB size")) {
if (probe)
cpu->tlb_size[0] = 1;
else
strcpy(cpu->tlb_size, end2);
}
if (!strcmp(start, "clflush size")) {
if (probe)
cpu->clflush_size = 1;
Expand All @@ -245,7 +251,6 @@ static int populate_cpuinfo(void *out, char *buffer, int total_len, int probe)
else
strcpy(cpu->power_mgmt, end2);
}

nextline:
start = start2;
start++;
Expand Down
1 change: 1 addition & 0 deletions resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ struct cpuinfo {
unsigned int cache_alignment;
char address_sizes[CPU_STR];
char power_mgmt[CPU_STR];
char tlb_size[CPU_STR];
};

struct memstat {
Expand Down
2 changes: 2 additions & 0 deletions tests/CPU/cpu_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ int main(int argc, char **argv)
fprintf(fp, "bugs\t\t: %s\n",cpu->bugs);
if (exist->bogomips)
fprintf(fp, "bogomips\t: %0.2f\n",cpu->bogomips);
if (exist->tlb_size[0])
fprintf(fp, "TLB size\t: %s\n",cpu->tlb_size);
if (exist->clflush_size)
fprintf(fp, "clflush size\t: %u\n",cpu->clflush_size);
if (exist->cache_alignment)
Expand Down
Loading