Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1334266
| From | Jiri Olsa <jolsa@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 23/23] perf script: Display data_src values |
| Date | 2016-02-15 09:40 +0100 |
| Message-ID | <r2mRm-6Rc-59@gated-at.bofh.it> (permalink) |
| References | <r2mRk-6Rc-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Adding support to display data_src values,
for events with data_src data in sample.
Example:
$ perf script
...
rcuos/3 32 [002] ... 68501042 Local RAM hit|SNP None or Hit|TLB L1 or L2 hit|LCK No ...
rcuos/3 32 [002] ... 68100142 L1 hit|SNP None|TLB L1 or L2 hit|LCK No ...
swapper 0 [002] ... 68100242 LFB hit|SNP None|TLB L1 or L2 hit|LCK No ...
swapper 0 [000] ... 68100142 L1 hit|SNP None|TLB L1 or L2 hit|LCK No ...
swapper 0 [000] ... 50100142 L1 hit|SNP None|TLB L2 miss|LCK No ...
rcuos/3 32 [002] ... 68100142 L1 hit|SNP None|TLB L1 or L2 hit|LCK No ...
plugin-containe 16538 [000] ... 6a100142 L1 hit|SNP None|TLB L1 or L2 hit|LCK Yes ...
gkrellm 1736 [000] ... 68100242 LFB hit|SNP None|TLB L1 or L2 hit|LCK No ...
gkrellm 1736 [000] ... 6a100142 L1 hit|SNP None|TLB L1 or L2 hit|LCK Yes ...
^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
data_src value data_src translation
Link: http://lkml.kernel.org/n/tip-48x7lm7d765bzo3oghap376m@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/builtin-script.c | 20 +++++++++++++++++++-
tools/perf/util/mem-events.c | 15 +++++++++++++++
tools/perf/util/mem-events.h | 2 ++
3 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index f4caf4898245..8ff5ff0fe38c 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -23,6 +23,7 @@
#include "util/stat.h"
#include <linux/bitmap.h>
#include "asm/bug.h"
+#include "util/mem-events.h"
static char const *script_name;
static char const *generate_script_lang;
@@ -649,6 +650,23 @@ static int perf_evlist__max_name_len(struct perf_evlist *evlist)
return max;
}
+static size_t data_src__printf(u64 data_src)
+{
+ struct mem_info mi = { .data_src.val = data_src };
+ char decode[100];
+ char out[100];
+ static int maxlen;
+ int len;
+
+ perf_script__meminfo_scnprintf(decode, 100, &mi);
+
+ len = scnprintf(out, 100, "%16" PRIx64 " %s", data_src, decode);
+ if (maxlen < len)
+ maxlen = len;
+
+ return printf("%-*s", maxlen, out);
+}
+
static void process_event(struct perf_script *script, union perf_event *event,
struct perf_sample *sample, struct perf_evsel *evsel,
struct addr_location *al)
@@ -689,7 +707,7 @@ static void process_event(struct perf_script *script, union perf_event *event,
print_sample_addr(event, sample, thread, attr);
if (PRINT_FIELD(DATA_SRC))
- printf("%16" PRIx64, sample->data_src);
+ data_src__printf(sample->data_src);
if (PRINT_FIELD(WEIGHT))
printf("%16" PRIu64, sample->weight);
diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c
index 0da707da127c..31e079a1ab7b 100644
--- a/tools/perf/util/mem-events.c
+++ b/tools/perf/util/mem-events.c
@@ -272,3 +272,18 @@ int perf_mem__lck_scnprintf(char *out, size_t sz, struct mem_info *mem_info)
return l;
}
+
+int perf_script__meminfo_scnprintf(char *out, size_t sz, struct mem_info *mem_info)
+{
+ int i = 0;
+
+ i += perf_mem__lvl_scnprintf(out, sz, mem_info);
+ i += scnprintf(out + i, sz - i, "|SNP ");
+ i += perf_mem__snp_scnprintf(out + i, sz - i, mem_info);
+ i += scnprintf(out + i, sz - i, "|TLB ");
+ i += perf_mem__tlb_scnprintf(out + i, sz - i, mem_info);
+ i += scnprintf(out + i, sz - i, "|LCK ");
+ i += perf_mem__lck_scnprintf(out + i, sz - i, mem_info);
+
+ return i;
+}
diff --git a/tools/perf/util/mem-events.h b/tools/perf/util/mem-events.h
index 759d35da2d6a..0f63d6a1c53a 100644
--- a/tools/perf/util/mem-events.h
+++ b/tools/perf/util/mem-events.h
@@ -50,5 +50,7 @@ int perf_mem__lvl_scnprintf(char *out, size_t sz, struct mem_info *mem_info);
int perf_mem__snp_scnprintf(char *out, size_t sz, struct mem_info *mem_info);
int perf_mem__lck_scnprintf(char *out, size_t sz, struct mem_info *mem_info);
+int perf_script__meminfo_scnprintf(char *bf, size_t size, struct mem_info *mem_info);
+
#endif /* __PERF_MEM_EVENTS_H */
--
2.4.3
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/23] perf tools: Several memory events updates Jiri Olsa <jolsa@kernel.org> - 2016-02-15 09:40 +0100
[PATCH 10/23] perf x86 intel: Add DATALA events into sysfs Jiri Olsa <jolsa@kernel.org> - 2016-02-15 09:40 +0100
[PATCH 11/23] perf mem: Add Intel DATALA memory events Jiri Olsa <jolsa@kernel.org> - 2016-02-15 09:40 +0100
[PATCH 18/23] perf tools: Change perf_mem__lvl_scnprintf to return nb of displayed bytes Jiri Olsa <jolsa@kernel.org> - 2016-02-15 09:40 +0100
[PATCH 13/23] perf tools: Introduce perf_mem__tlb_scnprintf function Jiri Olsa <jolsa@kernel.org> - 2016-02-15 09:40 +0100
[PATCH 09/23] perf mem: Add -u/-k options Jiri Olsa <jolsa@kernel.org> - 2016-02-15 09:40 +0100
[PATCH 03/23] perf tools: Introduce cl_offset function Jiri Olsa <jolsa@kernel.org> - 2016-02-15 09:40 +0100
[PATCH 06/23] perf mem: Check for memory events support Jiri Olsa <jolsa@kernel.org> - 2016-02-15 09:40 +0100
[PATCH 15/23] perf tools: Introduce perf_mem__snp_scnprintf function Jiri Olsa <jolsa@kernel.org> - 2016-02-15 09:40 +0100
[PATCH 01/23] perf record: Add --all-user/--all-kernel options Jiri Olsa <jolsa@kernel.org> - 2016-02-15 09:40 +0100
Re: [PATCH 01/23] perf record: Add --all-user/--all-kernel options Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-16 18:00 +0100
Re: [PATCH 01/23] perf record: Add --all-user/--all-kernel options Andi Kleen <ak@linux.intel.com> - 2016-02-17 04:20 +0100
Re: [PATCH 01/23] perf record: Add --all-user/--all-kernel options Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-17 15:30 +0100
Re: [PATCH 01/23] perf record: Add --all-user/--all-kernel options Andi Kleen <ak@linux.intel.com> - 2016-02-17 16:40 +0100
Re: [PATCH 01/23] perf record: Add --all-user/--all-kernel options Jiri Olsa <jolsa@redhat.com> - 2016-02-17 15:40 +0100
Re: [PATCH 01/23] perf record: Add --all-user/--all-kernel options Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-02-17 16:00 +0100
[tip:perf/core] perf record: Add --all-user/--all-kernel options tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-02-20 12:40 +0100
[PATCH 17/23] perf tools: Change perf_mem__tlb_scnprintf to return nb of displayed bytes Jiri Olsa <jolsa@kernel.org> - 2016-02-15 09:40 +0100
[PATCH 23/23] perf script: Display data_src values Jiri Olsa <jolsa@kernel.org> - 2016-02-15 09:40 +0100
[PATCH 05/23] perf mem: Add -e record option Jiri Olsa <jolsa@kernel.org> - 2016-02-15 09:40 +0100
[PATCH 14/23] perf tools: Introduce perf_mem__lvl_scnprintf function Jiri Olsa <jolsa@kernel.org> - 2016-02-15 09:40 +0100
[PATCH 21/23] perf script: Add data_src and weight column definitions Jiri Olsa <jolsa@kernel.org> - 2016-02-15 09:40 +0100
[PATCH 07/23] perf mem: Introduce perf_mem_events__name function Jiri Olsa <jolsa@kernel.org> - 2016-02-15 09:50 +0100
[PATCH 04/23] perf tools: Add monitored events array Jiri Olsa <jolsa@kernel.org> - 2016-02-15 09:50 +0100
[PATCH 02/23] perf tools: Make cl_address global Jiri Olsa <jolsa@kernel.org> - 2016-02-15 09:50 +0100
csiph-web