Skip to content

Commit

Permalink
Remove broken support for custom LinuxPerf Options
Browse files Browse the repository at this point in the history
  • Loading branch information
Zentrik committed Jan 19, 2024
1 parent 3e73644 commit 1ee189b
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 17 deletions.
1 change: 0 additions & 1 deletion docs/src/manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ You can pass the following keyword arguments to `@benchmark`, `@benchmarkable`,
- `time_tolerance`: The noise tolerance for the benchmark's time estimate, as a percentage. This is utilized after benchmark execution, when analyzing results. Defaults to `BenchmarkTools.DEFAULT_PARAMETERS.time_tolerance = 0.05`.
- `memory_tolerance`: The noise tolerance for the benchmark's memory estimate, as a percentage. This is utilized after benchmark execution, when analyzing results. Defaults to `BenchmarkTools.DEFAULT_PARAMETERS.memory_tolerance = 0.01`.
- `enable_linux_perf`: If `true`, profile using perf once. Defaults to `BenchmarkTools.DEFAULT_PARAMETERS.enable_linux_perf = false`.
- `linux_perf_options`: Options for perf profiling. Defaults to `BenchmarkTools.DEFAULT_PARAMETERS.linux_perf_options = String[]`. See LinuxPerf.jl for further details.

To change the default values of the above fields, one can mutate the fields of `BenchmarkTools.DEFAULT_PARAMETERS`, for example:

Expand Down
1 change: 1 addition & 0 deletions src/BenchmarkTools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ end

##############
# Parameters #
##############

include("parameters.jl")

Expand Down
4 changes: 1 addition & 3 deletions src/execution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -593,9 +593,7 @@ function generate_benchmark_definition(
$(Expr(:tuple, quote_vars...)), __params::$BenchmarkTools.Parameters
)
# Based on https://github.com/JuliaPerf/LinuxPerf.jl/blob/a7fee0ff261a5b5ce7a903af7b38d1b5c27dd931/src/LinuxPerf.jl#L1043-L1061
__linux_perf_options = $LinuxPerf.parse_pstats_options(
__params.linux_perf_options
)
__linux_perf_options = $LinuxPerf.parse_pstats_options([])
__linux_perf_groups = $LinuxPerf.set_default_spaces(
eval(__linux_perf_options.events), eval(__linux_perf_options.spaces)
)
Expand Down
12 changes: 2 additions & 10 deletions src/parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ mutable struct Parameters
time_tolerance::Float64
memory_tolerance::Float64
enable_linux_perf::Bool
linux_perf_options::Vector{String}
end

const DEFAULT_PARAMETERS = Parameters(
5.0, 10000, 1, false, 0, true, false, 0.05, 0.01, false, String[]
5.0, 10000, 1, false, 0, true, false, 0.05, 0.01, false
)

function Parameters(;
Expand All @@ -34,7 +33,6 @@ function Parameters(;
time_tolerance=DEFAULT_PARAMETERS.time_tolerance,
memory_tolerance=DEFAULT_PARAMETERS.memory_tolerance,
enable_linux_perf=DEFAULT_PARAMETERS.enable_linux_perf,
linux_perf_options=DEFAULT_PARAMETERS.linux_perf_options,
)
return Parameters(
seconds,
Expand All @@ -47,7 +45,6 @@ function Parameters(;
time_tolerance,
memory_tolerance,
enable_linux_perf,
linux_perf_options,
)
end

Expand All @@ -62,7 +59,6 @@ function Parameters(
time_tolerance=nothing,
memory_tolerance=nothing,
enable_linux_perf=nothing,
linux_perf_options=nothing,
)
params = Parameters()
params.seconds = seconds != nothing ? seconds : default.seconds
Expand All @@ -80,8 +76,6 @@ function Parameters(
else
default.enable_linux_perf
end
params.linux_perf_options =
linux_perf_options != nothing ? linux_perf_options : default.linux_perf_options
return params::BenchmarkTools.Parameters
end

Expand All @@ -94,8 +88,7 @@ function Base.:(==)(a::Parameters, b::Parameters)
a.gcsample == b.gcsample &&
a.time_tolerance == b.time_tolerance &&
a.memory_tolerance == b.memory_tolerance &&
a.enable_linux_perf == b.enable_linux_perf &&
a.linux_perf_options == b.linux_perf_options
a.enable_linux_perf == b.enable_linux_perf
end

function Base.copy(p::Parameters)
Expand All @@ -110,7 +103,6 @@ function Base.copy(p::Parameters)
p.time_tolerance,
p.memory_tolerance,
p.enable_linux_perf,
p.linux_perf_options,
)
end

Expand Down
2 changes: 0 additions & 2 deletions src/serialization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ function recover(x::Vector)
false
elseif fn == "enable_linux_perf" && !haskey(fields, fn)
false
elseif fn == "linux_perf_options" && !haskey(fields, fn)
String[]
else
convert(ft, fields[fn])
end
Expand Down
1 change: 0 additions & 1 deletion src/trials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ function TrialEstimate(trial::Trial, t, gct)
)
end

# Should we compare linux_perf_stats here?
function Base.:(==)(a::TrialEstimate, b::TrialEstimate)
return a.params == b.params &&
a.time == b.time &&
Expand Down

0 comments on commit 1ee189b

Please sign in to comment.