Skip to content

Commit 73899a2

Browse files
liyuying0000copybara-github
authored andcommitted
Fix the issue that L3 cache size is 0 when number of sharing CPUs equals the total available CPUs
PiperOrigin-RevId: 691933169 Change-Id: I75a98efadc5513a428d739ad28e5d74cd2d67fc4
1 parent 236c23d commit 73899a2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fleetbench/common/common.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ int GetCacheSize(int cache_level, absl::string_view cache_type) {
194194
// "divide by 2" accounts for the fact that x86 platforms have two
195195
// hyperthreads per core.
196196
// Thus, we need to find the "actual" L3 cache size per socket.
197-
int multiplier =
198-
benchmark::CPUInfo::Get().num_cpus / ci.num_sharing / 2;
197+
int multiplier = std::max(
198+
1, benchmark::CPUInfo::Get().num_cpus / ci.num_sharing / 2);
199199
l3_size *= multiplier;
200200
#endif
201201

0 commit comments

Comments
 (0)