diff options
author | Eugeni Dodonov <eugeni.dodonov@intel.com> | 2011-11-07 21:40:45 -0200 |
---|---|---|
committer | Eugeni Dodonov <eugeni.dodonov@intel.com> | 2011-11-09 11:46:10 -0200 |
commit | 3ffc4289b034b0bbba809a2cc4840451278ad3d0 (patch) | |
tree | eb78331c832b10edaac5b81abfa694f3613adadc | |
parent | fa6729d596e62ec5986d45c4557a4ea15c00758e (diff) |
intel_gpu_analyze: discover column values by their names
This allows to have customized outputs, and does not needs to adapt to
fixed column positions all the time.
Thus, we can have flexible columns in the output, and only grab the ones
which we care about.
We still do not handle missing columns while parsing though.
Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
-rwxr-xr-x | tools/intel_gpu_analyze.py | 58 |
1 files changed, 22 insertions, 36 deletions
diff --git a/tools/intel_gpu_analyze.py b/tools/intel_gpu_analyze.py index c2e60e9..513b463 100755 --- a/tools/intel_gpu_analyze.py +++ b/tools/intel_gpu_analyze.py @@ -96,40 +96,26 @@ def print_header(output): def collect(fd): """Collects statistics for a given command""" - results = {'time': [], - 'utime': [], - 'stime': [], - 'power': [], - 'render': [], - 'render_ops': [], - 'bitstr': [], - 'bitstr_ops': [], - 'bitstr2': [], - 'bitstr2_ops': [], - 'blitter': [], - 'blitter_ops': [] - } + columns={} + results = {} while True: line = fd.readline() if not line: break line.strip() if line[0] == "#": + # detecting column names + cols = line[1:].split() + for pos in range(len(cols)): + columns[cols[pos]] = pos + for col in columns: + results[col] = [] continue data = line.split() - # TODO: detect column names from headers - results['time'].append(float(data[0])) - results['utime'].append(float(data[1])) - results['stime'].append(float(data[2])) - results['power'].append(float(data[3])) - results['render'].append(float(data[4])) - results['render_ops'].append(int(data[5])) - results['bitstr'].append(float(data[6])) - results['bitstr_ops'].append(int(data[7])) - results['bitstr2'].append(float(data[8])) - results['bitstr2_ops'].append(int(data[9])) - results['blitter'].append(float(data[10])) - results['blitter_ops'].append(int(data[11])) + # fill in results from the headers + for item in columns.keys(): + pos = columns[item] + results[item].append(float(data[pos])) return results def analyse_perf(logfile, out_dir, perf="perf.html"): @@ -220,13 +206,13 @@ def analyse(results, title, out_dir, perf_logfile=None, summary="index.html"): ('stime', 'System time % of CPU'), ('power', 'Power consumption (W)'), ('render', 'Render engine usage % of GPU'), - ('render_ops', 'Render engine ops per interval'), - ('bitstr', 'Bitstream engine usage % of GPU'), - ('bitstr_ops', 'Bitstream engine ops per interval'), - ('bitstr2', 'Bitstream 6 engine usage % of GPU'), - ('bitstr2_ops', 'Bitstream 6 engine ops per interval'), + ('render.ops', 'Render engine ops per interval'), + ('bitstream', 'Bitstream engine usage % of GPU'), + ('bitstream.ops', 'Bitstream engine ops per interval'), + ('bitstream6', 'Bitstream 6 engine usage % of GPU'), + ('bitstream6.ops', 'Bitstream 6 engine ops per interval'), ('blitter', 'Blitter engine usage % of GPU'), - ('blitter_ops', 'Blitter engine ops per interval'), + ('blitter.ops', 'Blitter engine ops per interval'), ]: minval = results['%s_min' % iter] maxval = results['%s_max' % iter] @@ -264,7 +250,7 @@ def analyse(results, title, out_dir, perf_logfile=None, summary="index.html"): ax.plot(results['time'], results['utime'], label="User time") ax.plot(results['time'], results['stime'], label="System time") num_axis = 2 - for ring in ["render", "bitstr", "bitstr2", "blitter"]: + for ring in ["render", "bitstream", "bitstream6", "blitter"]: if results["%s_avg" % ring] == -1: print "No data for %s, skipping" % ring continue @@ -295,7 +281,7 @@ def analyse(results, title, out_dir, perf_logfile=None, summary="index.html"): pylab.xlabel("Time (s)") num_axis = 0 - for ring in ["render_ops", "bitstr_ops", "bitstr2_ops", "blitter_ops"]: + for ring in ["render.ops", "bitstream.ops", "bitstream6.ops", "blitter.ops"]: if results["%s_avg" % ring] == -1: print "No data for %s, skipping" % ring continue @@ -358,7 +344,7 @@ def analyse(results, title, out_dir, perf_logfile=None, summary="index.html"): pylab.xlabel("Time (s)") num_axis = 0 - for ring in ["render", "bitstr", "bitstr2", "blitter"]: + for ring in ["render", "bitstream", "bitstream6", "blitter"]: if results["%s_avg" % ring] == -1: print "No data for %s, skipping" % ring continue @@ -382,7 +368,7 @@ def analyse(results, title, out_dir, perf_logfile=None, summary="index.html"): } # per-ring power - for ring in ["render", "bitstr", "bitstr2", "blitter"]: + for ring in ["render", "bitstream", "bitstream6", "blitter"]: if results["%s_avg" % ring] == -1: print "No data for %s, skipping" % ring continue |