format options for every output!

This commit is contained in:
Linus Dierheimer
2021-03-19 20:57:07 +01:00
parent 5c6bbbf677
commit 1ceb5c91ac
34 changed files with 1500 additions and 695 deletions
+21 -3
View File
@@ -31,8 +31,26 @@ void ffPrintCPU(FFinstance* instance)
frequency /= 1000; //to MHz
double ghz = (double) frequency / 1000.0; //to GHz
char value[1024];
sprintf(value, "%s (%i) @ %.9gGHz", name, get_nprocs(), ghz);
int numProcs = get_nprocs();
ffPrintLogoAndKey(instance, "CPU");
FFstrbuf cpu;
ffStrbufInit(&cpu);
if(ffStrbufIsEmpty(&instance->config.cpuFormat))
{
ffStrbufSetF(&cpu, "%s (%i) @ %.9gGHz", name, numProcs, ghz);
}
else
{
ffParseFormatString(&cpu, &instance->config.cpuFormat, 3,
(FFformatarg){FF_FORMAT_ARG_TYPE_STRING, name},
(FFformatarg){FF_FORMAT_ARG_TYPE_INT, &numProcs},
(FFformatarg){FF_FORMAT_ARG_TYPE_DOUBLE, &ghz}
);
}
ffPrintAndSaveCachedValue(instance, "CPU", value);
ffPrintAndSaveCachedValue(instance, "CPU", cpu.chars);
ffStrbufDestroy(&cpu);
}