Skip to content

Commit cc755eb

Browse files
committed
Show warning if events are not measured
1 parent da8de67 commit cc755eb

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/LinuxPerf.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,15 @@ isrun(counter::Counter) = counter.running > 0
666666
fillrate(counter::Counter) = counter.running / counter.enabled
667667
scaledcount(counter::Counter) = counter.value * (counter.enabled / counter.running)
668668

669+
function checkstats(stats::Stats)
670+
for group in stats.groups, counter in group
671+
if !isrun(counter)
672+
@warn "Some events are not measured"
673+
return
674+
end
675+
end
676+
end
677+
669678
"""
670679
@pstats [options] expr
671680
@@ -742,6 +751,7 @@ macro pstats(args...)
742751
# trick the compiler not to eliminate the code
743752
stats = rand() < 0 ? val : Stats(bench)
744753
close(bench)
754+
checkstats(stats)
745755
return stats::Stats
746756
end)()
747757
end

0 commit comments

Comments
 (0)