diff options
-rwxr-xr-x | tools/intel_gpu_analyser.py | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/tools/intel_gpu_analyser.py b/tools/intel_gpu_analyser.py new file mode 100755 index 0000000..a5b92f1 --- /dev/null +++ b/tools/intel_gpu_analyser.py @@ -0,0 +1,55 @@ +#!/usr/bin/python +# +# Intel GPU Top data analyser +# + +import sys +import os + +def collect(command): + """Collects statistics for a given command""" + print "Running %s" % command + fd = os.popen("intel_gpu_top -o - -e \"%s\"" % command) + results = {'time': [], + 'utime': [], + 'stime': [], + 'power': [], + 'render': [], + 'bitstr': [], + 'bitstr2': [], + 'blitter': [] + } + while True: + line = fd.readline() + if not line: + break + line.strip() + if line[0] == "#": + continue + data = line.split() + 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['bitstr'].append(float(data[6])) + results['bitstr2'].append(float(data[8])) + results['blitter'].append(float(data[10])) + return results + +def analyse(results): + """Analyses intel_gpu_top results""" + minpower = min(results['power']) + maxpower = max(results['power']) + avgpower = sum(results['power']) / len(results['power']) + print "Power: min %f, max %f, avg %f" % (minpower, maxpower, avgpower) + for iter in results: + pass + +if __name__ == "__main__": + if len(sys.argv) < 2: + print "Usage: %s <command to profile>" % sys.argv[0] + sys.exit(1) + results = collect(sys.argv[1]) + analyse(results) + print results |