Skip to content

Commit 2600cfe

Browse files
committed
Add parameters for linux perf
1 parent 0941fd1 commit 2600cfe

File tree

1 file changed

+75
-2
lines changed

1 file changed

+75
-2
lines changed

src/parameters.jl

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,32 @@ mutable struct Parameters
1515
gcsample::Bool
1616
time_tolerance::Float64
1717
memory_tolerance::Float64
18+
enable_linux_perf::Bool
19+
linux_perf_groups::String
20+
linux_perf_spaces::NTuple{3,Bool}
21+
linux_perf_threads::Bool
22+
linux_perf_gcscrub::Bool
1823
end
1924

20-
const DEFAULT_PARAMETERS = Parameters(5.0, 10000, 1, false, 0, true, false, 0.05, 0.01)
25+
# Task clock has large overhead so is not useful for the short time we run functions under perf
26+
# Further we benchmark anyways so no need for cycles or task clock
27+
# I've tried to only use one group by getting rid of noisy or not useful metrics
28+
const DEFAULT_PARAMETERS = Parameters(
29+
5.0,
30+
10000,
31+
1,
32+
false,
33+
0,
34+
true,
35+
false,
36+
0.05,
37+
0.01,
38+
false,
39+
"(instructions,branch-instructions)",
40+
(true, false, false),
41+
true,
42+
true,
43+
)
2144

2245
function Parameters(;
2346
seconds=DEFAULT_PARAMETERS.seconds,
@@ -29,6 +52,11 @@ function Parameters(;
2952
gcsample=DEFAULT_PARAMETERS.gcsample,
3053
time_tolerance=DEFAULT_PARAMETERS.time_tolerance,
3154
memory_tolerance=DEFAULT_PARAMETERS.memory_tolerance,
55+
enable_linux_perf=DEFAULT_PARAMETERS.enable_linux_perf,
56+
linux_perf_groups=DEFAULT_PARAMETERS.linux_perf_groups,
57+
linux_perf_spaces=DEFAULT_PARAMETERS.linux_perf_spaces,
58+
linux_perf_threads=DEFAULT_PARAMETERS.linux_perf_threads,
59+
linux_perf_gcscrub=DEFAULT_PARAMETERS.linux_perf_gcscrub,
3260
)
3361
return Parameters(
3462
seconds,
@@ -40,6 +68,11 @@ function Parameters(;
4068
gcsample,
4169
time_tolerance,
4270
memory_tolerance,
71+
enable_linux_perf,
72+
linux_perf_groups,
73+
linux_perf_spaces,
74+
linux_perf_threads,
75+
linux_perf_gcscrub,
4376
)
4477
end
4578

@@ -53,6 +86,11 @@ function Parameters(
5386
gcsample=nothing,
5487
time_tolerance=nothing,
5588
memory_tolerance=nothing,
89+
enable_linux_perf=nothing,
90+
linux_perf_groups=nothing,
91+
linux_perf_spaces=nothing,
92+
linux_perf_threads=nothing,
93+
linux_perf_gcscrub=nothing,
5694
)
5795
params = Parameters()
5896
params.seconds = seconds != nothing ? seconds : default.seconds
@@ -65,6 +103,31 @@ function Parameters(
65103
time_tolerance != nothing ? time_tolerance : default.time_tolerance
66104
params.memory_tolerance =
67105
memory_tolerance != nothing ? memory_tolerance : default.memory_tolerance
106+
params.enable_linux_perf = if enable_linux_perf != nothing
107+
enable_linux_perf
108+
else
109+
default.enable_linux_perf
110+
end
111+
params.linux_perf_groups = if linux_perf_groups != nothing
112+
linux_perf_groups
113+
else
114+
default.linux_perf_groups
115+
end
116+
params.linux_perf_spaces = if linux_perf_spaces != nothing
117+
linux_perf_spaces
118+
else
119+
default.linux_perf_spaces
120+
end
121+
params.linux_perf_threads = if linux_perf_threads != nothing
122+
linux_perf_threads
123+
else
124+
default.linux_perf_threads
125+
end
126+
params.linux_perf_gcscrub = if linux_perf_gcscrub != nothing
127+
linux_perf_gcscrub
128+
else
129+
default.linux_perf_gcscrub
130+
end
68131
return params::BenchmarkTools.Parameters
69132
end
70133

@@ -76,7 +139,12 @@ function Base.:(==)(a::Parameters, b::Parameters)
76139
a.gctrial == b.gctrial &&
77140
a.gcsample == b.gcsample &&
78141
a.time_tolerance == b.time_tolerance &&
79-
a.memory_tolerance == b.memory_tolerance
142+
a.memory_tolerance == b.memory_tolerance &&
143+
a.enable_linux_perf == b.enable_linux_perf &&
144+
a.linux_perf_groups == b.linux_perf_groups &&
145+
a.linux_perf_spaces == b.linux_perf_spaces &&
146+
a.linux_perf_threads == b.linux_perf_threads &&
147+
a.linux_perf_gcscrub == b.linux_perf_gcscrub
80148
end
81149

82150
function Base.copy(p::Parameters)
@@ -90,6 +158,11 @@ function Base.copy(p::Parameters)
90158
p.gcsample,
91159
p.time_tolerance,
92160
p.memory_tolerance,
161+
p.enable_linux_perf,
162+
p.linux_perf_groups,
163+
p.linux_perf_spaces,
164+
p.linux_perf_threads,
165+
p.linux_perf_gcscrub,
93166
)
94167
end
95168

0 commit comments

Comments
 (0)