Skip to content

Commit

Permalink
Add multibench support to all-in-one json
Browse files Browse the repository at this point in the history
Add benchmarks block to identify bench ids.
The blockbreaker utility extracts the benchmark
from the runfile and processes multibench config.

This requires additional changes on the crucible
code to fully support 'benchmarks' block from the
json runfile.
  • Loading branch information
rafaelfolco committed Sep 14, 2023
1 parent 0d311e6 commit d058e8c
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 3 deletions.
26 changes: 25 additions & 1 deletion util/JSON/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,35 @@
"enum": [
"2022.11.08",
"2023.03.10",
"2023.06.06"
"2023.06.06",
"2023.09.12"
]
}
}
},
"benchmarks": {
"type": "array",
"items": {
"minItems": 1,
"uniqueItems": true,
"type": "object",
"properties": {
"name": {
"type": "string",
"minLength": 1
},
"ids": {
"type": "string",
"pattern": "^[1-9][0-9]*(-[1-9][0-9]*)?$"
}
},
"required": [
"name",
"ids"
],
"additionalProperties": false
}
},
"tags": {
"type": "object",
"additionalProperties": {
Expand Down
25 changes: 23 additions & 2 deletions util/blockbreaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def process_options():
dest = "config",
required = True,
help = "Configuration type to get from the json file",
choices = [ "mv-params", "tool-params", "passthru-args", "tags", "endpoint" ])
choices = [ "benchmarks", "mv-params", "tool-params", "passthru-args", "tags", "endpoint" ])

parser.add_argument("--index",
dest = "index",
Expand Down Expand Up @@ -205,6 +205,25 @@ def validate_schema(input_json, schema_file = None):
return False
return True

def get_bench_ids(json_obj, cfg):
"""Get benchmark names and ids from the benchmarks block"""
stream=""
if json_obj is None:
return ""
try:
bench_count = len(json_obj[cfg])
if bench_count > 0:
for idx in range(0, bench_count):
json_blk = json_obj[cfg][idx]
stream+=json_blk["name"]+":"+json_blk["ids"]+","
# remove last ","
if len(stream)>0:
stream = stream[:-1]
except:
pass

return stream

def main():
"""Main function of get-json-config.py tool"""

Expand All @@ -217,7 +236,9 @@ def main():
if not validate_schema(input_json):
return 1

if args.config == "endpoint" or args.config == "tags":
if args.config == "benchmarks":
output = get_bench_ids(input_json, args.config)
elif args.config == "endpoint" or args.config == "tags":
# output is a stream of the endpoint or tags
output = json_to_stream(input_json, args.config, args.index)
else:
Expand Down

0 comments on commit d058e8c

Please sign in to comment.