6 usage =
"""Usage: mergeResourceJson.py FILE [FILE ...] 8 Merge the content of multiple "resources.json" files produced by the FastTimerService, 9 and print the result to standard output. 12 mergeResourceJson.py step*/pid*/resources.json > resources.json 16 dest[
"events"] += data[
"events"]
17 for metric
in metrics:
18 dest[metric] += data[metric]
21 if len(sys.argv) == 1:
25 if '-h' in sys.argv[1:]
or '--help' in sys.argv[1:]:
29 with open(sys.argv[1])
as f:
32 metrics = [ label
for resource
in output[
"resources"]
for label
in resource ]
34 datamap = { module[
"type"] +
'|' + module[
"label"] : module
for module
in output[
"modules"] }
36 for arg
in sys.argv[2:]:
40 if output[
"resources"] != input[
"resources"]:
41 print(
"Error: input files describe different metrics")
44 if output[
"total"][
"label"] != input[
"total"][
"label"]:
45 print(
"Warning: input files describe different process names")
46 merge_into(metrics, input[
"total"], output[
"total"])
48 for module
in input[
"modules"]:
49 key = module[
"type"] +
'|' + module[
"label"]
54 output[
"modules"].
append(datamap[key])
56 json.dump(output, sys.stdout, indent = 2 )
57 sys.stdout.write(
'\n')
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
def merge_into(metrics, data, dest)