Skip to content

Commit b54e147

Browse files
committed
Explicitly list value size
1 parent 85877b9 commit b54e147

2 files changed

Lines changed: 30 additions & 29 deletions

File tree

jmh_plot.json

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"min": 1024
77
},
88
"label": "allbig",
9-
"subselection": ">= 1024"
9+
"valueSizeTitle": ">= 1024"
1010
},
1111
{
1212
"xaxisparam": {
@@ -15,7 +15,7 @@
1515
"max": 4096
1616
},
1717
"label": "allsmall",
18-
"subselection": "<= 4096"
18+
"valueSizeTitle": "<= 4096",
1919
# defaults to include_patterns of all matching
2020
},
2121
{
@@ -26,7 +26,7 @@
2626
},
2727
"exclude_patterns": ["Pooled"],
2828
"label": "nopoolsmall",
29-
"subselection": "<= 4096 (excluding Pooled)"
29+
"valueSizeTitle": "<= 4096"
3030
},
3131
{
3232
"xaxisparam": {
@@ -35,63 +35,56 @@
3535
},
3636
"exclude_patterns": ["Pooled"],
3737
"label": "nopoolbig",
38-
"subselection": ">= 1024 (excluding Pooled)"
38+
"valueSizeTitle": ">= 1024"
3939
},
4040
{
4141
"xaxisparam": {
4242
"name": "valueSize"
4343
},
4444
"include_patterns": ["ByteArray"],
45-
"label": "ba",
46-
"subselection": "Byte Array"
45+
"label": "ba"
4746
},
4847
{
4948
"xaxisparam": {
5049
"name": "valueSize"
5150
},
5251
"include_patterns": ["ByteBuf"],
53-
"label": "bb",
54-
"subselection": "Byte Buffer"
52+
"label": "bb"
5553
},
5654
{
5755
"xaxisparam": {
5856
"name": "valueSize"
5957
},
6058
"include_patterns": ["Direct"],
61-
"label": "dir",
62-
"subselection": "Direct"
59+
"label": "dir"
6360
},
6461
{
6562
"xaxisparam": {
6663
"name": "valueSize"
6764
},
6865
"include_patterns": ["Indirect"],
69-
"label": "ind",
70-
"subselection": "Indirect"
66+
"label": "ind"
7167
},
7268
{
7369
"xaxisparam": {
7470
"name": "valueSize"
7571
},
7672
"include_patterns": ["Critical"],
77-
"label": "crit",
78-
"subselection": "Critical"
73+
"label": "crit"
7974
},
8075
{
8176
"xaxisparam": {
8277
"name": "valueSize"
8378
},
8479
"include_patterns": ["GetElements"],
85-
"label": "getelems",
86-
"subselection": "GetElements"
80+
"label": "getelems"
8781
},
8882
{
8983
"xaxisparam": {
9084
"name": "valueSize"
9185
},
9286
"include_patterns": ["SetRegion"],
93-
"label": "setreg",
94-
"subselection": "SetRegion"
87+
"label": "setreg"
9588
}
9689
],
9790
"result.path": "./analysis/testplots"

jmhplot.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,11 @@ def tuple_of_secondary_keys(params: BMParams) -> Tuple:
193193
return tuple(secondaryKeys)
194194

195195

196-
def plot_all_results(params: BMParams, resultSets: ResultSets, path, include_benchmarks: str, exclude_benchmarks: str, label: str, subselection: str, system_info: str) -> None:
196+
def plot_all_results(params: BMParams, xaxisparam:Dict, result_sets: ResultSets, path, include_benchmarks: str, exclude_benchmarks: str, label: str, value_size_title: str, system_info: str) -> None:
197197
indexKeys = tuple_of_secondary_keys(params)
198-
for indexTuple, resultSet in resultSets.items():
199-
plot_result_set(indexKeys, indexTuple, resultSet,
200-
path, include_benchmarks, exclude_benchmarks, label, subselection, system_info)
198+
for indexTuple, resultSet in result_sets.items():
199+
plot_result_set(xaxisparam, indexKeys, indexTuple, resultSet,
200+
path, include_benchmarks, exclude_benchmarks, label, value_size_title, system_info)
201201

