'startInMs', 'endInMs', 'startComputeMs', 'endComputeMs', 'startOutMs', 'endOutMs' ] intervals = ['inMs', 'computeMs', 'outMs', 'latencyMs', 'endToEndMs'] all_metrics = timestamps + intervals default_metrics = ",".join(all_metrics) descriptions = [ 'start input', 'end input', 'start compute', 'end compute', 'start output', 'end output', 'input', 'compute', 'output', 'latency', 'end to end latency' ] metrics_description = prn_utils.combine_descriptions( 'Possible metrics (all in ms) are:', all_metrics, descriptions) def skip_trace(trace, start): ''' Skip trace entries until start time ''' trailing = [] for t in trace: if t['start compute'] >= start: trailing.append(t) return trailing def hasTimestamp(metric_set):
import sys import json import argparse import prn_utils all_features = ['name', 'timeMs', 'averageMs', 'percentage'] default_features = ",".join(all_features) descriptions = [ 'layer name', 'total layer time', 'average layer time', 'percentage of total time' ] features_description = prn_utils.combine_descriptions( 'Features are (times in ms):', all_features, descriptions) def hasNames(feature_set): ''' Check if the name is included in the set ''' return 'name' in feature_set def total_data(data, names): ''' Add row at the bottom with the total ''' accumulator = [] if names: start = 1
'startInMs', 'endInMs', 'startComputeMs', 'endComputeMs', 'startOutMs', 'endOutMs' ] intervals = ['inMs', 'computeMs', 'outMs', 'latencyMs', 'endToEndMs'] allMetrics = timestamps + intervals defaultMetrics = ",".join(allMetrics) descriptions = [ 'start input', 'end input', 'start compute', 'end compute', 'start output', 'end output', 'input', 'compute', 'output', 'latency', 'end to end latency' ] metricsDescription = pu.combine_descriptions( 'Possible metrics (all in ms) are:', allMetrics, descriptions) def skipTrace(trace, start): ''' Skip trace entries until start time ''' for t in range(len(trace)): if trace[t]['startComputeMs'] >= start: return trace[t:] return [] def hasTimestamp(metrics): ''' Check if features have at least one timestamp '''