* [PATCH 0/9] perf tools: Various fixes
@ 2015-10-05 18:06 Jiri Olsa
2015-10-05 18:06 ` [PATCH 1/9] tools lib api fs: Do not use PATH_MAX + 1 Jiri Olsa
` (8 more replies)
0 siblings, 9 replies; 24+ messages in thread
From: Jiri Olsa @ 2015-10-05 18:06 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra,
Liang, Kan, Don Zickus
hi,
sending various fixes that piled up plus some
I'll need in future patchsets.
thanks,
jirka
---
Don Zickus (1):
perf tools: Add support for sorting on the iaddr
Jiri Olsa (8):
tools lib api fs: Do not use PATH_MAX + 1
perf evlist: Display DATA_SRC sample type bit
perf annotate: Fix sizeof_sym_hist overflow issue
perf tools: Make perf_event_attr__set_max_precise_ip global
perf tools: Introduce 'P' modifier
perf tests: Add parsing test for 'P' modifier
perf tools: Setup proper width for symbol_iaddr field
perf tools: Handle -h and -v options
tools/lib/api/fs/fs.c | 2 +-
tools/lib/api/fs/tracing_path.c | 6 +++---
tools/perf/Documentation/perf-list.txt | 1 +
tools/perf/Documentation/perf.txt | 8 ++++++++
tools/perf/perf.c | 14 ++++++++++++++
tools/perf/tests/parse-events.c | 16 ++++++++++++++++
tools/perf/util/annotate.h | 2 +-
tools/perf/util/evlist.c | 2 +-
tools/perf/util/evlist.h | 2 ++
tools/perf/util/evsel.c | 5 ++++-
tools/perf/util/evsel.h | 1 +
tools/perf/util/hist.c | 13 +++++++++++++
tools/perf/util/hist.h | 1 +
tools/perf/util/parse-events.c | 8 +++++++-
tools/perf/util/parse-events.l | 2 +-
tools/perf/util/sort.c | 37 +++++++++++++++++++++++++++++++++++++
tools/perf/util/sort.h | 1 +
17 files changed, 112 insertions(+), 9 deletions(-)
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 1/9] tools lib api fs: Do not use PATH_MAX + 1
2015-10-05 18:06 [PATCH 0/9] perf tools: Various fixes Jiri Olsa
@ 2015-10-05 18:06 ` Jiri Olsa
2015-10-06 7:12 ` [tip:perf/core] tools lib api fs: No need to " tip-bot for Jiri Olsa
2015-10-05 18:06 ` [PATCH 2/9] perf evlist: Display DATA_SRC sample type bit Jiri Olsa
` (7 subsequent siblings)
8 siblings, 1 reply; 24+ messages in thread
From: Jiri Olsa @ 2015-10-05 18:06 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra,
Liang, Kan, Don Zickus
Because there's no point, PATH_MAX is big enough.
Link: http://lkml.kernel.org/n/tip-buqiaesupmk2rusc6y2prtp9@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/lib/api/fs/fs.c | 2 +-
tools/lib/api/fs/tracing_path.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index 732dbef588b0..459599d1b6c4 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -69,7 +69,7 @@ static const char * const tracefs__known_mountpoints[] = {
struct fs {
const char *name;
const char * const *mounts;
- char path[PATH_MAX + 1];
+ char path[PATH_MAX];
bool found;
long magic;
};
diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c
index 0406a7d5c891..a26bb5ea8283 100644
--- a/tools/lib/api/fs/tracing_path.c
+++ b/tools/lib/api/fs/tracing_path.c
@@ -12,9 +12,9 @@
#include "tracing_path.h"
-char tracing_mnt[PATH_MAX + 1] = "/sys/kernel/debug";
-char tracing_path[PATH_MAX + 1] = "/sys/kernel/debug/tracing";
-char tracing_events_path[PATH_MAX + 1] = "/sys/kernel/debug/tracing/events";
+char tracing_mnt[PATH_MAX] = "/sys/kernel/debug";
+char tracing_path[PATH_MAX] = "/sys/kernel/debug/tracing";
+char tracing_events_path[PATH_MAX] = "/sys/kernel/debug/tracing/events";
static void __tracing_path_set(const char *tracing, const char *mountpoint)
--
2.4.3
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 2/9] perf evlist: Display DATA_SRC sample type bit
2015-10-05 18:06 [PATCH 0/9] perf tools: Various fixes Jiri Olsa
2015-10-05 18:06 ` [PATCH 1/9] tools lib api fs: Do not use PATH_MAX + 1 Jiri Olsa
@ 2015-10-05 18:06 ` Jiri Olsa
2015-10-06 7:13 ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-10-05 18:06 ` [PATCH 3/9] perf annotate: Fix sizeof_sym_hist overflow issue Jiri Olsa
` (6 subsequent siblings)
8 siblings, 1 reply; 24+ messages in thread
From: Jiri Olsa @ 2015-10-05 18:06 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra,
Liang, Kan, Don Zickus
Adding DATA_SRC bit_name call to display sample_type properly.
$ perf evlist -v
cpu/mem-loads/pp: ...SNIP... sample_type: IP|TID|TIME|ADDR|CPU|PERIOD|DATA_SRC, ...
Link: http://lkml.kernel.org/n/tip-2ylb25ew433nju1nyb21hwnc@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/util/evsel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 58890044d835..0b1c289da36d 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1178,7 +1178,7 @@ static void __p_sample_type(char *buf, size_t size, u64 value)
bit_name(READ), bit_name(CALLCHAIN), bit_name(ID), bit_name(CPU),
bit_name(PERIOD), bit_name(STREAM_ID), bit_name(RAW),
bit_name(BRANCH_STACK), bit_name(REGS_USER), bit_name(STACK_USER),
- bit_name(IDENTIFIER), bit_name(REGS_INTR),
+ bit_name(IDENTIFIER), bit_name(REGS_INTR), bit_name(DATA_SRC),
{ .name = NULL, }
};
#undef bit_name
--
2.4.3
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 3/9] perf annotate: Fix sizeof_sym_hist overflow issue
2015-10-05 18:06 [PATCH 0/9] perf tools: Various fixes Jiri Olsa
2015-10-05 18:06 ` [PATCH 1/9] tools lib api fs: Do not use PATH_MAX + 1 Jiri Olsa
2015-10-05 18:06 ` [PATCH 2/9] perf evlist: Display DATA_SRC sample type bit Jiri Olsa
@ 2015-10-05 18:06 ` Jiri Olsa
2015-10-06 7:13 ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-10-05 18:06 ` [PATCH 4/9] perf tools: Make perf_event_attr__set_max_precise_ip global Jiri Olsa
` (5 subsequent siblings)
8 siblings, 1 reply; 24+ messages in thread
From: Jiri Olsa @ 2015-10-05 18:06 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra,
Liang, Kan, Don Zickus
The annotated_source::sizeof_sym_hist could easily overflow
int size, resulting in crash in __symbol__inc_addr_samples.
Changing its type int size_t as was probably intended from
beginning based on initialization code in symbol__alloc_hist.
Link: http://lkml.kernel.org/n/tip-tf6ciz2mziuijvm25034qzcv@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/util/annotate.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index e9996092a093..cea323d9ee7e 100644
--- a/tools/perf/util/annotate.h
+++ b/tools/perf/util/annotate.h
@@ -122,7 +122,7 @@ struct annotated_source {
struct list_head source;
struct source_line *lines;
int nr_histograms;
- int sizeof_sym_hist;
+ size_t sizeof_sym_hist;
struct cyc_hist *cycles_hist;
struct sym_hist histograms[0];
};
--
2.4.3
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 4/9] perf tools: Make perf_event_attr__set_max_precise_ip global
2015-10-05 18:06 [PATCH 0/9] perf tools: Various fixes Jiri Olsa
` (2 preceding siblings ...)
2015-10-05 18:06 ` [PATCH 3/9] perf annotate: Fix sizeof_sym_hist overflow issue Jiri Olsa
@ 2015-10-05 18:06 ` Jiri Olsa
2015-10-06 7:13 ` [tip:perf/core] perf tools: Export perf_event_attr__set_max_precise_ip() tip-bot for Jiri Olsa
2015-10-05 18:06 ` [PATCH 5/9] perf tools: Introduce 'P' modifier Jiri Olsa
` (4 subsequent siblings)
8 siblings, 1 reply; 24+ messages in thread
From: Jiri Olsa @ 2015-10-05 18:06 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra,
Liang, Kan, Don Zickus
It'll be used in following patch.
Link: http://lkml.kernel.org/n/tip-uxho3feqzulx8uyecvfxkjj1@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/util/evlist.c | 2 +-
tools/perf/util/evlist.h | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index e7e195d867ea..d1392194a9a9 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -205,7 +205,7 @@ void perf_evlist__set_leader(struct perf_evlist *evlist)
}
}
-static void perf_event_attr__set_max_precise_ip(struct perf_event_attr *attr)
+void perf_event_attr__set_max_precise_ip(struct perf_event_attr *attr)
{
attr->precise_ip = 3;
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index 66bc9d4c0869..a459fe71b452 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -290,4 +290,6 @@ void perf_evlist__to_front(struct perf_evlist *evlist,
void perf_evlist__set_tracking_event(struct perf_evlist *evlist,
struct perf_evsel *tracking_evsel);
+
+void perf_event_attr__set_max_precise_ip(struct perf_event_attr *attr);
#endif /* __PERF_EVLIST_H */
--
2.4.3
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 5/9] perf tools: Introduce 'P' modifier
2015-10-05 18:06 [PATCH 0/9] perf tools: Various fixes Jiri Olsa
` (3 preceding siblings ...)
2015-10-05 18:06 ` [PATCH 4/9] perf tools: Make perf_event_attr__set_max_precise_ip global Jiri Olsa
@ 2015-10-05 18:06 ` Jiri Olsa
2015-10-05 18:13 ` David Ahern
` (2 more replies)
2015-10-05 18:06 ` [PATCH 6/9] perf tests: Add parsing test for 'P' modifier Jiri Olsa
` (3 subsequent siblings)
8 siblings, 3 replies; 24+ messages in thread
From: Jiri Olsa @ 2015-10-05 18:06 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra,
Liang, Kan, Don Zickus
The 'P' will cause the event to get maximum possible
detected precise level.
Following record:
$ perf record -e cycles:P ...
will detect maximum precise level for 'cycles' event
and use it.
Link: http://lkml.kernel.org/n/tip-e33mfvu5mhuowie0l11fwllz@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/Documentation/perf-list.txt | 1 +
tools/perf/util/evsel.c | 3 +++
tools/perf/util/evsel.h | 1 +
tools/perf/util/parse-events.c | 8 +++++++-
tools/perf/util/parse-events.l | 2 +-
5 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/tools/perf/Documentation/perf-list.txt b/tools/perf/Documentation/perf-list.txt
index ad60c6ea1997..79483f40e991 100644
--- a/tools/perf/Documentation/perf-list.txt
+++ b/tools/perf/Documentation/perf-list.txt
@@ -30,6 +30,7 @@ counted. The following modifiers exist:
G - guest counting (in KVM guests)
H - host counting (not in KVM guests)
p - precise level
+ P - use maximum detected precise level
S - read sample value (PERF_SAMPLE_READ)
D - pin the event to the PMU
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 0b1c289da36d..8be867ccefe9 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -882,6 +882,9 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts)
attr->clockid = opts->clockid;
}
+ if (evsel->precise_max)
+ perf_event_attr__set_max_precise_ip(attr);
+
/*
* Apply event specific term settings,
* it overloads any global configuration.
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 7906666580da..02a5fed8d924 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -111,6 +111,7 @@ struct perf_evsel {
bool system_wide;
bool tracking;
bool per_pkg;
+ bool precise_max;
/* parse modifier helper */
int exclude_GH;
int nr_members;
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 5d0cfce2599b..3ed8bf175163 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -923,6 +923,7 @@ struct event_modifier {
int eG;
int eI;
int precise;
+ int precise_max;
int exclude_GH;
int sample_read;
int pinned;
@@ -938,6 +939,7 @@ static int get_event_modifier(struct event_modifier *mod, char *str,
int eG = evsel ? evsel->attr.exclude_guest : 0;
int eI = evsel ? evsel->attr.exclude_idle : 0;
int precise = evsel ? evsel->attr.precise_ip : 0;
+ int precise_max = 0;
int sample_read = 0;
int pinned = evsel ? evsel->attr.pinned : 0;
@@ -974,6 +976,8 @@ static int get_event_modifier(struct event_modifier *mod, char *str,
/* use of precise requires exclude_guest */
if (!exclude_GH)
eG = 1;
+ } else if (*str == 'P') {
+ precise_max = 1;
} else if (*str == 'S') {
sample_read = 1;
} else if (*str == 'D') {
@@ -1004,6 +1008,7 @@ static int get_event_modifier(struct event_modifier *mod, char *str,
mod->eG = eG;
mod->eI = eI;
mod->precise = precise;
+ mod->precise_max = precise_max;
mod->exclude_GH = exclude_GH;
mod->sample_read = sample_read;
mod->pinned = pinned;
@@ -1020,7 +1025,7 @@ static int check_modifier(char *str)
char *p = str;
/* The sizeof includes 0 byte as well. */
- if (strlen(str) > (sizeof("ukhGHpppSDI") - 1))
+ if (strlen(str) > (sizeof("ukhGHpppPSDI") - 1))
return -1;
while (*p) {
@@ -1059,6 +1064,7 @@ int parse_events__modifier_event(struct list_head *list, char *str, bool add)
evsel->attr.exclude_idle = mod.eI;
evsel->exclude_GH = mod.exclude_GH;
evsel->sample_read = mod.sample_read;
+ evsel->precise_max = mod.precise_max;
if (perf_evsel__is_group_leader(evsel))
evsel->attr.pinned = mod.pinned;
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
index c29832bce496..be244573a02e 100644
--- a/tools/perf/util/parse-events.l
+++ b/tools/perf/util/parse-events.l
@@ -122,7 +122,7 @@ num_raw_hex [a-fA-F0-9]+
name [a-zA-Z_*?][a-zA-Z0-9_*?.]*
name_minus [a-zA-Z_*?][a-zA-Z0-9\-_*?.]*
/* If you add a modifier you need to update check_modifier() */
-modifier_event [ukhpGHSDI]+
+modifier_event [ukhpPGHSDI]+
modifier_bp [rwx]{1,3}
%%
--
2.4.3
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 6/9] perf tests: Add parsing test for 'P' modifier
2015-10-05 18:06 [PATCH 0/9] perf tools: Various fixes Jiri Olsa
` (4 preceding siblings ...)
2015-10-05 18:06 ` [PATCH 5/9] perf tools: Introduce 'P' modifier Jiri Olsa
@ 2015-10-05 18:06 ` Jiri Olsa
2015-10-06 7:14 ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-10-05 18:06 ` [PATCH 7/9] perf tools: Add support for sorting on the iaddr Jiri Olsa
` (2 subsequent siblings)
8 siblings, 1 reply; 24+ messages in thread
From: Jiri Olsa @ 2015-10-05 18:06 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra,
Liang, Kan, Don Zickus
We cant test 'P' modifier gets properly parsed, the functionality
test itself is beyond this suite.
Link: http://lkml.kernel.org/n/tip-pa4pmc6mnakmyss5ca2c9yo5@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/tests/parse-events.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 3a2ebe666192..0648b84a9171 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -1259,6 +1259,17 @@ test__checkevent_breakpoint_len_rw_modifier(struct perf_evlist *evlist)
return test__checkevent_breakpoint_rw(evlist);
}
+static int test__checkevent_precise_max_modifier(struct perf_evlist *evlist)
+{
+ struct perf_evsel *evsel = perf_evlist__first(evlist);
+
+ TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->attr.type);
+ TEST_ASSERT_VAL("wrong config",
+ PERF_COUNT_SW_TASK_CLOCK == evsel->attr.config);
+ return 0;
+}
+
static int count_tracepoints(void)
{
struct dirent *events_ent;
@@ -1562,6 +1573,11 @@ static struct evlist_test test__events[] = {
.check = test__checkevent_exclude_idle_modifier_1,
.id = 46,
},
+ {
+ .name = "task-clock:P,cycles",
+ .check = test__checkevent_precise_max_modifier,
+ .id = 47,
+ },
};
static struct evlist_test test__events_pmu[] = {
--
2.4.3
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 7/9] perf tools: Add support for sorting on the iaddr
2015-10-05 18:06 [PATCH 0/9] perf tools: Various fixes Jiri Olsa
` (5 preceding siblings ...)
2015-10-05 18:06 ` [PATCH 6/9] perf tests: Add parsing test for 'P' modifier Jiri Olsa
@ 2015-10-05 18:06 ` Jiri Olsa
2015-10-06 7:14 ` [tip:perf/core] " tip-bot for Don Zickus
2015-10-05 18:06 ` [PATCH 8/9] perf tools: Setup proper width for symbol_iaddr field Jiri Olsa
2015-10-05 18:06 ` [PATCH 9/9] perf tools: Handle -h and -v options Jiri Olsa
8 siblings, 1 reply; 24+ messages in thread
From: Jiri Olsa @ 2015-10-05 18:06 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra,
Liang, Kan, Don Zickus
From: Don Zickus <dzickus@redhat.com>
Sorting on 'symbol' gives to broad a resolution as it can cover a
range of IP address. Use the iaddr instead to get proper sorting on
IP addresses. Need to use the 'mem_sort' feature of perf record.
New sort option is: symbol_iaddr, header label is 'Code Symbol'.
$ perf mem report --stdio -F +symbol_iaddr
# Overhead Samples Code Symbol Local Weight
# ........ ............ ........................ ............
#
54.08% 1 [k] nmi_handle 192
4.51% 1 [k] finish_task_switch 16
3.66% 1 [.] malloc 13
3.10% 1 [.] __strcoll_l 11
Signed-off-by: Don Zickus <dzickus@redhat.com>
Link: http://lkml.kernel.org/n/tip-94rmgtp0lvpkc7xmb9bmrjxm@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/util/hist.h | 1 +
tools/perf/util/sort.c | 37 +++++++++++++++++++++++++++++++++++++
tools/perf/util/sort.h | 1 +
3 files changed, 39 insertions(+)
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 8c20a8f6b214..a48a2078d288 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -49,6 +49,7 @@ enum hist_column {
HISTC_MEM_LVL,
HISTC_MEM_SNOOP,
HISTC_MEM_DCACHELINE,
+ HISTC_MEM_IADDR_SYMBOL,
HISTC_TRANSACTION,
HISTC_CYCLES,
HISTC_NR_COLS, /* Last entry */
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 6b9556d298c9..ee94b728fca4 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -655,6 +655,35 @@ static int hist_entry__daddr_snprintf(struct hist_entry *he, char *bf,
}
static int64_t
+sort__iaddr_cmp(struct hist_entry *left, struct hist_entry *right)
+{
+ uint64_t l = 0, r = 0;
+
+ if (left->mem_info)
+ l = left->mem_info->iaddr.addr;
+ if (right->mem_info)
+ r = right->mem_info->iaddr.addr;
+
+ return (int64_t)(r - l);
+}
+
+static int hist_entry__iaddr_snprintf(struct hist_entry *he, char *bf,
+ size_t size, unsigned int width)
+{
+ uint64_t addr = 0;
+ struct map *map = NULL;
+ struct symbol *sym = NULL;
+
+ if (he->mem_info) {
+ addr = he->mem_info->iaddr.addr;
+ map = he->mem_info->iaddr.map;
+ sym = he->mem_info->iaddr.sym;
+ }
+ return _hist_entry__sym_snprintf(map, sym, addr, he->level, bf, size,
+ width);
+}
+
+static int64_t
sort__dso_daddr_cmp(struct hist_entry *left, struct hist_entry *right)
{
struct map *map_l = NULL;
@@ -1077,6 +1106,13 @@ struct sort_entry sort_mem_daddr_sym = {
.se_width_idx = HISTC_MEM_DADDR_SYMBOL,
};
+struct sort_entry sort_mem_iaddr_sym = {
+ .se_header = "Code Symbol",
+ .se_cmp = sort__iaddr_cmp,
+ .se_snprintf = hist_entry__iaddr_snprintf,
+ .se_width_idx = HISTC_MEM_IADDR_SYMBOL,
+};
+
struct sort_entry sort_mem_daddr_dso = {
.se_header = "Data Object",
.se_cmp = sort__dso_daddr_cmp,
@@ -1299,6 +1335,7 @@ static struct sort_dimension bstack_sort_dimensions[] = {
static struct sort_dimension memory_sort_dimensions[] = {
DIM(SORT_MEM_DADDR_SYMBOL, "symbol_daddr", sort_mem_daddr_sym),
+ DIM(SORT_MEM_IADDR_SYMBOL, "symbol_iaddr", sort_mem_iaddr_sym),
DIM(SORT_MEM_DADDR_DSO, "dso_daddr", sort_mem_daddr_dso),
DIM(SORT_MEM_LOCKED, "locked", sort_mem_locked),
DIM(SORT_MEM_TLB, "tlb", sort_mem_tlb),
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index c06b75746613..33b3d30e18d3 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -201,6 +201,7 @@ enum sort_type {
SORT_MEM_LVL,
SORT_MEM_SNOOP,
SORT_MEM_DCACHELINE,
+ SORT_MEM_IADDR_SYMBOL,
};
/*
--
2.4.3
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 8/9] perf tools: Setup proper width for symbol_iaddr field
2015-10-05 18:06 [PATCH 0/9] perf tools: Various fixes Jiri Olsa
` (6 preceding siblings ...)
2015-10-05 18:06 ` [PATCH 7/9] perf tools: Add support for sorting on the iaddr Jiri Olsa
@ 2015-10-05 18:06 ` Jiri Olsa
2015-10-06 7:15 ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-10-05 18:06 ` [PATCH 9/9] perf tools: Handle -h and -v options Jiri Olsa
8 siblings, 1 reply; 24+ messages in thread
From: Jiri Olsa @ 2015-10-05 18:06 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra,
Liang, Kan, Don Zickus
We need to properly initialize column width for symbol_iaddr
field, so all symbols could fit in the column.
Link: http://lkml.kernel.org/n/tip-hxo2kaxr49stt5ebukntrs3v@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/util/hist.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index c346b331b892..4fd37d6708cb 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -132,6 +132,18 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h)
hists__new_col_len(hists, HISTC_MEM_DADDR_SYMBOL,
symlen);
}
+
+ if (h->mem_info->iaddr.sym) {
+ symlen = (int)h->mem_info->iaddr.sym->namelen + 4
+ + unresolved_col_width + 2;
+ hists__new_col_len(hists, HISTC_MEM_IADDR_SYMBOL,
+ symlen);
+ } else {
+ symlen = unresolved_col_width + 4 + 2;
+ hists__new_col_len(hists, HISTC_MEM_IADDR_SYMBOL,
+ symlen);
+ }
+
if (h->mem_info->daddr.map) {
symlen = dso__name_len(h->mem_info->daddr.map->dso);
hists__new_col_len(hists, HISTC_MEM_DADDR_DSO,
@@ -143,6 +155,7 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h)
} else {
symlen = unresolved_col_width + 4 + 2;
hists__new_col_len(hists, HISTC_MEM_DADDR_SYMBOL, symlen);
+ hists__new_col_len(hists, HISTC_MEM_IADDR_SYMBOL, symlen);
hists__set_unres_dso_col_len(hists, HISTC_MEM_DADDR_DSO);
}
--
2.4.3
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 9/9] perf tools: Handle -h and -v options
2015-10-05 18:06 [PATCH 0/9] perf tools: Various fixes Jiri Olsa
` (7 preceding siblings ...)
2015-10-05 18:06 ` [PATCH 8/9] perf tools: Setup proper width for symbol_iaddr field Jiri Olsa
@ 2015-10-05 18:06 ` Jiri Olsa
2015-10-06 7:15 ` [tip:perf/core] " tip-bot for Jiri Olsa
8 siblings, 1 reply; 24+ messages in thread
From: Jiri Olsa @ 2015-10-05 18:06 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra,
Liang, Kan, Don Zickus
Adding handling for '-h' and '-v' options to invoke
help and version command respectively.
Current behaviour is:
$ perf -v
Unknown option: -v
Usage: perf [--version] [--help] [OPTIONS] COMMAND [ARGS]
$ perf -h
Unknown option: -h
Usage: perf [--version] [--help] [OPTIONS] COMMAND [ARGS]
New behaviour:
$ perf -h
usage: perf [--version] [--help] [OPTIONS] COMMAND [ARGS]
The most commonly used perf commands are:
annotate Read perf.data (created by perf record) and display annotated code
archive Create archive with object files with build-ids found in perf.data file
bench General framework for benchmark suites
...
$ perf -v
perf version 4.3.rc3.gc99e32
Updated man page.
Requested-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/n/tip-u1hue2aw89yif5xaqbsmthlv@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/Documentation/perf.txt | 8 ++++++++
tools/perf/perf.c | 14 ++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/tools/perf/Documentation/perf.txt b/tools/perf/Documentation/perf.txt
index 2b131776363e..864e37597252 100644
--- a/tools/perf/Documentation/perf.txt
+++ b/tools/perf/Documentation/perf.txt
@@ -27,6 +27,14 @@ OPTIONS
Setup buildid cache directory. It has higher priority than
buildid.dir config file option.
+-v::
+--version::
+ Display perf version.
+
+-h::
+--help::
+ Run perf help command.
+
DESCRIPTION
-----------
Performance counters for Linux are a new kernel-based subsystem
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 1fded922bcc8..543713422d14 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -162,6 +162,20 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
break;
/*
+ * Shortcut for '-h' and '-v' options to invoke help
+ * and version command.
+ */
+ if (!strcmp(cmd, "-h")) {
+ (*argv)[0] = "--help";
+ break;
+ }
+
+ if (!strcmp(cmd, "-v")) {
+ (*argv)[0] = "--version";
+ break;
+ }
+
+ /*
* Check remaining flags.
*/
if (!prefixcmp(cmd, CMD_EXEC_PATH)) {
--
2.4.3
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH 5/9] perf tools: Introduce 'P' modifier
2015-10-05 18:06 ` [PATCH 5/9] perf tools: Introduce 'P' modifier Jiri Olsa
@ 2015-10-05 18:13 ` David Ahern
2015-10-05 18:38 ` Jiri Olsa
2015-10-05 19:20 ` Arnaldo Carvalho de Melo
2015-10-06 7:14 ` [tip:perf/core] perf tools: Introduce 'P' modifier to request max precision tip-bot for Jiri Olsa
2 siblings, 1 reply; 24+ messages in thread
From: David Ahern @ 2015-10-05 18:13 UTC (permalink / raw)
To: Jiri Olsa, Arnaldo Carvalho de Melo
Cc: lkml, Ingo Molnar, Namhyung Kim, Peter Zijlstra, Liang, Kan, Don Zickus
On 10/5/15 12:06 PM, Jiri Olsa wrote:
> The 'P' will cause the event to get maximum possible
> detected precise level.
>
> Following record:
> $ perf record -e cycles:P ...
>
> will detect maximum precise level for 'cycles' event
> and use it.
>
Does the end result (which precise level is used) get saved to the
header and displayed to the user properly?
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 5/9] perf tools: Introduce 'P' modifier
2015-10-05 18:13 ` David Ahern
@ 2015-10-05 18:38 ` Jiri Olsa
2015-10-05 19:08 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 24+ messages in thread
From: Jiri Olsa @ 2015-10-05 18:38 UTC (permalink / raw)
To: David Ahern
Cc: Jiri Olsa, Arnaldo Carvalho de Melo, lkml, Ingo Molnar,
Namhyung Kim, Peter Zijlstra, Liang, Kan, Don Zickus
On Mon, Oct 05, 2015 at 12:13:48PM -0600, David Ahern wrote:
> On 10/5/15 12:06 PM, Jiri Olsa wrote:
> >The 'P' will cause the event to get maximum possible
> >detected precise level.
> >
> >Following record:
> > $ perf record -e cycles:P ...
> >
> >will detect maximum precise level for 'cycles' event
> >and use it.
> >
>
> Does the end result (which precise level is used) get saved to the header
> and displayed to the user properly?
yep..
[jolsa@krava perf]$ ./perf record -e cycles:P ls
...
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.014 MB perf.data (8 samples) ]
[jolsa@krava perf]$ ./perf evlist
cycles:P
[jolsa@krava perf]$ ./perf evlist -v
cycles:P: size: 112, ... precise_ip: 2 ...
[jolsa@krava perf]$ ./perf report --stdio
# To display the perf.data header info, please use --header/--header-only options.
#
#
# Total Lost Samples: 0
#
# Samples: 8 of event 'cycles:P'
# Event count (approx.): 4270406
#
# Overhead Command Shared Object Symbol
...
jirka
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 5/9] perf tools: Introduce 'P' modifier
2015-10-05 18:38 ` Jiri Olsa
@ 2015-10-05 19:08 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 24+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-05 19:08 UTC (permalink / raw)
To: Jiri Olsa
Cc: David Ahern, Jiri Olsa, lkml, Ingo Molnar, Namhyung Kim,
Peter Zijlstra, Liang, Kan, Don Zickus
Em Mon, Oct 05, 2015 at 08:38:06PM +0200, Jiri Olsa escreveu:
> On Mon, Oct 05, 2015 at 12:13:48PM -0600, David Ahern wrote:
> > On 10/5/15 12:06 PM, Jiri Olsa wrote:
> > >The 'P' will cause the event to get maximum possible detected precise
> > >level.
> > >Following record:
> > > $ perf record -e cycles:P ...
> > >will detect maximum precise level for 'cycles' event
> > >and use it.
> > Does the end result (which precise level is used) get saved to the header
> > and displayed to the user properly?
> yep..
> [jolsa@krava perf]$ ./perf record -e cycles:P ls
> [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.014 MB perf.data (8 samples) ]
> [jolsa@krava perf]$ ./perf evlist
> cycles:P
> [jolsa@krava perf]$ ./perf evlist -v
> cycles:P: size: 112, ... precise_ip: 2 ...
[root@zoo ~]# perf record usleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.016 MB perf.data (12 samples) ]
[root@zoo ~]# perf evlist
cycles:pp
[root@zoo ~]# perf evlist -v
cycles:pp: size: 112, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|PERIOD, disabled: 1, inherit: 1, mmap: 1, comm: 1, freq: 1, enable_on_exec: 1, task: 1, precise_ip: 2, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1
[root@zoo ~]#
- Arnaldo
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 5/9] perf tools: Introduce 'P' modifier
2015-10-05 18:06 ` [PATCH 5/9] perf tools: Introduce 'P' modifier Jiri Olsa
2015-10-05 18:13 ` David Ahern
@ 2015-10-05 19:20 ` Arnaldo Carvalho de Melo
2015-10-06 7:01 ` Jiri Olsa
2015-10-06 7:14 ` [tip:perf/core] perf tools: Introduce 'P' modifier to request max precision tip-bot for Jiri Olsa
2 siblings, 1 reply; 24+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-10-05 19:20 UTC (permalink / raw)
To: Jiri Olsa
Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra,
Liang, Kan, Don Zickus
Em Mon, Oct 05, 2015 at 08:06:05PM +0200, Jiri Olsa escreveu:
> The 'P' will cause the event to get maximum possible
> detected precise level.
>
> Following record:
> $ perf record -e cycles:P ...
>
> will detect maximum precise level for 'cycles' event
> and use it.
I had to do a 'make -C tools/perf clean' to get this to work, i.e. it is
not noticing that the parser files were changed and thus need to run
again, can you please take a look?
Thanks,
- Arnaldo
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 5/9] perf tools: Introduce 'P' modifier
2015-10-05 19:20 ` Arnaldo Carvalho de Melo
@ 2015-10-06 7:01 ` Jiri Olsa
0 siblings, 0 replies; 24+ messages in thread
From: Jiri Olsa @ 2015-10-06 7:01 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Jiri Olsa, lkml, David Ahern, Ingo Molnar, Namhyung Kim,
Peter Zijlstra, Liang, Kan, Don Zickus
On Mon, Oct 05, 2015 at 04:20:40PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Mon, Oct 05, 2015 at 08:06:05PM +0200, Jiri Olsa escreveu:
> > The 'P' will cause the event to get maximum possible
> > detected precise level.
> >
> > Following record:
> > $ perf record -e cycles:P ...
> >
> > will detect maximum precise level for 'cycles' event
> > and use it.
>
> I had to do a 'make -C tools/perf clean' to get this to work, i.e. it is
> not noticing that the parser files were changed and thus need to run
> again, can you please take a look?
can't see that:
[jolsa@krava perf]$ make
BUILD: Doing 'make -j4' parallel build
CC util/parse-events.o
LD util/libperf-in.o
LD libperf-in.o
AR libperf.a
LINK perf
LINK libperf-gtk.so
[jolsa@krava perf]$ touch util/parse-events.l
[jolsa@krava perf]$ make
BUILD: Doing 'make -j4' parallel build
FLEX util/parse-events-flex.c
CC util/parse-events-flex.o
CC util/parse-events.o
LD util/libperf-in.o
LD libperf-in.o
AR libperf.a
LINK perf
LINK libperf-gtk.so
[jolsa@krava perf]$ touch util/parse-events.y
[jolsa@krava perf]$ make
BUILD: Doing 'make -j4' parallel build
BISON util/parse-events-bison.c
FLEX util/parse-events-flex.c
CC util/parse-events-bison.o
CC util/parse-events.o
CC util/parse-events-flex.o
LD util/libperf-in.o
LD libperf-in.o
AR libperf.a
LINK perf
LINK libperf-gtk.so
[jolsa@krava linux-perf]$ make -C tools/perf
make: Entering directory '/home/jolsa/kernel/linux-perf/tools/perf'
BUILD: Doing 'make -j4' parallel build
CC util/parse-events.o
LD util/libperf-in.o
LD libperf-in.o
AR libperf.a
LINK perf
LINK libperf-gtk.so
make: Leaving directory '/home/jolsa/kernel/linux-perf/tools/perf'
[jolsa@krava linux-perf]$ make -C tools/perf
make: Entering directory '/home/jolsa/kernel/linux-perf/tools/perf'
BUILD: Doing 'make -j4' parallel build
BISON util/parse-events-bison.c
FLEX util/parse-events-flex.c
CC util/parse-events-bison.o
CC util/parse-events.o
CC util/parse-events-flex.o
LD util/libperf-in.o
LD libperf-in.o
AR libperf.a
LINK perf
LINK libperf-gtk.so
make: Leaving directory '/home/jolsa/kernel/linux-perf/tools/perf'
[jolsa@krava linux-perf]$ make -C tools/perf
make: Entering directory '/home/jolsa/kernel/linux-perf/tools/perf'
BUILD: Doing 'make -j4' parallel build
FLEX util/parse-events-flex.c
CC util/parse-events-flex.o
CC util/parse-events.o
LD util/libperf-in.o
LD libperf-in.o
AR libperf.a
LINK perf
LINK libperf-gtk.so
make: Leaving directory '/home/jolsa/kernel/linux-perf/tools/perf'
jirka
^ permalink raw reply [flat|nested] 24+ messages in thread
* [tip:perf/core] tools lib api fs: No need to use PATH_MAX + 1
2015-10-05 18:06 ` [PATCH 1/9] tools lib api fs: Do not use PATH_MAX + 1 Jiri Olsa
@ 2015-10-06 7:12 ` tip-bot for Jiri Olsa
0 siblings, 0 replies; 24+ messages in thread
From: tip-bot for Jiri Olsa @ 2015-10-06 7:12 UTC (permalink / raw)
To: linux-tip-commits
Cc: kan.liang, namhyung, acme, jolsa, linux-kernel, a.p.zijlstra,
dsahern, tglx, hpa, dzickus, mingo
Commit-ID: ccb5597f9ba11b67b8aa8c6f4682675eceee0e21
Gitweb: http://git.kernel.org/tip/ccb5597f9ba11b67b8aa8c6f4682675eceee0e21
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 5 Oct 2015 20:06:01 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 5 Oct 2015 16:12:09 -0300
tools lib api fs: No need to use PATH_MAX + 1
Because there's no point, PATH_MAX is big enough.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1444068369-20978-2-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/api/fs/fs.c | 2 +-
tools/lib/api/fs/tracing_path.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index 732dbef5..459599d 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -69,7 +69,7 @@ static const char * const tracefs__known_mountpoints[] = {
struct fs {
const char *name;
const char * const *mounts;
- char path[PATH_MAX + 1];
+ char path[PATH_MAX];
bool found;
long magic;
};
diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c
index 0406a7d..a26bb5e 100644
--- a/tools/lib/api/fs/tracing_path.c
+++ b/tools/lib/api/fs/tracing_path.c
@@ -12,9 +12,9 @@
#include "tracing_path.h"
-char tracing_mnt[PATH_MAX + 1] = "/sys/kernel/debug";
-char tracing_path[PATH_MAX + 1] = "/sys/kernel/debug/tracing";
-char tracing_events_path[PATH_MAX + 1] = "/sys/kernel/debug/tracing/events";
+char tracing_mnt[PATH_MAX] = "/sys/kernel/debug";
+char tracing_path[PATH_MAX] = "/sys/kernel/debug/tracing";
+char tracing_events_path[PATH_MAX] = "/sys/kernel/debug/tracing/events";
static void __tracing_path_set(const char *tracing, const char *mountpoint)
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [tip:perf/core] perf evlist: Display DATA_SRC sample type bit
2015-10-05 18:06 ` [PATCH 2/9] perf evlist: Display DATA_SRC sample type bit Jiri Olsa
@ 2015-10-06 7:13 ` tip-bot for Jiri Olsa
0 siblings, 0 replies; 24+ messages in thread
From: tip-bot for Jiri Olsa @ 2015-10-06 7:13 UTC (permalink / raw)
To: linux-tip-commits
Cc: kan.liang, tglx, linux-kernel, dsahern, hpa, a.p.zijlstra,
namhyung, mingo, jolsa, acme, dzickus
Commit-ID: 84422592e58f6f1ea03688fcf92143bbc095fa88
Gitweb: http://git.kernel.org/tip/84422592e58f6f1ea03688fcf92143bbc095fa88
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 5 Oct 2015 20:06:02 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 5 Oct 2015 16:15:10 -0300
perf evlist: Display DATA_SRC sample type bit
Adding DATA_SRC bit_name call to display sample_type properly.
$ perf evlist -v
cpu/mem-loads/pp: ...SNIP... sample_type: IP|TID|TIME|ADDR|CPU|PERIOD|DATA_SRC, ...
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1444068369-20978-3-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/evsel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 5889004..0b1c289 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1178,7 +1178,7 @@ static void __p_sample_type(char *buf, size_t size, u64 value)
bit_name(READ), bit_name(CALLCHAIN), bit_name(ID), bit_name(CPU),
bit_name(PERIOD), bit_name(STREAM_ID), bit_name(RAW),
bit_name(BRANCH_STACK), bit_name(REGS_USER), bit_name(STACK_USER),
- bit_name(IDENTIFIER), bit_name(REGS_INTR),
+ bit_name(IDENTIFIER), bit_name(REGS_INTR), bit_name(DATA_SRC),
{ .name = NULL, }
};
#undef bit_name
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [tip:perf/core] perf annotate: Fix sizeof_sym_hist overflow issue
2015-10-05 18:06 ` [PATCH 3/9] perf annotate: Fix sizeof_sym_hist overflow issue Jiri Olsa
@ 2015-10-06 7:13 ` tip-bot for Jiri Olsa
0 siblings, 0 replies; 24+ messages in thread
From: tip-bot for Jiri Olsa @ 2015-10-06 7:13 UTC (permalink / raw)
To: linux-tip-commits
Cc: jolsa, acme, mingo, hpa, namhyung, tglx, a.p.zijlstra, kan.liang,
dzickus, dsahern, linux-kernel
Commit-ID: 5ec4502d774699194952209ff3ebe65d2472e15a
Gitweb: http://git.kernel.org/tip/5ec4502d774699194952209ff3ebe65d2472e15a
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 5 Oct 2015 20:06:03 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 5 Oct 2015 16:15:38 -0300
perf annotate: Fix sizeof_sym_hist overflow issue
The annotated_source::sizeof_sym_hist could easily overflow int size,
resulting in crash in __symbol__inc_addr_samples.
Changing its type int size_t as was probably intended from beginning
based on the initialization code in symbol__alloc_hist.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1444068369-20978-4-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/annotate.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index e999609..cea323d 100644
--- a/tools/perf/util/annotate.h
+++ b/tools/perf/util/annotate.h
@@ -122,7 +122,7 @@ struct annotated_source {
struct list_head source;
struct source_line *lines;
int nr_histograms;
- int sizeof_sym_hist;
+ size_t sizeof_sym_hist;
struct cyc_hist *cycles_hist;
struct sym_hist histograms[0];
};
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [tip:perf/core] perf tools: Export perf_event_attr__set_max_precise_ip()
2015-10-05 18:06 ` [PATCH 4/9] perf tools: Make perf_event_attr__set_max_precise_ip global Jiri Olsa
@ 2015-10-06 7:13 ` tip-bot for Jiri Olsa
0 siblings, 0 replies; 24+ messages in thread
From: tip-bot for Jiri Olsa @ 2015-10-06 7:13 UTC (permalink / raw)
To: linux-tip-commits
Cc: dzickus, jolsa, mingo, linux-kernel, tglx, namhyung, dsahern,
a.p.zijlstra, kan.liang, hpa, acme
Commit-ID: 45cf6c33f95448752dd3d5531388429c3a5012d0
Gitweb: http://git.kernel.org/tip/45cf6c33f95448752dd3d5531388429c3a5012d0
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 5 Oct 2015 20:06:04 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 5 Oct 2015 16:16:20 -0300
perf tools: Export perf_event_attr__set_max_precise_ip()
It'll be used in following patch.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1444068369-20978-5-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/evlist.c | 2 +-
tools/perf/util/evlist.h | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index e7e195d..d139219 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -205,7 +205,7 @@ void perf_evlist__set_leader(struct perf_evlist *evlist)
}
}
-static void perf_event_attr__set_max_precise_ip(struct perf_event_attr *attr)
+void perf_event_attr__set_max_precise_ip(struct perf_event_attr *attr)
{
attr->precise_ip = 3;
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index 66bc9d4..a459fe7 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -290,4 +290,6 @@ void perf_evlist__to_front(struct perf_evlist *evlist,
void perf_evlist__set_tracking_event(struct perf_evlist *evlist,
struct perf_evsel *tracking_evsel);
+
+void perf_event_attr__set_max_precise_ip(struct perf_event_attr *attr);
#endif /* __PERF_EVLIST_H */
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [tip:perf/core] perf tools: Introduce 'P' modifier to request max precision
2015-10-05 18:06 ` [PATCH 5/9] perf tools: Introduce 'P' modifier Jiri Olsa
2015-10-05 18:13 ` David Ahern
2015-10-05 19:20 ` Arnaldo Carvalho de Melo
@ 2015-10-06 7:14 ` tip-bot for Jiri Olsa
2 siblings, 0 replies; 24+ messages in thread
From: tip-bot for Jiri Olsa @ 2015-10-06 7:14 UTC (permalink / raw)
To: linux-tip-commits
Cc: hpa, a.p.zijlstra, kan.liang, dsahern, linux-kernel, acme,
dzickus, mingo, namhyung, tglx, jolsa
Commit-ID: 7f94af7a489fada17d28cc60e8f4409ce216bd6d
Gitweb: http://git.kernel.org/tip/7f94af7a489fada17d28cc60e8f4409ce216bd6d
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 5 Oct 2015 20:06:05 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 5 Oct 2015 16:21:11 -0300
perf tools: Introduce 'P' modifier to request max precision
The 'P' will cause the event to get maximum possible detected precise
level.
Following record:
$ perf record -e cycles:P ...
will detect maximum precise level for 'cycles' event and use it.
Commiter note:
Testing it:
$ perf record -e cycles:P usleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.013 MB perf.data (9 samples) ]
$ perf evlist
cycles:P
$ perf evlist -v
cycles:P: size: 112, { sample_period, sample_freq }: 4000, sample_type:
IP|TID|TIME|PERIOD, disabled: 1, inherit: 1, mmap: 1, comm: 1, freq: 1,
enable_on_exec: 1, task: 1, precise_ip: 2, sample_id_all: 1, mmap2: 1,
comm_exec: 1
$
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1444068369-20978-6-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Documentation/perf-list.txt | 1 +
tools/perf/util/evsel.c | 3 +++
tools/perf/util/evsel.h | 1 +
tools/perf/util/parse-events.c | 8 +++++++-
tools/perf/util/parse-events.l | 2 +-
5 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/tools/perf/Documentation/perf-list.txt b/tools/perf/Documentation/perf-list.txt
index ad60c6e..79483f4 100644
--- a/tools/perf/Documentation/perf-list.txt
+++ b/tools/perf/Documentation/perf-list.txt
@@ -30,6 +30,7 @@ counted. The following modifiers exist:
G - guest counting (in KVM guests)
H - host counting (not in KVM guests)
p - precise level
+ P - use maximum detected precise level
S - read sample value (PERF_SAMPLE_READ)
D - pin the event to the PMU
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 0b1c289..8be867c 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -882,6 +882,9 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts)
attr->clockid = opts->clockid;
}
+ if (evsel->precise_max)
+ perf_event_attr__set_max_precise_ip(attr);
+
/*
* Apply event specific term settings,
* it overloads any global configuration.
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 7906666..02a5fed 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -111,6 +111,7 @@ struct perf_evsel {
bool system_wide;
bool tracking;
bool per_pkg;
+ bool precise_max;
/* parse modifier helper */
int exclude_GH;
int nr_members;
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 5d0cfce..3ed8bf1 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -923,6 +923,7 @@ struct event_modifier {
int eG;
int eI;
int precise;
+ int precise_max;
int exclude_GH;
int sample_read;
int pinned;
@@ -938,6 +939,7 @@ static int get_event_modifier(struct event_modifier *mod, char *str,
int eG = evsel ? evsel->attr.exclude_guest : 0;
int eI = evsel ? evsel->attr.exclude_idle : 0;
int precise = evsel ? evsel->attr.precise_ip : 0;
+ int precise_max = 0;
int sample_read = 0;
int pinned = evsel ? evsel->attr.pinned : 0;
@@ -974,6 +976,8 @@ static int get_event_modifier(struct event_modifier *mod, char *str,
/* use of precise requires exclude_guest */
if (!exclude_GH)
eG = 1;
+ } else if (*str == 'P') {
+ precise_max = 1;
} else if (*str == 'S') {
sample_read = 1;
} else if (*str == 'D') {
@@ -1004,6 +1008,7 @@ static int get_event_modifier(struct event_modifier *mod, char *str,
mod->eG = eG;
mod->eI = eI;
mod->precise = precise;
+ mod->precise_max = precise_max;
mod->exclude_GH = exclude_GH;
mod->sample_read = sample_read;
mod->pinned = pinned;
@@ -1020,7 +1025,7 @@ static int check_modifier(char *str)
char *p = str;
/* The sizeof includes 0 byte as well. */
- if (strlen(str) > (sizeof("ukhGHpppSDI") - 1))
+ if (strlen(str) > (sizeof("ukhGHpppPSDI") - 1))
return -1;
while (*p) {
@@ -1059,6 +1064,7 @@ int parse_events__modifier_event(struct list_head *list, char *str, bool add)
evsel->attr.exclude_idle = mod.eI;
evsel->exclude_GH = mod.exclude_GH;
evsel->sample_read = mod.sample_read;
+ evsel->precise_max = mod.precise_max;
if (perf_evsel__is_group_leader(evsel))
evsel->attr.pinned = mod.pinned;
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
index c29832b..be24457 100644
--- a/tools/perf/util/parse-events.l
+++ b/tools/perf/util/parse-events.l
@@ -122,7 +122,7 @@ num_raw_hex [a-fA-F0-9]+
name [a-zA-Z_*?][a-zA-Z0-9_*?.]*
name_minus [a-zA-Z_*?][a-zA-Z0-9\-_*?.]*
/* If you add a modifier you need to update check_modifier() */
-modifier_event [ukhpGHSDI]+
+modifier_event [ukhpPGHSDI]+
modifier_bp [rwx]{1,3}
%%
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [tip:perf/core] perf tests: Add parsing test for 'P' modifier
2015-10-05 18:06 ` [PATCH 6/9] perf tests: Add parsing test for 'P' modifier Jiri Olsa
@ 2015-10-06 7:14 ` tip-bot for Jiri Olsa
0 siblings, 0 replies; 24+ messages in thread
From: tip-bot for Jiri Olsa @ 2015-10-06 7:14 UTC (permalink / raw)
To: linux-tip-commits
Cc: dsahern, a.p.zijlstra, dzickus, acme, kan.liang, namhyung,
linux-kernel, tglx, jolsa, mingo, hpa
Commit-ID: ddd83c9717ef8204f17cc63d6dcb5053d472caee
Gitweb: http://git.kernel.org/tip/ddd83c9717ef8204f17cc63d6dcb5053d472caee
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 5 Oct 2015 20:06:06 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 5 Oct 2015 16:22:15 -0300
perf tests: Add parsing test for 'P' modifier
We cant test 'P' modifier gets properly parsed, the functionality test
itself is beyond this suite.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1444068369-20978-7-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/tests/parse-events.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 3a2ebe6..0648b84 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -1259,6 +1259,17 @@ test__checkevent_breakpoint_len_rw_modifier(struct perf_evlist *evlist)
return test__checkevent_breakpoint_rw(evlist);
}
+static int test__checkevent_precise_max_modifier(struct perf_evlist *evlist)
+{
+ struct perf_evsel *evsel = perf_evlist__first(evlist);
+
+ TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries);
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->attr.type);
+ TEST_ASSERT_VAL("wrong config",
+ PERF_COUNT_SW_TASK_CLOCK == evsel->attr.config);
+ return 0;
+}
+
static int count_tracepoints(void)
{
struct dirent *events_ent;
@@ -1562,6 +1573,11 @@ static struct evlist_test test__events[] = {
.check = test__checkevent_exclude_idle_modifier_1,
.id = 46,
},
+ {
+ .name = "task-clock:P,cycles",
+ .check = test__checkevent_precise_max_modifier,
+ .id = 47,
+ },
};
static struct evlist_test test__events_pmu[] = {
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [tip:perf/core] perf tools: Add support for sorting on the iaddr
2015-10-05 18:06 ` [PATCH 7/9] perf tools: Add support for sorting on the iaddr Jiri Olsa
@ 2015-10-06 7:14 ` tip-bot for Don Zickus
0 siblings, 0 replies; 24+ messages in thread
From: tip-bot for Don Zickus @ 2015-10-06 7:14 UTC (permalink / raw)
To: linux-tip-commits
Cc: mingo, dzickus, hpa, dsahern, a.p.zijlstra, jolsa, tglx,
namhyung, acme, linux-kernel, kan.liang
Commit-ID: 28e6db205b3ed3f1d86a00c69b3304190377da5f
Gitweb: http://git.kernel.org/tip/28e6db205b3ed3f1d86a00c69b3304190377da5f
Author: Don Zickus <dzickus@redhat.com>
AuthorDate: Mon, 5 Oct 2015 20:06:07 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 5 Oct 2015 16:32:00 -0300
perf tools: Add support for sorting on the iaddr
Sorting on 'symbol' gives to broad a resolution as it can cover a range
of IP address. Use the iaddr instead to get proper sorting on IP
addresses. Need to use the 'mem_sort' feature of perf record.
New sort option is: symbol_iaddr, header label is 'Code Symbol'.
$ perf mem report --stdio -F +symbol_iaddr
# Overhead Samples Code Symbol Local Weight
# ........ ............ ........................ ............
#
54.08% 1 [k] nmi_handle 192
4.51% 1 [k] finish_task_switch 16
3.66% 1 [.] malloc 13
3.10% 1 [.] __strcoll_l 11
Signed-off-by: Don Zickus <dzickus@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1444068369-20978-8-git-send-email-jolsa@kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/hist.h | 1 +
tools/perf/util/sort.c | 37 +++++++++++++++++++++++++++++++++++++
tools/perf/util/sort.h | 1 +
3 files changed, 39 insertions(+)
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 8c20a8f..a48a207 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -49,6 +49,7 @@ enum hist_column {
HISTC_MEM_LVL,
HISTC_MEM_SNOOP,
HISTC_MEM_DCACHELINE,
+ HISTC_MEM_IADDR_SYMBOL,
HISTC_TRANSACTION,
HISTC_CYCLES,
HISTC_NR_COLS, /* Last entry */
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 6b9556d..ee94b72 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -655,6 +655,35 @@ static int hist_entry__daddr_snprintf(struct hist_entry *he, char *bf,
}
static int64_t
+sort__iaddr_cmp(struct hist_entry *left, struct hist_entry *right)
+{
+ uint64_t l = 0, r = 0;
+
+ if (left->mem_info)
+ l = left->mem_info->iaddr.addr;
+ if (right->mem_info)
+ r = right->mem_info->iaddr.addr;
+
+ return (int64_t)(r - l);
+}
+
+static int hist_entry__iaddr_snprintf(struct hist_entry *he, char *bf,
+ size_t size, unsigned int width)
+{
+ uint64_t addr = 0;
+ struct map *map = NULL;
+ struct symbol *sym = NULL;
+
+ if (he->mem_info) {
+ addr = he->mem_info->iaddr.addr;
+ map = he->mem_info->iaddr.map;
+ sym = he->mem_info->iaddr.sym;
+ }
+ return _hist_entry__sym_snprintf(map, sym, addr, he->level, bf, size,
+ width);
+}
+
+static int64_t
sort__dso_daddr_cmp(struct hist_entry *left, struct hist_entry *right)
{
struct map *map_l = NULL;
@@ -1077,6 +1106,13 @@ struct sort_entry sort_mem_daddr_sym = {
.se_width_idx = HISTC_MEM_DADDR_SYMBOL,
};
+struct sort_entry sort_mem_iaddr_sym = {
+ .se_header = "Code Symbol",
+ .se_cmp = sort__iaddr_cmp,
+ .se_snprintf = hist_entry__iaddr_snprintf,
+ .se_width_idx = HISTC_MEM_IADDR_SYMBOL,
+};
+
struct sort_entry sort_mem_daddr_dso = {
.se_header = "Data Object",
.se_cmp = sort__dso_daddr_cmp,
@@ -1299,6 +1335,7 @@ static struct sort_dimension bstack_sort_dimensions[] = {
static struct sort_dimension memory_sort_dimensions[] = {
DIM(SORT_MEM_DADDR_SYMBOL, "symbol_daddr", sort_mem_daddr_sym),
+ DIM(SORT_MEM_IADDR_SYMBOL, "symbol_iaddr", sort_mem_iaddr_sym),
DIM(SORT_MEM_DADDR_DSO, "dso_daddr", sort_mem_daddr_dso),
DIM(SORT_MEM_LOCKED, "locked", sort_mem_locked),
DIM(SORT_MEM_TLB, "tlb", sort_mem_tlb),
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index c06b757..33b3d30 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -201,6 +201,7 @@ enum sort_type {
SORT_MEM_LVL,
SORT_MEM_SNOOP,
SORT_MEM_DCACHELINE,
+ SORT_MEM_IADDR_SYMBOL,
};
/*
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [tip:perf/core] perf tools: Setup proper width for symbol_iaddr field
2015-10-05 18:06 ` [PATCH 8/9] perf tools: Setup proper width for symbol_iaddr field Jiri Olsa
@ 2015-10-06 7:15 ` tip-bot for Jiri Olsa
0 siblings, 0 replies; 24+ messages in thread
From: tip-bot for Jiri Olsa @ 2015-10-06 7:15 UTC (permalink / raw)
To: linux-tip-commits
Cc: hpa, dzickus, dsahern, kan.liang, namhyung, mingo, a.p.zijlstra,
jolsa, acme, tglx, linux-kernel
Commit-ID: b34b3bf0798633cc248b682f5b4f6509739ce234
Gitweb: http://git.kernel.org/tip/b34b3bf0798633cc248b682f5b4f6509739ce234
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 5 Oct 2015 20:06:08 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 5 Oct 2015 16:33:41 -0300
perf tools: Setup proper width for symbol_iaddr field
We need to properly initialize column width for symbol_iaddr field, so
all symbols could fit in the column.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1444068369-20978-9-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/hist.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index c346b33..4fd37d6 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -132,6 +132,18 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h)
hists__new_col_len(hists, HISTC_MEM_DADDR_SYMBOL,
symlen);
}
+
+ if (h->mem_info->iaddr.sym) {
+ symlen = (int)h->mem_info->iaddr.sym->namelen + 4
+ + unresolved_col_width + 2;
+ hists__new_col_len(hists, HISTC_MEM_IADDR_SYMBOL,
+ symlen);
+ } else {
+ symlen = unresolved_col_width + 4 + 2;
+ hists__new_col_len(hists, HISTC_MEM_IADDR_SYMBOL,
+ symlen);
+ }
+
if (h->mem_info->daddr.map) {
symlen = dso__name_len(h->mem_info->daddr.map->dso);
hists__new_col_len(hists, HISTC_MEM_DADDR_DSO,
@@ -143,6 +155,7 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h)
} else {
symlen = unresolved_col_width + 4 + 2;
hists__new_col_len(hists, HISTC_MEM_DADDR_SYMBOL, symlen);
+ hists__new_col_len(hists, HISTC_MEM_IADDR_SYMBOL, symlen);
hists__set_unres_dso_col_len(hists, HISTC_MEM_DADDR_DSO);
}
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [tip:perf/core] perf tools: Handle -h and -v options
2015-10-05 18:06 ` [PATCH 9/9] perf tools: Handle -h and -v options Jiri Olsa
@ 2015-10-06 7:15 ` tip-bot for Jiri Olsa
0 siblings, 0 replies; 24+ messages in thread
From: tip-bot for Jiri Olsa @ 2015-10-06 7:15 UTC (permalink / raw)
To: linux-tip-commits
Cc: a.p.zijlstra, tglx, namhyung, jolsa, kan.liang, peterz, hpa,
acme, mingo, dzickus, dsahern, linux-kernel
Commit-ID: a1853e2c6f8ed488adcd84fb162c5b3f0b674d9b
Gitweb: http://git.kernel.org/tip/a1853e2c6f8ed488adcd84fb162c5b3f0b674d9b
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 5 Oct 2015 20:06:09 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 5 Oct 2015 16:36:18 -0300
perf tools: Handle -h and -v options
Adding handling for '-h' and '-v' options to invoke help and version
command respectively.
Current behaviour is:
$ perf -v
Unknown option: -v
Usage: perf [--version] [--help] [OPTIONS] COMMAND [ARGS]
$ perf -h
Unknown option: -h
Usage: perf [--version] [--help] [OPTIONS] COMMAND [ARGS]
New behaviour:
$ perf -h
usage: perf [--version] [--help] [OPTIONS] COMMAND [ARGS]
The most commonly used perf commands are:
annotate Read perf.data (created by perf record) and display annotated code
archive Create archive with object files with build-ids found in perf.data file
bench General framework for benchmark suites
...
$ perf -v
perf version 4.3.rc3.gc99e32
Updated man page.
Requested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1444068369-20978-10-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Documentation/perf.txt | 8 ++++++++
tools/perf/perf.c | 14 ++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/tools/perf/Documentation/perf.txt b/tools/perf/Documentation/perf.txt
index 2b13177..864e375 100644
--- a/tools/perf/Documentation/perf.txt
+++ b/tools/perf/Documentation/perf.txt
@@ -27,6 +27,14 @@ OPTIONS
Setup buildid cache directory. It has higher priority than
buildid.dir config file option.
+-v::
+--version::
+ Display perf version.
+
+-h::
+--help::
+ Run perf help command.
+
DESCRIPTION
-----------
Performance counters for Linux are a new kernel-based subsystem
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 1fded92..5437134 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -162,6 +162,20 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
break;
/*
+ * Shortcut for '-h' and '-v' options to invoke help
+ * and version command.
+ */
+ if (!strcmp(cmd, "-h")) {
+ (*argv)[0] = "--help";
+ break;
+ }
+
+ if (!strcmp(cmd, "-v")) {
+ (*argv)[0] = "--version";
+ break;
+ }
+
+ /*
* Check remaining flags.
*/
if (!prefixcmp(cmd, CMD_EXEC_PATH)) {
^ permalink raw reply related [flat|nested] 24+ messages in thread
end of thread, other threads:[~2015-10-06 7:16 UTC | newest]
Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-05 18:06 [PATCH 0/9] perf tools: Various fixes Jiri Olsa
2015-10-05 18:06 ` [PATCH 1/9] tools lib api fs: Do not use PATH_MAX + 1 Jiri Olsa
2015-10-06 7:12 ` [tip:perf/core] tools lib api fs: No need to " tip-bot for Jiri Olsa
2015-10-05 18:06 ` [PATCH 2/9] perf evlist: Display DATA_SRC sample type bit Jiri Olsa
2015-10-06 7:13 ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-10-05 18:06 ` [PATCH 3/9] perf annotate: Fix sizeof_sym_hist overflow issue Jiri Olsa
2015-10-06 7:13 ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-10-05 18:06 ` [PATCH 4/9] perf tools: Make perf_event_attr__set_max_precise_ip global Jiri Olsa
2015-10-06 7:13 ` [tip:perf/core] perf tools: Export perf_event_attr__set_max_precise_ip() tip-bot for Jiri Olsa
2015-10-05 18:06 ` [PATCH 5/9] perf tools: Introduce 'P' modifier Jiri Olsa
2015-10-05 18:13 ` David Ahern
2015-10-05 18:38 ` Jiri Olsa
2015-10-05 19:08 ` Arnaldo Carvalho de Melo
2015-10-05 19:20 ` Arnaldo Carvalho de Melo
2015-10-06 7:01 ` Jiri Olsa
2015-10-06 7:14 ` [tip:perf/core] perf tools: Introduce 'P' modifier to request max precision tip-bot for Jiri Olsa
2015-10-05 18:06 ` [PATCH 6/9] perf tests: Add parsing test for 'P' modifier Jiri Olsa
2015-10-06 7:14 ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-10-05 18:06 ` [PATCH 7/9] perf tools: Add support for sorting on the iaddr Jiri Olsa
2015-10-06 7:14 ` [tip:perf/core] " tip-bot for Don Zickus
2015-10-05 18:06 ` [PATCH 8/9] perf tools: Setup proper width for symbol_iaddr field Jiri Olsa
2015-10-06 7:15 ` [tip:perf/core] " tip-bot for Jiri Olsa
2015-10-05 18:06 ` [PATCH 9/9] perf tools: Handle -h and -v options Jiri Olsa
2015-10-06 7:15 ` [tip:perf/core] " tip-bot for Jiri Olsa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).