Skip to content

Commit

Permalink
support for JMH parameters (as separate charts)
Browse files Browse the repository at this point in the history
  • Loading branch information
matyasberry committed Mar 16, 2023
1 parent 060e110 commit 33d46d3
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ export interface JmhBenchmarkJson {
measurementIterations: number;
measurementTime: string;
measurementBatchSize: number;
params: object;
primaryMetric: {
score: number;
scoreError: number;
Expand Down Expand Up @@ -610,8 +611,9 @@ function extractJmhResult(output: string): BenchmarkResult[] {
const name = b.benchmark;
const value = b.primaryMetric.score;
const unit = b.primaryMetric.scoreUnit;
const params = b.params ? ' ( ' + JSON.stringify(b.params) + ' )' : '';
const extra = `iterations: ${b.measurementIterations}\nforks: ${b.forks}\nthreads: ${b.threads}`;
return { name, value, unit, extra };
return { name: name + params, value, unit, extra };
});
}

Expand Down
57 changes: 57 additions & 0 deletions test/data/extract/jmh_output_2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[
{
"jmhVersion" : "1.29",
"benchmark" : "org.openjdk.jmh.samples.JMHSample_01_HelloWorld.wellHelloThere",
"mode" : "thrpt",
"threads" : 1,
"forks" : 1,
"jvm" : "/home/mmior/.jabba/jdk/1.8.202/jre/bin/java",
"jvmArgs" : [
],
"jdkVersion" : "1.8.0_202",
"vmName" : "Java HotSpot(TM) 64-Bit Server VM",
"vmVersion" : "25.202-b08",
"warmupIterations" : 1,
"warmupTime" : "10 s",
"warmupBatchSize" : 1,
"measurementIterations" : 3,
"measurementTime" : "10 s",
"measurementBatchSize" : 1,
"params" : {
"paramA" : "17",
"paramB" : "33"
},
"primaryMetric" : {
"score" : 3.3762388731228185E9,
"scoreError" : 1.4287985743935993E7,
"scoreConfidence" : [
3.3619508873788824E9,
3.3905268588667545E9
],
"scorePercentiles" : {
"0.0" : 3.375353964729294E9,
"50.0" : 3.37651988895058E9,
"90.0" : 3.376842765688582E9,
"95.0" : 3.376842765688582E9,
"99.0" : 3.376842765688582E9,
"99.9" : 3.376842765688582E9,
"99.99" : 3.376842765688582E9,
"99.999" : 3.376842765688582E9,
"99.9999" : 3.376842765688582E9,
"100.0" : 3.376842765688582E9
},
"scoreUnit" : "ops/s",
"rawData" : [
[
3.376842765688582E9,
3.37651988895058E9,
3.375353964729294E9
]
]
},
"secondaryMetrics" : {
}
}
]


12 changes: 12 additions & 0 deletions test/extract.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,18 @@ describe('extractResult()', function () {
},
],
},
{
tool: 'jmh',
file: 'jmh_output_2.json',
expected: [
{
extra: 'iterations: 3\nforks: 1\nthreads: 1',
name: 'org.openjdk.jmh.samples.JMHSample_01_HelloWorld.wellHelloThere ( {"paramA":"17","paramB":"33"} )',
unit: 'ops/s',
value: 3.3762388731228185e9,
},
],
},
{
tool: 'benchmarkdotnet',
file: 'benchmarkdotnet.json',
Expand Down

0 comments on commit 33d46d3

Please sign in to comment.