aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/scripts/python/stat-cpi.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/scripts/python/stat-cpi.py')
-rw-r--r--tools/perf/scripts/python/stat-cpi.py77
1 files changed, 77 insertions, 0 deletions
diff --git a/tools/perf/scripts/python/stat-cpi.py b/tools/perf/scripts/python/stat-cpi.py
new file mode 100644
index 000000000000..8b60f343dd07
--- /dev/null
+++ b/tools/perf/scripts/python/stat-cpi.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+
+data = {}
+times = []
+threads = []
+cpus = []
+
+def get_key(time, event, cpu, thread):
+ return "%d-%s-%d-%d" % (time, event, cpu, thread)
+
+def store_key(time, cpu, thread):
+ if (time not in times):
+ times.append(time)
+
+ if (cpu not in cpus):
+ cpus.append(cpu)
+
+ if (thread not in threads):
+ threads.append(thread)
+
+def store(time, event, cpu, thread, val, ena, run):
+ #print "event %s cpu %d, thread %d, time %d, val %d, ena %d, run %d" % \
+ # (event, cpu, thread, time, val, ena, run)
+
+ store_key(time, cpu, thread)
+ key = get_key(time, event, cpu, thread)
+ data[key] = [ val, ena, run]
+
+def get(time, event, cpu, thread):
+ key = get_key(time, event, cpu, thread)
+ return data[key][0]
+
+def stat__cycles_k(cpu, thread, time, val, ena, run):
+ store(time, "cycles", cpu, thread, val, ena, run);
+
+def stat__instructions_k(cpu, thread, time, val, ena, run):
+ store(time, "instructions", cpu, thread, val, ena, run);
+
+def stat__cycles_u(cpu, thread, time, val, ena, run):
+ store(time, "cycles", cpu, thread, val, ena, run);
+
+def stat__instructions_u(cpu, thread, time, val, ena, run):
+ store(time, "instructions", cpu, thread, val, ena, run);
+
+def stat__cycles(cpu, thread, time, val, ena, run):
+ store(time, "cycles", cpu, thread, val, ena, run);
+
+def stat__instructions(cpu, thread, time, val, ena, run):
+ store(time, "instructions", cpu, thread, val, ena, run);
+
+def stat__interval(time):
+ for cpu in cpus:
+ for thread in threads:
+ cyc = get(time, "cycles", cpu, thread)
+ ins = get(time, "instructions", cpu, thread)
+ cpi = 0
+
+ if ins != 0:
+ cpi = cyc/float(ins)
+
+ print "%15f: cpu %d, thread %d -> cpi %f (%d/%d)" % (time/(float(1000000000)), cpu, thread, cpi, cyc, ins)
+
+def trace_end():
+ pass
+# XXX trace_end callback could be used as an alternative place
+# to compute same values as in the script above:
+#
+# for time in times:
+# for cpu in cpus:
+# for thread in threads:
+# cyc = get(time, "cycles", cpu, thread)
+# ins = get(time, "instructions", cpu, thread)
+#
+# if ins != 0:
+# cpi = cyc/float(ins)
+#
+# print "time %.9f, cpu %d, thread %d -> cpi %f" % (time/(float(1000000000)), cpu, thread, cpi)
c?id=c60e22f7199b5fe7cee4007ccb3b27bb8a506476&follow=1'>drm/amdgpu: Fix memory leaks at amdgpu_init() error pathTakashi Iwai1-4/+5 2018-04-03drm/amdgpu: Fix PCIe lane width calculationAlex Deucher1-2/+2 2018-04-03drm/radeon: Fix PCIe lane width calculationPaul Parsons1-2/+2 2018-04-03drm/amdgpu/si: implement get/set pcie_lanes asic callbackAlex Deucher1-0/+67 2018-04-03drm/amdgpu: Add support for SRBM selection v3Andrey Grodzovsky6-79/+72 2018-04-03Revert "drm/amdgpu: Don't change preferred domian when fallback GTT v5"Chunming Zhou2-17/+17 2018-04-03drm/amd/powerply: fix power reading on FijiEric Huang1-1/+2 2018-04-03drm/amd/powerplay: Enable ACG SS featureKenneth Feng5-18/+39 2018-04-03drm/amdgpu/sdma: fix mask in emit_pipeline_syncAlex Deucher4-4/+4 2018-04-03drm/amdgpu: Fix KIQ hang on bare metal for device unbind/bind back v2.Andrey Grodzovsky1-1/+53 2018-04-03drm/amd/pp: Clean header file in vega12_smumgr.cRex Zhu1-4/+2 2018-04-03drm/amd/pp: Remove Dead functions on Vega12Rex Zhu4-1419/+23 2018-04-03drm/amd/pp: silence a static checker warningDan Carpenter1-4/+4 2018-04-03drm/amdgpu: drop compute ring timeout setting for non-sriov only (v2)Evan Quan1-3/+9 2018-04-03drm/amdgpu: fix typo of domain fallbackChunming Zhou1-1/+1 2018-03-29ALSA: hda - Silence PM ops build warningLukas Wunner1-3/+1 2018-03-27drm/i915: Fix hibernation with ACPI S0 target stateImre Deak2-13/+11 2018-03-27drm/i915/execlists: Use a locked clear_bit() for synchronisation with interruptChris Wilson1-13/+8 2018-03-27drm/i915: Specify which engines to reset following semaphore/event lockupsChris Wilson1-2/+2 2018-03-27drm/i915/dp: Write to SET_POWER dpcd to enable MST hub.Dhinakaran Pandiyan1-5/+2 2018-03-25Linux 4.16-rc7v4.16-rc7Linus Torvalds1-1/+1 2018-03-25tty: vt: fix up tabstops properlyLinus Torvalds1-4/+4 2018-03-24Revert "mqueue: switch to on-demand creation of internal mount"Eric W. Biederman1-55/+19 2018-03-23x86/entry/64: Don't use IST entry for #BP stackAndy Lutomirski3-10/+9 2018-03-23drm/amdkfd: Use ordered workqueue to restore processesFelix Kuehling3-6/+32 2018-03-23drm/amdgpu: Fix acquiring VM on large-BAR systemsFelix Kuehling1-2/+1 2018-03-23x86/efi: Free efi_pgd with free_pages()Waiman Long1-1/+1