Skip to content

Commit 605fadf

Browse files
authored
[libc] Add --sweep-min-size flag for benchmarks (llvm#70302)
We have --sweep-max-size, it's reasonable to have --sweep-min-size as well. It can be used when working on the logic for larger sizes, or to collect a profile for larger sizes only.
1 parent cf3ac96 commit 605fadf

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

libc/benchmarks/LibcMemoryBenchmarkMain.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,15 @@ static cl::opt<std::string>
4242
SizeDistributionName("size-distribution-name",
4343
cl::desc("The name of the distribution to use"));
4444

45-
static cl::opt<bool>
46-
SweepMode("sweep-mode",
47-
cl::desc("If set, benchmark all sizes from 0 to sweep-max-size"));
45+
static cl::opt<bool> SweepMode(
46+
"sweep-mode",
47+
cl::desc(
48+
"If set, benchmark all sizes from sweep-min-size to sweep-max-size"));
49+
50+
static cl::opt<uint32_t>
51+
SweepMinSize("sweep-min-size",
52+
cl::desc("The minimum size to use in sweep-mode"),
53+
cl::init(0));
4854

4955
static cl::opt<uint32_t>
5056
SweepMaxSize("sweep-max-size",
@@ -185,7 +191,7 @@ struct MemfunctionBenchmarkSweep final : public MemfunctionBenchmarkBase {
185191
BO.InitialIterations = 100;
186192
auto &Measurements = Study.Measurements;
187193
Measurements.reserve(NumTrials * SweepMaxSize);
188-
for (size_t Size = 0; Size <= SweepMaxSize; ++Size) {
194+
for (size_t Size = SweepMinSize; Size <= SweepMaxSize; ++Size) {
189195
CurrentSweepSize = Size;
190196
runTrials(BO, Measurements);
191197
}

0 commit comments

Comments
 (0)