@@ -105,6 +105,7 @@ def get_min_time_bytes(df, device_info):
105105def derive_metrics (gf , metrics , raw_metrics , device_info ):
106106 derived_metrics = []
107107 original_metrics = []
108+ exclusive_metrics = ["util" ] + list (derivable_metrics .keys ()) + list (avg_time_factor_dict .factor .keys ())
108109 internal_frame_indices = gf .dataframe ["device_id" ].isna ()
109110
110111 def get_time_seconds (df ):
@@ -133,6 +134,7 @@ def get_time_seconds(df):
133134 gf .dataframe [f"{ metric } (inc)" ] = (get_time_seconds (gf .dataframe ) /
134135 time_factor_dict .factor [metric_time_unit ])
135136 derived_metrics .append (f"{ metric } (inc)" )
137+ metric_name = match_available_metrics ([time_factor_dict .name ], raw_metrics )[0 ]
136138 elif metric in avg_time_factor_dict .factor :
137139 metric_time_unit = avg_time_factor_dict .name + "/" + metric .split ("/" )[1 ]
138140 gf .dataframe [f"{ metric } (inc)" ] = (get_time_seconds (gf .dataframe ) / gf .dataframe ['count' ] /
@@ -141,7 +143,12 @@ def get_time_seconds(df):
141143 derived_metrics .append (f"{ metric } (inc)" )
142144 else :
143145 original_metrics .append (metric )
144-
146+ if metric not in exclusive_metrics :
147+ single_frame = gf .dataframe [metric_name ]
148+ total = gf .dataframe [metric_name ].iloc [0 ]
149+ metric = metric .split ("/" )[0 ]
150+ gf .dataframe [f"{ metric } /% (inc)" ] = (single_frame / total ) * 100.0
151+ derived_metrics .append (f"{ metric } /% (inc)" )
145152 if original_metrics :
146153 original_metrics = match_available_metrics (original_metrics , raw_metrics )
147154 return derived_metrics + original_metrics
@@ -227,6 +234,10 @@ def main():
227234- flop[<8/16/32/64>]/s, gflop[<8/16/32/64>]/s, tflop[<8/16/32/64>]/s: flops / time
228235- byte/s, gbyte/s, tbyte/s: bytes / time
229236- util: max(sum(flops<width>) / peak_flops<width>_time, sum(bytes) / peak_bandwidth_time)
237+
238+ For inclusive metrics (e.g. time) an additional column is printed showing the percentage
239+ each frame is of the full model.
240+
230241""" ,
231242 )
232243 argparser .add_argument (
0 commit comments