Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
perf_headwind.py
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file perf_headwind.py
1 #!/usr/bin/env python3
2 import sys
3 
4 from headwind.spec import CollectorResult, Run, Metric
5 
6 import pandas as pd
7 
8 assert len(sys.argv) == 2
9 input_file = sys.argv[1]
10 
11 
12 metrics = []
13 metric_names = []
14 
15 df = pd.read_csv(input_file)
16 df = df.drop_duplicates(subset=["file"])
17 df.max_rss = df.max_rss / 1024 / 1024 / 1024 # GB
18 
19 limit = 20
20 
21 mdf = df.sort_values(by="max_rss", ascending=False)
22 for row in mdf.itertuples():
23  name = "max_rss_" + row.file
24  metrics.append(
25  Metric(name=name, value=row.max_rss, unit="GB", group="compile_max_rss")
26  )
27  if name in metric_names:
28  print("Duplicate:", name)
29  metric_names.append(name)
30 
31 tdf = df.sort_values(by="time", ascending=False)
32 for row in tdf.itertuples():
33  name = "time_" + row.file
34  metrics.append(
35  Metric(name=name, value=row.time, unit="seconds", group="compile_time")
36  )
37  if name in metric_names:
38  print("Duplicate:", name)
39  metric_names.append(name)
40 
41 sys.stdout.write(CollectorResult(metrics=metrics).json(indent=2))