mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-22 22:51:37 +00:00
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>
This commit is contained in:
parent
dd8bd53ab8
commit
41013f0c09
4 changed files with 119 additions and 0 deletions
19
tools/perf/scripts/python/bin/mem-phys-addr-record
Normal file
19
tools/perf/scripts/python/bin/mem-phys-addr-record
Normal file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Profiling physical memory by all retired load instructions/uops event
|
||||
# MEM_INST_RETIRED.ALL_LOADS or MEM_UOPS_RETIRED.ALL_LOADS
|
||||
#
|
||||
|
||||
load=`perf list | grep mem_inst_retired.all_loads`
|
||||
if [ -z "$load" ]; then
|
||||
load=`perf list | grep mem_uops_retired.all_loads`
|
||||
fi
|
||||
if [ -z "$load" ]; then
|
||||
echo "There is no event to count all retired load instructions/uops."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
arg=$(echo $load | tr -d ' ')
|
||||
arg="$arg:P"
|
||||
perf record --phys-data -e $arg $@
|
3
tools/perf/scripts/python/bin/mem-phys-addr-report
Normal file
3
tools/perf/scripts/python/bin/mem-phys-addr-report
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
# description: resolve physical address samples
|
||||
perf script $@ -s "$PERF_EXEC_PATH"/scripts/python/mem-phys-addr.py
|
Loading…
Add table
Add a link
Reference in a new issue