-
Notifications
You must be signed in to change notification settings - Fork 20
feat: add support for analysis mode #152
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
Open
not-matthias
wants to merge
8
commits into
main
Choose a base branch
from
cod-1711-codspeed-rust-add-analysis-mode-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
70681d6
feat: add support for analysis mode
not-matthias f83a546
chore: add example with allocations
not-matthias f378037
feat(cargo-codspeed): add analysis build mode
not-matthias 1c7a75e
chore: bump instrument-hooks
not-matthias 673df98
chore(ci): add memory profiling
not-matthias 93086ad
wip: disable memory profiling for now
not-matthias fa4e22b
chore(ci): switch to OIDC auth
not-matthias 0a30bef
fixup: add missing packages
not-matthias 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
Submodule instrument-hooks
updated
18 files
| +116 −0 | .github/workflows/ci.yml | |
| +3,248 −2,766 | dist/core.c | |
| +36 −0 | includes/compat.h | |
| +1 −0 | includes/core.h | |
| +4 −0 | scripts/release.py | |
| +3 −1 | src/bincode.zig | |
| +0 −17 | src/c.zig | |
| +6 −0 | src/instruments/analysis.zig | |
| +58 −0 | src/instruments/fifo_instrument.zig | |
| +3 −155 | src/instruments/perf.zig | |
| +25 −14 | src/instruments/root.zig | |
| +5 −1 | src/instruments/valgrind.zig | |
| +185 −0 | src/runner_fifo.zig | |
| +20 −0 | src/shared.zig | |
| +52 −20 | src/tests/deserialize_rust/create_serialized.rs | |
| +29 −0 | src/tests/deserialize_rust/rust_deser.zig | |
| +138 −0 | src/tests/deserialize_rust/serialized.zig | |
| +34 −0 | src/utils.zig |
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 |
|---|---|---|
|
|
@@ -34,6 +34,7 @@ mod linux_impl { | |
| instance | ||
| .set_integration("codspeed-rust", env!("CARGO_PKG_VERSION")) | ||
| .expect("Failed to set integration"); | ||
| InstrumentHooks::disable_callgrind_markers(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Small comment to explain that we have inline assembly for rust integration therefore we do not use instrument hooks for this |
||
| instance | ||
| }) | ||
| } | ||
|
|
@@ -129,6 +130,15 @@ mod linux_impl { | |
| ffi::instrument_hooks_current_timestamp() | ||
| } | ||
| } | ||
|
|
||
| pub fn disable_callgrind_markers() { | ||
| unsafe { | ||
| ffi::instrument_hooks_set_feature( | ||
| ffi::instrument_hooks_feature_t_FEATURE_DISABLE_CALLGRIND_MARKERS, | ||
| true, | ||
| ) | ||
| }; | ||
| } | ||
| } | ||
|
|
||
| impl Drop for InstrumentHooks { | ||
|
|
@@ -175,6 +185,8 @@ mod other_impl { | |
| pub fn current_timestamp() -> u64 { | ||
| 0 | ||
| } | ||
|
|
||
| pub fn disable_callgrind_markers() {} | ||
| } | ||
| } | ||
|
|
||
|
|
||
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 |
|---|---|---|
|
|
@@ -44,3 +44,7 @@ harness = false | |
| [[bench]] | ||
| name = "counters" | ||
| harness = false | ||
|
|
||
| [[bench]] | ||
| name = "alloc" | ||
| harness = false | ||
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,40 @@ | ||
| use std::{ | ||
| alloc::Layout, | ||
| collections::{HashMap, HashSet}, | ||
| }; | ||
|
|
||
| #[divan::bench] | ||
| fn allocate() { | ||
| println!("Hello, world!"); | ||
|
|
||
| let vec = vec![1, 2, 3]; | ||
| println!("{vec:?}"); | ||
|
|
||
| let mut map = HashMap::new(); | ||
| map.insert("key", "value"); | ||
| println!("{map:?}"); | ||
|
|
||
| let mut set = HashSet::new(); | ||
| set.insert("apple"); | ||
| set.insert("banana"); | ||
| println!("{set:?}"); | ||
|
|
||
| std::thread::sleep(std::time::Duration::from_secs(1)); | ||
|
|
||
| let mut bytes_vec = vec![0u8; 0x100]; | ||
| println!("{:?}", bytes_vec.len()); | ||
|
|
||
| bytes_vec.extend(&vec![0u8; 0x1000]); | ||
|
|
||
| // Alloc 42 bytes of memory per iteration (4200 bytes total) | ||
| for _ in 0..100 { | ||
| let layout = Layout::new::<[u8; 42]>(); | ||
| let memory = unsafe { std::alloc::alloc(layout) }; | ||
| core::hint::black_box(memory); | ||
| unsafe { std::alloc::dealloc(memory, layout) }; | ||
| } | ||
| } | ||
|
|
||
| fn main() { | ||
| divan::main(); | ||
| } |
Oops, something went wrong.
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.