-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
LinuxPerf
extension for branch + instruction counts
This updates the core BenchmarkTools types to include `instructions` and `branches` fields. If the extension is not available, these are `NaN`. No support is included for measuring overhead or making judgements based on these fields, but Serialization, Statistics, etc. are all supported with their usual functionality for Trial / TrialEstimate / etc.
- Loading branch information
1 parent
cb09e40
commit 0b21870
Showing
14 changed files
with
418 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module LinuxPerfExt | ||
|
||
import BenchmarkTools: PerfInterface | ||
import LinuxPerf: LinuxPerf, PerfBench, EventGroup, EventType | ||
import LinuxPerf: enable!, disable!, enable_all!, disable_all!, close, read! | ||
|
||
function interface() | ||
return PerfInterface(; | ||
setup=() -> PerfBench( | ||
0, [EventGroup([EventType(:hw, :instructions), EventType(:hw, :branches)])] | ||
), | ||
start=(bench) -> enable_all!(), | ||
stop=(bench) -> disable_all!(), | ||
# start=(bench) -> enable!(bench), | ||
# stop=(bench) -> disable!(bench), | ||
teardown=(bench) -> close(bench), | ||
read=(bench) -> let g = only(bench.groups) | ||
(insts, branches) = read!(g.leader_io, Vector{UInt64}(undef, 5)) | ||
return (insts, branches) | ||
end, | ||
) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.