diff --git a/src/reporter.cc b/src/reporter.cc index 4d3e477d..0b54fa42 100644 --- a/src/reporter.cc +++ b/src/reporter.cc @@ -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"; diff --git a/src/sysinfo.cc b/src/sysinfo.cc index b5f99c7d..5b7c4af7 100644 --- a/src/sysinfo.cc +++ b/src/sysinfo.cc @@ -270,7 +270,7 @@ std::vector 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"); diff --git a/test/reporter_output_test.cc b/test/reporter_output_test.cc index 8486d590..1a96b5f0 100644 --- a/test/reporter_output_test.cc +++ b/test/reporter_output_test.cc @@ -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},