202202

203203
def plot_result_axis_errorbars(ax, resultSet: ResultSet) -> None:
@@ -256,7 +256,7 @@ def plot_result_axis_bars(ax, resultSet: ResultSet) -> None:
256256
bmIndex = bmIndex + 1
257257

258258

259-
def plot_result_set(indexKeys: Tuple, indexTuple: Tuple, resultSet: ResultSet, path: pathlib.Path, include_benchmarks: str, exclude_benchmarks: str, label: str, subselection: str, system_info: str):
259+
def plot_result_set(xaxisparam:Dict, indexKeys: Tuple, indexTuple: Tuple, resultSet: ResultSet, path: pathlib.Path, include_benchmarks: str, exclude_benchmarks: str, label: str, value_size_title: str, system_info: str):
260260
# Determine how many colors we need
261261
num_benchmarks = len(resultSet)
262262

@@ -274,9 +274,9 @@ def plot_result_set(indexKeys: Tuple, indexTuple: Tuple, resultSet: ResultSet, p
274274
plot_result_axis_bars(ax, resultSet)
275275

276276
plt.suptitle(system_info)
277-
title = f'{str(indexKeys)}={str(indexTuple)} include={include_benchmarks} exclude={exclude_benchmarks} subselection="{subselection}"'
277+
title = f'{str(indexKeys)}={str(indexTuple)} include={include_benchmarks} exclude={exclude_benchmarks} Value Size="{value_size_title}"'
278278
plt.title(title)
279-
plt.xlabel("# Operations")
279+
plt.xlabel(extract_parameter_name(xaxisparam))
280280
plt.ylabel("t (ns)")
281281
plt.legend(loc='upper left', bbox_to_anchor=(1, 1))
282282
plt.grid(visible='True', which='both')
@@ -322,7 +322,7 @@ def filter_for_benchmarks(dataframe: DataFrame, include_benchmarks, exclude_benc
322322

323323
def filter_for_range(dataframe: DataFrame, xaxisparam: Dict) -> DataFrame:
324324

325-
param_name = required('name', xaxisparam)
325+
param_name = extract_parameter_name(xaxisparam)
326326
xmin = optional('min', xaxisparam, lambda x: int(x))
327327
xmax = optional('max', xaxisparam, lambda x: int(x))
328328
if xmax is None and xmin is None:
@@ -340,6 +340,14 @@ def filter_for_range(dataframe: DataFrame, xaxisparam: Dict) -> DataFrame:
340340
lambda x: int(x) >= xmin and int(x) <= xmax)]
341341

342342

343+
def extract_parameter_name(xaxisparam):
344+
return required('name', xaxisparam)
345+
346+
347+
def default_if_none(optional_string, default_value: str) -> str:
348+
return default_value if optional_string is None else optional_string
349+
350+
343351
def process_some_plots(path: pathlib.Path, plot: Dict) -> None:
344352

345353
xaxisparam = required('xaxisparam', plot)
@@ -348,7 +356,7 @@ def process_some_plots(path: pathlib.Path, plot: Dict) -> None:
348356
include_benchmarks = optional('include_patterns', plot)
349357
exclude_benchmarks = optional('exclude_patterns', plot)
350358
label = required('label', plot)
351-
subselection = optional('subselection', plot)
359+
value_size_title = default_if_none(optional('valueSizeTitle', plot), "All")
352360

353361
# Check for system_info.json in the path
354362
system_info = None
@@ -388,8 +396,8 @@ def process_some_plots(path: pathlib.Path, plot: Dict) -> None:
388396
params: BMParams = split_params(
389397
extract_params(dataframe), primary_param_name)
390398
resultSets = extract_results_per_param(dataframe, params)
391-
plot_all_results(params, resultSets, path,
392-
include_benchmarks, exclude_benchmarks, label, subselection, system_info)
399+
plot_all_results(params, xaxisparam, resultSets, path,
400+
include_benchmarks, exclude_benchmarks, label, value_size_title, system_info)
393401

394402

395403
def process_benchmarks(config: Dict) -> None:

0 commit comments

Comments
 (0)