-
Notifications
You must be signed in to change notification settings - Fork 41
Adapt dotnet memory allocations #705
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
ricardoboss
wants to merge
17
commits into
bencherdev:devel
Choose a base branch
from
ricardoboss:issues/699-dotnet-memory-allocations
base: devel
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.
+1,358
−7
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
73f7843
feat: added ability to deserialize memory from dotnet results
ricardoboss 1f032bb
test: added new tool output from BenchmarkDotNet with memory information
ricardoboss 3781ee4
feat: added .NET specific measures
ricardoboss 52b14d2
feat: rewritten dotnet measures to store allocated alongside latency …
ricardoboss 406e6cd
test: added test for memory allocations
ricardoboss 9fa867b
test: smaller test file for BenchmarkDotNet memory
ricardoboss 6b789c3
test: adjusted test case for new tool output file
ricardoboss 9b395cf
style: sort result enums alphabetically
ricardoboss 27e8d1b
revert: use default latency measure
ricardoboss 10a6655
docs: refine GC collects unit label
ricardoboss 1febc46
style: move dotnet below json
ricardoboss 1047703
revert: docs: refine GC collects unit label
ricardoboss 30316d4
feat: added handling and tests for other memory-related measures
ricardoboss 1e27be8
fix: avoid using `.unwrap()`
ricardoboss 88a518d
test: also check latency measures in memory tool output
ricardoboss 54d2008
style: formatting
ricardoboss 3dd5e41
style: applied suggested changes from clippy
ricardoboss 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,6 +32,16 @@ pub enum AdapterMeasure { | |
| Throughput(JsonNewMetric), | ||
| } | ||
|
|
||
| #[derive(Debug, Clone, PartialEq, Eq)] | ||
| pub enum DotNetMeasure { | ||
| Latency(JsonNewMetric), | ||
| Gen0Collects(JsonNewMetric), | ||
| Gen1Collects(JsonNewMetric), | ||
| Gen2Collects(JsonNewMetric), | ||
| TotalOperations(JsonNewMetric), | ||
| Allocated(JsonNewMetric), | ||
| } | ||
|
|
||
| #[derive(Debug, Clone, PartialEq, Eq)] | ||
| pub enum IaiMeasure { | ||
| Instructions(JsonNewMetric), | ||
|
|
@@ -212,6 +222,44 @@ impl AdapterResults { | |
| Some(results_map.into()) | ||
| } | ||
|
|
||
| pub fn new_dotnet(benchmark_metrics: Vec<(BenchmarkName, Vec<DotNetMeasure>)>) -> Option<Self> { | ||
|
Member
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. For consistency, lets move this method above |
||
| if benchmark_metrics.is_empty() { | ||
| return None; | ||
| } | ||
|
|
||
| let mut results_map = HashMap::new(); | ||
| for (benchmark_name, measure) in benchmark_metrics { | ||
| let metrics_value = results_map | ||
| .entry(BenchmarkNameId::new_name(benchmark_name)) | ||
| .or_insert_with(AdapterMetrics::default); | ||
| for metric in measure { | ||
| let (resource_id, metric) = match metric { | ||
| DotNetMeasure::Latency(json_metric) => { | ||
| (built_in::default::Latency::name_id(), json_metric) | ||
| }, | ||
| DotNetMeasure::Allocated(json_metric) => { | ||
| (built_in::dotnet::Allocated::name_id(), json_metric) | ||
| }, | ||
| DotNetMeasure::Gen0Collects(json_metric) => { | ||
| (built_in::dotnet::Gen0Collects::name_id(), json_metric) | ||
| }, | ||
| DotNetMeasure::Gen1Collects(json_metric) => { | ||
| (built_in::dotnet::Gen1Collects::name_id(), json_metric) | ||
| }, | ||
| DotNetMeasure::Gen2Collects(json_metric) => { | ||
| (built_in::dotnet::Gen2Collects::name_id(), json_metric) | ||
| }, | ||
| DotNetMeasure::TotalOperations(json_metric) => { | ||
| (built_in::dotnet::TotalOperations::name_id(), json_metric) | ||
| }, | ||
| }; | ||
| metrics_value.inner.insert(resource_id, metric); | ||
| } | ||
| } | ||
|
|
||
| Some(results_map.into()) | ||
| } | ||
|
|
||
| #[expect(clippy::too_many_lines)] | ||
| pub fn new_gungraun( | ||
| benchmark_metrics: Vec<(BenchmarkName, Vec<GungraunMeasure>)>, | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the harness collect both memory and wall-clock time measurements at the same time or are they mutually exclusive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is above my paygrade... I have no idea 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like it does:
In the sample file, there are both:
With that being the case, we're going to want to make sure we:
Right now, it seems like we are only collecting the memory measurements if they are present (skipping 1.).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I follow... How is the statistics object relevant for the memory allocations? Isn't this used for the latency measurement? That part should mostly be untouched by my changes (latency is still being collected)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Then we just need to make sure we are testing that the latency measures are still being collected properly.
That is, this
adapter_c_sharp_dot_net_memorytest should assert on each expected measure (includingLatency).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, no problem