Skip to content

Commit

Permalink
Added extra percentile memory metrics for the ASP.NET Benchmarks (#3445)
Browse files Browse the repository at this point in the history
* Added the ability to get extra percentile metrics

* Added the parsing logic in the analysis

* Updated the Percentile Based Metrics yaml

* Copy if newer for the yml file
  • Loading branch information
mrsharm authored Nov 3, 2023
1 parent 6bf0443 commit be54049
Show file tree
Hide file tree
Showing 4 changed files with 289 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,11 @@ public static (string, string) Build(ASPNetBenchmarksConfiguration configuration
commandStringBuilder.Append(" --application.options.downloadBuildLog true ");
commandStringBuilder.Append($" --application.options.downloadBuildLogOutput {Path.Combine(configuration.Output.Path, run.Key, $"{benchmarkNameToCommand.Key}_{run.Key}.build.log")} ");


commandStringBuilder.Append($" --json {Path.Combine(configuration.Output.Path, run.Key, $"{benchmarkNameToCommand.Key}_{run.Key}.json")}");

// Add the extra metrics by including the configuration.
commandStringBuilder.Append($" --config {Path.Combine("Commands", "RunCommand", "BaseSuite", "PercentileBasedMetricsConfiguration.yml")} ");

return (processName, commandStringBuilder.ToString());
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# This file adds the percentile based metrics to the Working Set Memory and the Private Memory the results from crank.

results:

- name: benchmarks/working-set/P99
description: Working Set P99 (MB)
format: n0

- name: benchmarks/working-set/P95
description: Working Set P95 (MB)
format: n0

- name: benchmarks/working-set/steady
description: Working Set P90 (MB)
format: n0

- name: benchmarks/working-set/P75
description: Working Set P75 (MB)
format: n0

- name: benchmarks/working-set/P50
description: Working Set P50 (MB)
format: n0

- name: benchmarks/private-memory/P99
description: Private Memory P99 (MB)
format: n0

- name: benchmarks/private-memory/P95
description: Private Memory P95 (MB)
format: n0

- name: benchmarks/private-memory/P90
description: Private Memory P90 (MB)
format: n0

- name: benchmarks/private-memory/P75
description: Private Memory P75 (MB)
format: n0

- name: benchmarks/private-memory/P50
description: Private Memory P50 (MB)
format: n0

onResultsCreating:
- |
function mapReduce(measurement, reduce) {
// Calculates the result of the 'reduce' operation on the 'measurement' property of the application job.
// example:
// const result = steadyState('benchmarks/working-set', percentile90);
let duration = benchmarks.jobs.load.variables.duration;
let measurements = benchmarks.jobs.application.measurements[0].filter(m => m.name == measurement);
// Don't add any result if there are no measurements
if (measurements.length == 0) {
console.warn(`No measurements available for '${measurement}'.`);
return null;
}
let lastMeasurement = measurements[measurements.length-1];
let begin = new Date(lastMeasurement.timestamp) - duration * 1000;
let recent = measurements.filter(m => new Date(m.timestamp) >= begin);
let values = recent.map(m => m.value);
let result = reduce(values);
return result;
}
onResultsCreated:
- |
benchmarks.jobs.application.results["benchmarks/working-set/P99"] = mapReduce('benchmarks/working-set', percentile99);
benchmarks.jobs.application.results["benchmarks/working-set/P95"] = mapReduce('benchmarks/working-set', percentile95);
benchmarks.jobs.application.results["benchmarks/working-set/P90"] = mapReduce('benchmarks/working-set', percentile90);
benchmarks.jobs.application.results["benchmarks/working-set/P75"] = mapReduce('benchmarks/working-set', percentile75);
benchmarks.jobs.application.results["benchmarks/working-set/P50"] = mapReduce('benchmarks/working-set', percentile50);
benchmarks.jobs.application.results["benchmarks/private-memory/P99"] = mapReduce('benchmarks/private-memory', percentile99);
benchmarks.jobs.application.results["benchmarks/private-memory/P95"] = mapReduce('benchmarks/private-memory', percentile95);
benchmarks.jobs.application.results["benchmarks/private-memory/P90"] = mapReduce('benchmarks/private-memory', percentile90);
benchmarks.jobs.application.results["benchmarks/private-memory/P50"] = mapReduce('benchmarks/private-memory', percentile50);
benchmarks.jobs.application.results["benchmarks/private-memory/P75"] = mapReduce('benchmarks/private-memory', percentile75);
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
<None Update="Commands\RunCommand\BaseSuite\MicrobenchmarksToRun.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Commands\RunCommand\BaseSuite\PercentileBasedMetricsConfiguration.yml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Loading

0 comments on commit be54049

Please sign in to comment.