@@ -3,6 +3,7 @@ module ExecutionTests
33using BenchmarkTools
44using Profile
55using Test
6+ using LinuxPerf
67
78seteq (a, b) = length (a) == length (b) == length (intersect (a, b))
89
@@ -382,4 +383,34 @@ b = x = nothing
382383GC. gc ()
383384@test x_finalized
384385
386+ # #################################
387+ # Linux Perf Integration #
388+ # #################################
389+
390+ b = @benchmarkable sin ($ (Ref (42.0 ))[])
391+ results = run (b; seconds= 1 , enable_linux_perf= false )
392+ @test results. linux_perf_stats === nothing
393+
394+ b = @benchmarkable sin ($ (Ref (42.0 ))[])
395+ results = run (b; seconds= 1 )
396+ @test results. linux_perf_stats === nothing
397+
398+ b = @benchmarkable sin ($ (Ref (42.0 ))[])
399+ results = run (b; seconds= 1 , enable_linux_perf= true , evals= 10 ^ 3 )
400+ @test results. linux_perf_stats != = nothing
401+ @test any (results. linux_perf_stats. threads) do thread
402+ instructions = LinuxPerf. scaledcount (thread[" instructions" ])
403+ ! isnan (instructions) && instructions > 10 ^ 4
404+ end
405+
406+ tune! (groups)
407+ results = run (groups; enable_linux_perf= true )
408+ for (name, group_results) in BenchmarkTools. leaves (results)
409+ @test group_results. linux_perf_stats != = nothing
410+ @test any (group_results. linux_perf_stats. threads) do thread
411+ instructions = LinuxPerf. scaledcount (thread[" instructions" ])
412+ ! isnan (instructions) && instructions > 10 ^ 3
413+ end
414+ end
415+
385416end # module
0 commit comments