summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeni Dodonov <eugeni.dodonov@intel.com>2011-11-08 16:57:05 -0200
committerEugeni Dodonov <eugeni.dodonov@intel.com>2012-01-06 13:34:41 -0200
commit0a25fda913ff3a01a70e8b85190f32d9ac20fd4c (patch)
tree49ffbb3ad51c696bbaad15c6c7e47c553cdbb9f9
parent67c2fd403e1a7e711f8d249f63917356a6a4d8fd (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-xtools/intel_gpu_analyze.py65
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()