@@ -3,6 +3,7 @@ module ExecutionTests
3
3
using BenchmarkTools
4
4
using Profile
5
5
using Test
6
+ using LinuxPerf
6
7
7
8
seteq (a, b) = length (a) == length (b) == length (intersect (a, b))
8
9
@@ -382,4 +383,34 @@ b = x = nothing
382
383
GC. gc ()
383
384
@test x_finalized
384
385
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
+
385
416
end # module
0 commit comments