mirror of https://github.com/google/benchmark.git
CPU caches are binary units, not SI. (#911)
As disscussed in https://github.com/google/benchmark/issues/899, it is all but certain that the multiplier should be 1024, not 1000. Fixes https://github.com/google/benchmark/issues/899
This commit is contained in:
parent
318d07113d
commit
367119482f
|
@ -49,7 +49,7 @@ void BenchmarkReporter::PrintBasicContext(std::ostream *out,
|
|||
Out << "CPU Caches:\n";
|
||||
for (auto &CInfo : info.caches) {
|
||||
Out << " L" << CInfo.level << " " << CInfo.type << " "
|
||||
<< (CInfo.size / 1000) << "K";
|
||||
<< (CInfo.size / 1024) << " KiB";
|
||||
if (CInfo.num_sharing != 0)
|
||||
Out << " (x" << (info.num_cpus / CInfo.num_sharing) << ")";
|
||||
Out << "\n";
|
||||
|
|
|
@ -270,7 +270,7 @@ std::vector<CPUInfo::CacheInfo> GetCacheSizesFromKVFS() {
|
|||
else if (f && suffix != "K")
|
||||
PrintErrorAndDie("Invalid cache size format: Expected bytes ", suffix);
|
||||
else if (suffix == "K")
|
||||
info.size *= 1000;
|
||||
info.size *= 1024;
|
||||
}
|
||||
if (!ReadFromFile(StrCat(FPath, "type"), &info.type))
|
||||
PrintErrorAndDie("Failed to read from file ", FPath, "type");
|
||||
|
|
|
@ -38,9 +38,9 @@ static int AddContextCases() {
|
|||
for (size_t I = 0; I < Caches.size(); ++I) {
|
||||
std::string num_caches_str =
|
||||
Caches[I].num_sharing != 0 ? " \\(x%int\\)$" : "$";
|
||||
AddCases(
|
||||
TC_ConsoleErr,
|
||||
{{"L%int (Data|Instruction|Unified) %intK" + num_caches_str, MR_Next}});
|
||||
AddCases(TC_ConsoleErr,
|
||||
{{"L%int (Data|Instruction|Unified) %int KiB" + num_caches_str,
|
||||
MR_Next}});
|
||||
AddCases(TC_JSONOut, {{"\\{$", MR_Next},
|
||||
{"\"type\": \"", MR_Next},
|
||||
{"\"level\": %int,$", MR_Next},
|
||||
|
|
Loading…
Reference in New Issue