Skip to content

Commit c7b53b2

Browse files
committed
Show warning if events are not measured
1 parent 312a868 commit c7b53b2

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
@@ -645,6 +645,15 @@ isrun(counter::Counter) = counter.running > 0
645645
fillrate(counter::Counter) = counter.running / counter.enabled
646646
scaledcount(counter::Counter) = counter.value * (counter.enabled / counter.running)
647647

648+
function checkstats(stats::Stats)
649+
for group in stats.groups, counter in group
650+
if !isrun(counter)
651+
@warn "Some events are not measured"
652+
return
653+
end
654+
end
655+
end
656+
648657
"""
649658
@pstats [options] expr
650659
@@ -721,6 +730,7 @@ macro pstats(args...)
721730
# trick the compiler not to eliminate the code
722731
stats = rand() < 0 ? val : Stats(bench)
723732
close(bench)
733+
checkstats(stats)
724734
return stats::Stats
725735
end)()
726736
end

0 commit comments

Comments
 (0)