-
Notifications
You must be signed in to change notification settings - Fork 77
Support measuring process-wide perf events #357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
1c26006
[WIP] support measuring perf events for mutator and GC
caizixian 8a58e73
Write again from scratch because I git reset --hard HEAD
caizixian a8225f2
Check the total number of threads in gc_init
caizixian 8985d59
Rephrase the warning
caizixian 0d42b3a
Conditionally import
caizixian ca1be45
Get rid of debug prints
caizixian 102a805
Initialize logging before printing log msg
caizixian fde95c7
Fix build error
caizixian f513693
Adjust process-wide and work-packet perf events separately
caizixian 7ddb49a
Merge branch 'master' into perf-counter-phase
caizixian 567f633
Conditionally compile Linux specific code
caizixian 46262b7
Differentiate different perf event options
caizixian 3d4b256
Fix Options type
caizixian 61258a5
Fix compilation errors
caizixian d4ea982
Cargo fmt
caizixian 2711d2d
Fix unit tests
caizixian 22404df
cargo fmt
caizixian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,41 @@ | ||
use super::Diffable; | ||
use pfm::{PerfEvent, PerfEventValue}; | ||
|
||
/// A [`Diffable`] helper type for measuring overall perf events for mutators | ||
/// and GC | ||
/// This is the process-wide counterpart of [`crate::scheduler::work_counter::WorkPerfEvent`]. | ||
pub struct PerfEventDiffable { | ||
pe: PerfEvent, | ||
} | ||
|
||
impl PerfEventDiffable { | ||
pub fn new(name: &str) -> Self { | ||
let mut pe = PerfEvent::new(name, true) | ||
.unwrap_or_else(|_| panic!("Failed to create perf event {}", name)); | ||
// measures the calling thread (and all child threads) on all CPUs | ||
pe.open(0, -1) | ||
.unwrap_or_else(|_| panic!("Failed to open perf event {}", name)); | ||
PerfEventDiffable { pe } | ||
} | ||
} | ||
|
||
impl Diffable for PerfEventDiffable { | ||
type Val = PerfEventValue; | ||
|
||
fn current_value(&mut self) -> Self::Val { | ||
let val = self.pe.read().unwrap(); | ||
self.pe.enable(); | ||
self.pe.reset(); | ||
val | ||
} | ||
|
||
fn diff(current: &Self::Val, _earlier: &Self::Val) -> u64 { | ||
// earlier value is not used as the counter is reset after each use | ||
assert_eq!(current.time_enabled, current.time_running); | ||
current.value as u64 | ||
} | ||
|
||
fn print_diff(val: u64) { | ||
print!("{}", val); | ||
} | ||
} |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.