diff options
author | Eugeni Dodonov <eugeni.dodonov@intel.com> | 2011-11-08 16:57:05 -0200 |
---|---|---|
committer | Eugeni Dodonov <eugeni.dodonov@intel.com> | 2011-11-09 11:50:22 -0200 |
commit | 2c70597c96bdc980cc16890dcb932462e49f1c78 (patch) | |
tree | 1dd7b9423db6dd0fed5ff756ccf5edb230fde1c9 | |
parent | 27e7eed7096be82b11c9c6962a641774f11598c9 (diff) |
intel_gpu_analyze: prevent failures on missing values
Add some checks in cases where we expect to have values in results, and
they are suddently not there.
This would happen when Linux extensions are not enabled for instance.
Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
-rwxr-xr-x | tools/intel_gpu_analyze.py | 65 |
1 files changed, 41 insertions, 24 deletions
diff --git a/tools/intel_gpu_analyze.py b/tools/intel_gpu_analyze.py index d7ec2a9..4974f45 100755 --- a/tools/intel_gpu_analyze.py +++ b/tools/intel_gpu_analyze.py @@ -105,7 +105,7 @@ def collect(fd): line.strip() if line[0] == "#": # detecting column names - cols = line[1:].split() + cols = line[1:].strip().split('\t') for pos in range(len(cols)): columns[cols[pos]] = pos for col in columns: @@ -193,8 +193,8 @@ def analyse(results, title, out_dir, perf_logfile=None, summary="index.html"): keys = results.keys() for iter in keys: if not results[iter]: - print "ERROR: no results collected for '%s', aborting" % iter - sys.exit(1) + print "ERROR: no results collected for '%s', skipping" % iter + continue results["%s_min" % iter] = min(results[iter]) results["%s_max" % iter] = max(results[iter]) results["%s_avg" % iter] = sum(results[iter]) / len(results[iter]) @@ -217,6 +217,9 @@ def analyse(results, title, out_dir, perf_logfile=None, summary="index.html"): ('blitter', 'Blitter engine usage % of GPU'), ('blitter.ops', 'Blitter engine ops per interval'), ]: + if iter not in results: + print "Column %s not present in results, skipping" % iter + continue minval = results['%s_min' % iter] maxval = results['%s_max' % iter] avgval = results['%s_avg' % iter] @@ -251,17 +254,19 @@ def analyse(results, title, out_dir, perf_logfile=None, summary="index.html"): pylab.ylabel("Usage (%)") pylab.xlabel("Time (s)") - ax.plot(results['time'], results['utime'], label="User time") - ax.plot(results['time'], results['stime'], label="System time") + if 'utime' in results: + ax.plot(results['time'], results['utime'], label="User time") + if 'stime' in results: + ax.plot(results['time'], results['stime'], label="System time") num_axis = 2 for ring in ["render", "bitstream", "bitstream6", "blitter"]: - if results["%s_avg" % ring] == -1: + if results.get("%s_avg" % ring, -1) == -1: print "No data for %s, skipping" % ring continue ax.plot(results['time'], results[ring], label=ring) num_axis += 1 # Do we have power? - if results["power_avg"] != -1: + if results.get("power_avg", -1) != -1: # plotting power ax2 = ax.twinx() ax2.plot(results['time'], results["power"], label="Power (W)", color='red') @@ -286,7 +291,7 @@ def analyse(results, title, out_dir, perf_logfile=None, summary="index.html"): num_axis = 0 for ring in ["render.ops", "bitstream.ops", "bitstream6.ops", "blitter.ops"]: - if results["%s_avg" % ring] == -1: + if results.get("%s_avg" % ring, -1) == -1: print "No data for %s, skipping" % ring continue ax.plot(results['time'], results[ring], label=ring) @@ -309,9 +314,12 @@ def analyse(results, title, out_dir, perf_logfile=None, summary="index.html"): pylab.xlabel("Time (s)") ax = pylab.subplot(111) - ax.plot(results['power'], label="Power") - ax.plot(results['power.chipset'], label="Chipset") - ax.plot(results['power.gfx'], label="GFX") + if "power" in results: + ax.plot(results['time'], results["power"], label="Power (W)", color='red') + if "power.chipset" in results: + ax.plot(results['time'], results['power.chipset'], label="Chipset", color='g') + if "power.gfx" in results: + ax.plot(results['time'], results['power.gfx'], label="GFX", color='m') ax.set_position([box.x0, box.y0 + box.height * 0.1, box.width, box.height * 0.9]) ax.legend(loc = 'upper center', ncol=3, fancybox=True, shadow=True, bbox_to_anchor = (0.5, -0.1)) pylab.grid() @@ -328,12 +336,15 @@ def analyse(results, title, out_dir, perf_logfile=None, summary="index.html"): pylab.ylabel("Usage (%)") pylab.xlabel("Time (s)") - ax.plot(results['time'], results['utime'], label="User time") - ax.plot(results['time'], results['stime'], label="System time") + if 'utime' in results: + ax.plot(results['time'], results['utime'], label="User time") + if 'stime' in results: + ax.plot(results['time'], results['stime'], label="System time") # plotting power - ax2 = ax.twinx() - ax2.plot(results['time'], results["power"], label="Power (W)", color='red') - ax2.set_ylabel('Watts') + if 'power' in results: + ax2 = ax.twinx() + ax2.plot(results['time'], results["power"], label="Power (W)", color='red') + ax2.set_ylabel('Watts') pylab.grid() # Shink current axis's height by 10% on the bottom @@ -354,7 +365,7 @@ def analyse(results, title, out_dir, perf_logfile=None, summary="index.html"): num_axis = 0 for ring in ["render", "bitstream", "bitstream6", "blitter"]: - if results["%s_avg" % ring] == -1: + if results.get("%s_avg" % ring, -1) == -1: print "No data for %s, skipping" % ring continue ax.plot(results['time'], results[ring], label=ring) @@ -362,9 +373,12 @@ def analyse(results, title, out_dir, perf_logfile=None, summary="index.html"): # Do we have power? # plotting power ax2 = ax.twinx() - ax2.plot(results['time'], results["power"], label="Power (W)", color='red') - ax2.plot(results['time'], results['power.chipset'], label="Chipset (W)", color='g') - ax2.plot(results['time'], results['power.gfx'], label="GFX (W)", color='m') + if "power" in results: + ax2.plot(results['time'], results["power"], label="Power (W)", color='red') + if "power.chipset" in results: + ax2.plot(results['time'], results['power.chipset'], label="Chipset", color='g') + if "power.gfx" in results: + ax2.plot(results['time'], results['power.gfx'], label="GFX", color='m') ax2.set_ylabel('Watts') num_axis += 1 @@ -382,7 +396,7 @@ def analyse(results, title, out_dir, perf_logfile=None, summary="index.html"): # per-ring power for ring in ["render", "bitstream", "bitstream6", "blitter"]: - if results["%s_avg" % ring] == -1: + if results.get("%s_avg" % ring, -1) == -1: print "No data for %s, skipping" % ring continue fig = pylab.figure() @@ -395,9 +409,12 @@ def analyse(results, title, out_dir, perf_logfile=None, summary="index.html"): # Do we have power? # plotting power ax2 = ax.twinx() - ax2.plot(results['time'], results["power"], label="Power (W)", color='red') - ax2.plot(results['time'], results['power.chipset'], label="Chipset", color='g') - ax2.plot(results['time'], results['power.gfx'], label="GFX", color='m') + if "power" in results: + ax2.plot(results['time'], results["power"], label="Power (W)", color='red') + if "power.chipset" in results: + ax2.plot(results['time'], results['power.chipset'], label="Chipset", color='g') + if "power.gfx" in results: + ax2.plot(results['time'], results['power.gfx'], label="GFX", color='m') ax2.set_ylabel('Watts') pylab.grid() |