Skip to content

Commit e6001b2

Browse files
committed
Fix perf detection
Previously we always returned false as an error was thrown when trying to run the code in the try block
1 parent 0d0acf0 commit e6001b2

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/parameters.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,18 @@ mutable struct Parameters
1919
linux_perf_options::@NamedTuple{events::Expr, spaces::Expr, threads::Bool}
2020
end
2121

22+
const DEFAULT_LINUX_PERF_OPTIONS = LinuxPerf.parse_pstats_options([])
23+
2224
function perf_available()
2325
if !Sys.islinux()
2426
return false
2527
end
2628

2729
bench = nothing
2830
try
29-
opts = LinuxPerf.parse_pstats_options([])
30-
groups = BenchmarkTools.LinuxPerf.set_default_spaces(opts.events, opts.spaces)
31-
bench = make_bench_threaded(groups; threads=opts.threads)
31+
opts = DEFAULT_LINUX_PERF_OPTIONS
32+
groups = LinuxPerf.set_default_spaces(eval(opts.events), eval(opts.spaces))
33+
bench = LinuxPerf.make_bench_threaded(groups, threads = eval(opts.threads))
3234
return true
3335
catch
3436
return false
@@ -50,7 +52,7 @@ const DEFAULT_PARAMETERS = Parameters(
5052
0.05,
5153
0.01,
5254
perf_available(),
53-
LinuxPerf.parse_pstats_options([]),
55+
DEFAULT_LINUX_PERF_OPTIONS,
5456
)
5557

5658
function Parameters(;

0 commit comments

Comments
 (0)