caching of some values

This commit is contained in:
Linus Dierheimer
2021-02-22 16:52:51 +01:00
parent f14e84606f
commit df3dcb7ede
9 changed files with 150 additions and 25 deletions
+8 -1
View File
@@ -4,6 +4,9 @@
void ffPrintCPU(FFstate* state)
{
if(ffPrintCachedValue(state, "CPU"))
return;
char name[256];
ffParsePropFile("/proc/cpuinfo", "model name%*s %[^\n]", name);
if(name[0] == '\0')
@@ -30,6 +33,10 @@ void ffPrintCPU(FFstate* state)
frequency /= 1000; //to MHz
double ghz = (double) frequency / 1000.0; //to GHz
char value[1024];
sprintf(value, "%s (%i) @ %.9gGHz", name, get_nprocs(), ghz);
ffSaveCachedValue(state, "CPU", value);
ffPrintLogoAndKey(state, "CPU");
printf("%s (%i) @ %.9gGHz\n", name, get_nprocs(), ghz);
puts(value);
}