File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,24 @@ mutable struct Parameters
1919 linux_perf_options: :@NamedTuple {events:: Expr , spaces:: Expr , threads:: Bool }
2020end
2121
22- # TODO : determine whether perf is available
22+ function perf_available ()
23+ if ! Sys. islinux ()
24+ return false
25+ end
26+
27+ try
28+ opts = LinuxPerf. parse_pstats_options ([])
29+ groups = BenchmarkTools. LinuxPerf. set_default_spaces (
30+ opts. events,
31+ opts. spaces,
32+ )
33+ bench = make_bench_threaded (groups, threads = opts. threads)
34+ return true
35+ catch
36+ return false
37+ end
38+ end
39+
2340const DEFAULT_PARAMETERS = Parameters (
2441 5.0 ,
2542 10000 ,
@@ -30,7 +47,7 @@ const DEFAULT_PARAMETERS = Parameters(
3047 false ,
3148 0.05 ,
3249 0.01 ,
33- Sys . islinux (),
50+ perf_available (),
3451 LinuxPerf. parse_pstats_options ([]),
3552)
3653
You can’t perform that action at this time.
0 commit comments