aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/scripting-engines/trace-event-python.c
diff options
context:
space:
mode:
authorKan Liang <Kan.liang@intel.com>2018-01-04 15:59:55 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2018-01-12 09:06:57 -0500
commit41013f0c095980775e0746272873891ca7c28fb1 (patch)
treeb9bf612e5b54740e7ac40d5beeb088c8e7c26f1e /tools/perf/util/scripting-engines/trace-event-python.c
parentdd8bd53ab86133327412e74bf5ba31a8ec2826d4 (diff)
perf script python: Add script to profile and resolve physical mem type
There could be different types of memory in the system. E.g normal System Memory, Persistent Memory. To understand how the workload maps to those memories, it's important to know the I/O statistics of them. Perf can collect physical addresses, but those are raw data. It still needs extra work to resolve the physical addresses. Provide a script to facilitate the physical addresses resolving and I/O statistics. Profile with MEM_INST_RETIRED.ALL_LOADS or MEM_UOPS_RETIRED.ALL_LOADS event if any of them is available. Look up the /proc/iomem and resolve the physical address. Provide memory type summary. Here is an example output: # perf script report mem-phys-addr Event: mem_inst_retired.all_loads:P Memory type count percentage ---------------------------------------- ----------- ----------- System RAM 74 53.2% Persistent Memory 55 39.6% N/A --- Changes since V2: - Apply the new license rules. - Add comments for globals Changes since V1: - Do not mix DLA and Load Latency. Do not compare the loads and stores. Only profile the loads. - Use event name to replace the RAW event Signed-off-by: Kan Liang <Kan.liang@intel.com> Reviewed-by: Andi Kleen <ak@linux.intel.com> Cc: Dan Williams <dan.j.williams@intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Philippe Ombredanne <pombredanne@nexb.com> Cc: Stephane Eranian <eranian@google.com> Link: https://lkml.kernel.org/r/1515099595-34770-1-git-send-email-kan.liang@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/scripting-engines/trace-event-python.c')
-rw-r--r--tools/perf/util/scripting-engines/trace-event-python.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
index c1848b543f27..ea070883c593 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -499,6 +499,8 @@ static PyObject *get_perf_sample_dict(struct perf_sample *sample,
499 PyLong_FromUnsignedLongLong(sample->time)); 499 PyLong_FromUnsignedLongLong(sample->time));
500 pydict_set_item_string_decref(dict_sample, "period", 500 pydict_set_item_string_decref(dict_sample, "period",
501 PyLong_FromUnsignedLongLong(sample->period)); 501 PyLong_FromUnsignedLongLong(sample->period));
502 pydict_set_item_string_decref(dict_sample, "phys_addr",
503 PyLong_FromUnsignedLongLong(sample->phys_addr));
502 set_sample_read_in_dict(dict_sample, sample, evsel); 504 set_sample_read_in_dict(dict_sample, sample, evsel);
503 pydict_set_item_string_decref(dict, "sample", dict_sample); 505 pydict_set_item_string_decref(dict, "sample", dict_sample);
504 506