File indexing completed on 2025-01-18 09:10:44
0001
0002 import sys
0003
0004 from headwind.spec import CollectorResult, Metric
0005
0006 import pandas as pd
0007
0008 assert len(sys.argv) == 2
0009 input_file = sys.argv[1]
0010
0011
0012 metrics = []
0013 metric_names = []
0014
0015 df = pd.read_csv(input_file)
0016 df = df.drop_duplicates(subset=["file"])
0017 df.max_rss = df.max_rss / 1024 / 1024 / 1024
0018
0019 limit = 20
0020
0021 mdf = df.sort_values(by="max_rss", ascending=False)
0022 for row in mdf.itertuples():
0023 name = "max_rss_" + row.file
0024 metrics.append(
0025 Metric(name=name, value=row.max_rss, unit="GB", group="compile_max_rss")
0026 )
0027 if name in metric_names:
0028 print("Duplicate:", name)
0029 metric_names.append(name)
0030
0031 tdf = df.sort_values(by="time", ascending=False)
0032 for row in tdf.itertuples():
0033 name = "time_" + row.file
0034 metrics.append(
0035 Metric(name=name, value=row.time, unit="seconds", group="compile_time")
0036 )
0037 if name in metric_names:
0038 print("Duplicate:", name)
0039 metric_names.append(name)
0040
0041 sys.stdout.write(CollectorResult(metrics=metrics).json(indent=2))