Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1239960 > unrolled thread
| Started by | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| First post | 2015-10-05 23:10 +0200 |
| Last post | 2015-10-06 09:10 +0200 |
| Articles | 20 — 6 participants |
Back to article view | Back to linux.kernel
[GIT PULL 00/16] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-05 23:10 +0200
[PATCH 01/16] tools lib api fs: No need to use PATH_MAX + 1 Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-05 23:10 +0200
[PATCH 05/16] perf tools: Introduce 'P' modifier to request max precision Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-05 23:10 +0200
[PATCH 08/16] perf tools: Setup proper width for symbol_iaddr field Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-05 23:10 +0200
[PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-05 23:10 +0200
Re: [PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' Brendan Gregg <brendan.d.gregg@gmail.com> - 2015-10-09 22:40 +0200
Re: [PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-10 00:00 +0200
Re: [PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' Brendan Gregg <brendan.d.gregg@gmail.com> - 2015-10-10 00:20 +0200
Re: [PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com> - 2015-10-10 00:30 +0200
Re: [PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' Ingo Molnar <mingo@kernel.org> - 2015-10-10 09:10 +0200
Re: [PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' Brendan Gregg <brendan.d.gregg@gmail.com> - 2015-10-10 09:40 +0200
Re: [PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' Ingo Molnar <mingo@kernel.org> - 2015-10-10 11:10 +0200
Re: [PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' Frederic Weisbecker <fweisbec@gmail.com> - 2015-10-12 17:30 +0200
Re: [PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' Namhyung Kim <namhyung@kernel.org> - 2015-10-13 06:50 +0200
[PATCH 04/16] perf tools: Export perf_event_attr__set_max_precise_ip() Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-05 23:10 +0200
[PATCH 10/16] perf tests: Add arch tests Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-05 23:10 +0200
[PATCH 09/16] perf tools: Handle -h and -v options Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-05 23:10 +0200
[PATCH 07/16] perf tools: Add support for sorting on the iaddr Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-05 23:10 +0200
[PATCH 12/16] perf tests: Add Intel CQM test Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-10-05 23:10 +0200
Re: [GIT PULL 00/16] perf/core improvements and fixes Ingo Molnar <mingo@kernel.org> - 2015-10-06 09:10 +0200
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2015-10-05 23:10 +0200 |
| Subject | [GIT PULL 00/16] perf/core improvements and fixes |
| Message-ID | <qglbb-2cb-3@gated-at.bofh.it> |
Hi Ingo,
Please consider pulling,
- Arnaldo
The following changes since commit e3b0ac1b7a8a590440a2030e7d10d48c59ab8a2a:
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2015-10-03 08:20:14 +0200)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo
for you to fetch changes up to 27bf90bf0690f55c3679bcc4c325823cf1cfd19d:
perf tools: Fail properly in case pattern matching fails to find tracepoint (2015-10-05 17:59:50 -0300)
----------------------------------------------------------------
perf/core improvements and fixes:
User visible:
- Switch the default callchain output mode to 'graph,0.5,caller', to make it
look like the default for other tools, reducing the learning curve for
people used to 'caller' based viewing (Arnaldo Carvalho de Melo)
- Implement column based horizontal scrolling in the hists browser (top, report),
making it possible to use the TUI for things like 'perf mem report' where
there are many more columns than can fit in a terminal (Arnaldo Carvalho de Melo)
- Support sorting by symbol_iaddr with perf.data files produced by
'perf mem record' (Don Zickus)
- Display DATA_SRC sample type bit, i.e. when running 'perf evlist -v' the
"DATA_SRC" wasn't appearing when set, fix it to look like: (Jiri Olsa)
cpu/mem-loads/pp: ...SNIP... sample_type: IP|TID|TIME|ADDR|CPU|PERIOD|DATA_SRC
- Introduce 'P' event modified, meaning 'max precision level, please', i.e.:
$ perf record -e cycles:P usleep 1
Is now similar to:
$ perf record usleep 1
Useful, for instance, when specifying multiple events (Jiri Olsa)
- Make 'perf -v' and 'perf -h' work (Jiri Olsa)
- Fail properly when pattern matching fails to find a tracepoint, i.e.
'-e non:existent' was being correctly handled, with a proper error message
about that not being a valid event, but '-e non:existent*' wasn't,
fix it (Jiri Olsa)
Infrastructure:
- Separate arch specific entries in 'perf test' and add an 'Intel CQM' one
to be fun on x86 only (Matt Fleming)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----------------------------------------------------------------
Arnaldo Carvalho de Melo (3):
perf callchain: Switch default to 'graph,0.5,caller'
perf ui browser: Optional horizontal scrolling key binding
perf hists browser: Implement horizontal scrolling
Don Zickus (1):
perf tools: Add support for sorting on the iaddr
Jiri Olsa (9):
tools lib api fs: No need to use PATH_MAX + 1
perf evlist: Display DATA_SRC sample type bit
perf annotate: Fix sizeof_sym_hist overflow issue
perf tools: Export perf_event_attr__set_max_precise_ip()
perf tools: Introduce 'P' modifier to request max precision
perf tests: Add parsing test for 'P' modifier
perf tools: Setup proper width for symbol_iaddr field
perf tools: Handle -h and -v options
perf tools: Fail properly in case pattern matching fails to find tracepoint
Matt Fleming (3):
perf tests: Add arch tests
perf tests: Move x86 tests into arch directory
perf tests: Add Intel CQM test
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-report.txt | 2 +-
tools/perf/Documentation/perf.txt | 8 ++
tools/perf/arch/x86/Build | 2 +-
tools/perf/arch/x86/include/arch-tests.h | 19 ++++
tools/perf/arch/x86/tests/Build | 10 +-
tools/perf/arch/x86/tests/arch-tests.c | 34 ++++++
tools/perf/arch/x86/tests/dwarf-unwind.c | 1 +
.../perf/{ => arch/x86}/tests/gen-insn-x86-dat.awk | 0
.../perf/{ => arch/x86}/tests/gen-insn-x86-dat.sh | 0
tools/perf/{ => arch/x86}/tests/insn-x86-dat-32.c | 0
tools/perf/{ => arch/x86}/tests/insn-x86-dat-64.c | 0
tools/perf/{ => arch/x86}/tests/insn-x86-dat-src.c | 0
tools/perf/{ => arch/x86}/tests/insn-x86.c | 3 +-
tools/perf/arch/x86/tests/intel-cqm.c | 124 +++++++++++++++++++++
tools/perf/{ => arch/x86}/tests/perf-time-to-tsc.c | 4 +-
tools/perf/{ => arch/x86}/tests/rdpmc.c | 7 +-
tools/perf/builtin-report.c | 4 +-
tools/perf/perf.c | 14 +++
tools/perf/tests/Build | 6 -
tools/perf/tests/builtin-test.c | 56 ++++------
tools/perf/tests/dwarf-unwind.c | 4 +
tools/perf/tests/parse-events.c | 16 +++
tools/perf/tests/tests.h | 10 +-
tools/perf/ui/browser.c | 14 +++
tools/perf/ui/browser.h | 2 +-
tools/perf/ui/browsers/hists.c | 22 +++-
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 | 17 ++-
tools/perf/util/parse-events.l | 2 +-
tools/perf/util/sort.c | 37 ++++++
tools/perf/util/sort.h | 1 +
tools/perf/util/util.c | 4 +-
41 files changed, 381 insertions(+), 77 deletions(-)
create mode 100644 tools/perf/arch/x86/include/arch-tests.h
create mode 100644 tools/perf/arch/x86/tests/arch-tests.c
rename tools/perf/{ => arch/x86}/tests/gen-insn-x86-dat.awk (100%)
rename tools/perf/{ => arch/x86}/tests/gen-insn-x86-dat.sh (100%)
rename tools/perf/{ => arch/x86}/tests/insn-x86-dat-32.c (100%)
rename tools/perf/{ => arch/x86}/tests/insn-x86-dat-64.c (100%)
rename tools/perf/{ => arch/x86}/tests/insn-x86-dat-src.c (100%)
rename tools/perf/{ => arch/x86}/tests/insn-x86.c (98%)
create mode 100644 tools/perf/arch/x86/tests/intel-cqm.c
rename tools/perf/{ => arch/x86}/tests/perf-time-to-tsc.c (98%)
rename tools/perf/{ => arch/x86}/tests/rdpmc.c (97%)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2015-10-05 23:10 +0200 |
| Subject | [PATCH 01/16] tools lib api fs: No need to use PATH_MAX + 1 |
| Message-ID | <qglbc-2cb-23@gated-at.bofh.it> |
| In reply to | #1239960 |
From: Jiri Olsa <jolsa@kernel.org>
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 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.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2015-10-05 23:10 +0200 |
| Subject | [PATCH 05/16] perf tools: Introduce 'P' modifier to request max precision |
| Message-ID | <qglbc-2cb-25@gated-at.bofh.it> |
| In reply to | #1239960 |
From: Jiri Olsa <jolsa@kernel.org>
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 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.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2015-10-05 23:10 +0200 |
| Subject | [PATCH 08/16] perf tools: Setup proper width for symbol_iaddr field |
| Message-ID | <qglbc-2cb-27@gated-at.bofh.it> |
| In reply to | #1239960 |
From: Jiri Olsa <jolsa@kernel.org>
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 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.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2015-10-05 23:10 +0200 |
| Subject | [PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' |
| Message-ID | <qglbb-2cb-19@gated-at.bofh.it> |
| In reply to | #1239960 |
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Which is the most common default found in other similar tools.
Requested-by: Ingo Molnar <mingo@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Chandler Carruth <chandlerc@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://www.youtube.com/watch?v=nXaxk27zwlk
Link: http://lkml.kernel.org/n/tip-v8lq36aispvdwgxdmt9p9jd9@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Documentation/perf-report.txt | 2 +-
tools/perf/builtin-report.c | 4 ++--
tools/perf/util/util.c | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index ce499035e6d8..e4fdeeb51123 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -192,7 +192,7 @@ OPTIONS
when available. Usually more convenient to use --branch-history
for this.
- Default: fractal,0.5,callee,function.
+ Default: graph,0.5,caller
--children::
Accumulate callchain of children to parent entry so that then can
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index b5623639f67d..3b23b25d1589 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -633,7 +633,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
bool has_br_stack = false;
int branch_mode = -1;
bool branch_call_mode = false;
- char callchain_default_opt[] = "fractal,0.5,callee";
+ char callchain_default_opt[] = "graph,0.5,caller";
const char * const report_usage[] = {
"perf report [<options>]",
NULL
@@ -701,7 +701,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
"Only display entries with parent-match"),
OPT_CALLBACK_DEFAULT('g', "call-graph", &report, "output_type,min_percent[,print_limit],call_order[,branch]",
"Display callchains using output_type (graph, flat, fractal, or none) , min percent threshold, optional print limit, callchain order, key (function or address), add branches. "
- "Default: fractal,0.5,callee,function", &report_parse_callchain_opt, callchain_default_opt),
+ "Default: graph,0.5,caller", &report_parse_callchain_opt, callchain_default_opt),
OPT_BOOLEAN(0, "children", &symbol_conf.cumulate_callchain,
"Accumulate callchains of children and show total overhead as well"),
OPT_INTEGER(0, "max-stack", &report.max_stack,
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index ce465b259e52..c1bf9ff210b0 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -17,9 +17,9 @@
#include "callchain.h"
struct callchain_param callchain_param = {
- .mode = CHAIN_GRAPH_REL,
+ .mode = CHAIN_GRAPH_ABS,
.min_percent = 0.5,
- .order = ORDER_CALLEE,
+ .order = ORDER_CALLER,
.key = CCKEY_FUNCTION
};
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Brendan Gregg <brendan.d.gregg@gmail.com> |
|---|---|
| Date | 2015-10-09 22:40 +0200 |
| Subject | Re: [PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' |
| Message-ID | <qhMCm-4yA-13@gated-at.bofh.it> |
| In reply to | #1239964 |
On Mon, Oct 5, 2015 at 2:03 PM, Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
>
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> Which is the most common default found in other similar tools.
Interactive tools, sure, like the perf report TUI.
But this also changes the ordering of the non-interactive tools which
dump stacks: "perf report -n --stdio" and "perf script". The most
common default for dumping stacks is caller. Eg:
# perf report -n --stdio
[...]
16.87% 334 iperf [kernel.kallsyms] [k]
copy_user_enhanced_fast_string
|
--- 0x7f0683ba1ccd
system_call_fastpath
sys_write
vfs_write
do_sync_write
sock_aio_write
do_sock_write.isra.10
inet_sendmsg
copy_user_enhanced_fast_string
[...]
That's upside down. The current default preserves ordering from the
informational line onwards:
# perf report -n --stdio -g fractal,0.5,callee
[...]
16.87% 334 iperf [kernel.kallsyms] [k]
copy_user_enhanced_fast_string
|
--- copy_user_enhanced_fast_string
|
|--64.37%-- inet_sendmsg
| do_sock_write.isra.10
| sock_aio_write
| do_sync_write
| vfs_write
| sys_write
| system_call_fastpath
| 0x7f0683ba1ccd
... Those are just short examples. Another profile I'm working on now
gets really messy on "perf report -n --stdio"; eg:
perf report -n --stdio -g graph,0.5,caller
94.80% 0.10% 2 iperf [kernel.vmlinux] [k]
entry_SYSCALL_64_fastpath
|
|--94.70%-- entry_SYSCALL_64_fastpath
| |
| |--55.76%-- sys_write
| | |
| | |--55.10%-- vfs_write
| | | |
| | | |--54.39%-- __vfs_write
| | | | |
| | | | --54.34%--
sock_write_iter
| | | | |
| | | |
|--54.19%-- sock_sendmsg
| | | |
| |
| | | |
| |--53.99%-- inet_sendmsg
| | | |
| | |
| | | |
| | |--53.08%-- tcp_sendmsg
| | | |
| | | |
| | | |
| | | |--17.27%--
copy_user_enhanced_fast_string
| | | |
| | | |
| | | |
| | | |--11.41%-- tcp_push_one
| | | |
| | | | |
| | | |
| | | | |--11.31%-- tcp_write_xmit
| | | |
| | | | | |
| | | |
| | | | | |--10.00%--
tcp_transmit_skb
| | | |
| | | | | | |
| | | |
| | | | | |
|--9.29%-- ip_queue_xmit
| | | |
| | | | | | |
|
| | | |
| | | | | | |
|--8.69%-- ip_local_out_sk
| | | |
| | | | | | |
| |
| | | |
| | | | | | |
| |--8.64%-- ip_output
| | | |
| | | | | | |
| | ip_finish_output
| | | |
| | | | | | |
| | |
| | | |
| | | | | | |
| | |--8.43%-- ip_finish_output2
| | | |
| | | | | | |
| | | |
| | | |
| | | | | | |
| | | |--6.97%-- __local_bh_enable_ip
| | | |
| | | | | | |
| | | | |
| | | |
| | | | | | |
| | | | |--6.82%--
do_softirq
| | | |
| | | | | | |
| | | | | |
| | | |
| | | | | | |
| | | | |
--6.77%-- do_softirq_own_stack
| | | |
| | | | | | |
| | | | |
|
| | | |
| | | | | | |
| | | | |
|--6.46%-- __do_softirq
[...]
The current default never gets beyond 5 levels deep. The new default
goes to 25 levels. At least with perf report I can override the
default using "-g". perf script doesn't support that.
Can this patch please preserve the callee ordering for non-interactive
output? (perf script, perf report -n --stdio). Thanks,
Brendan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2015-10-10 00:00 +0200 |
| Subject | Re: [PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' |
| Message-ID | <qhNRN-6gk-11@gated-at.bofh.it> |
| In reply to | #1243637 |
Em Fri, Oct 09, 2015 at 01:34:33PM -0700, Brendan Gregg escreveu: > On Mon, Oct 5, 2015 at 2:03 PM, Arnaldo Carvalho de Melo > <acme@kernel.org> wrote: > > > > From: Arnaldo Carvalho de Melo <acme@redhat.com> > > > > Which is the most common default found in other similar tools. > > Interactive tools, sure, like the perf report TUI. > But this also changes the ordering of the non-interactive tools which > dump stacks: "perf report -n --stdio" and "perf script". The most > common default for dumping stacks is caller. Eg: And you use that for scripting? > # perf report -n --stdio > [...] > 16.87% 334 iperf [kernel.kallsyms] [k] copy_user_enhanced_fast_string > | > --- 0x7f0683ba1ccd > system_call_fastpath > sys_write > vfs_write > do_sync_write > sock_aio_write > do_sock_write.isra.10 > inet_sendmsg > copy_user_enhanced_fast_string > [...] > > That's upside down. The current default preserves ordering from the > informational line onwards: > > # perf report -n --stdio -g fractal,0.5,callee > [...] > 16.87% 334 iperf [kernel.kallsyms] [k] copy_user_enhanced_fast_string > | > --- copy_user_enhanced_fast_string > | > |--64.37%-- inet_sendmsg > | do_sock_write.isra.10 > | sock_aio_write > | do_sync_write > | vfs_write > | sys_write > | system_call_fastpath > | 0x7f0683ba1ccd > > ... Those are just short examples. Another profile I'm working on now > gets really messy on "perf report -n --stdio"; eg: > > perf report -n --stdio -g graph,0.5,caller > 94.80% 0.10% 2 iperf [kernel.vmlinux] [k] > entry_SYSCALL_64_fastpath > | > |--94.70%-- entry_SYSCALL_64_fastpath > | | > > The current default never gets beyond 5 levels deep. The new default > goes to 25 levels. At least with perf report I can override the > default using "-g". perf script doesn't support that. Ok, so changing defaults is not nice, but in this case looked sensible, ends up not being for you... > Can this patch please preserve the callee ordering for non-interactive > output? (perf script, perf report -n --stdio). Thanks, If this is because you do scripting on it? Wouldn't it be better to not depend on defaults, always specify what you want and then the bug would be constrained to 'perf script' where we need to provide a way to change the default? - Arnaldo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Brendan Gregg <brendan.d.gregg@gmail.com> |
|---|---|
| Date | 2015-10-10 00:20 +0200 |
| Subject | Re: [PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' |
| Message-ID | <qhOb8-6RX-21@gated-at.bofh.it> |
| In reply to | #1243685 |
On Fri, Oct 9, 2015 at 2:56 PM, Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com> wrote: > > Em Fri, Oct 09, 2015 at 01:34:33PM -0700, Brendan Gregg escreveu: > > On Mon, Oct 5, 2015 at 2:03 PM, Arnaldo Carvalho de Melo > > <acme@kernel.org> wrote: > > > > > > From: Arnaldo Carvalho de Melo <acme@redhat.com> > > > > > > Which is the most common default found in other similar tools. > > > > Interactive tools, sure, like the perf report TUI. > > > But this also changes the ordering of the non-interactive tools which > > dump stacks: "perf report -n --stdio" and "perf script". The most > > common default for dumping stacks is caller. Eg: > > And you use that for scripting? Yes; how I typically CPU profile: git clone https://github.com/brendangregg/FlameGraph cd FlameGraph perf record -F 99 -a -g -- sleep 60 perf script | ./stackcollapse-perf.pl | /flamegraph.pl > flame.svg Then open flame.svg in a browser and click around. Try it. :) But it's not just scripting; We often email around "perf report -n --stdio" output, or attach it to tickets, when working on an issue. Easier than trying to grab the right TUI screenshot. > > > # perf report -n --stdio > > [...] > > 16.87% 334 iperf [kernel.kallsyms] [k] copy_user_enhanced_fast_string > > | > > --- 0x7f0683ba1ccd > > system_call_fastpath > > sys_write > > vfs_write > > do_sync_write > > sock_aio_write > > do_sock_write.isra.10 > > inet_sendmsg > > copy_user_enhanced_fast_string > > [...] > > > > That's upside down. The current default preserves ordering from the > > informational line onwards: > > > > # perf report -n --stdio -g fractal,0.5,callee > > [...] > > 16.87% 334 iperf [kernel.kallsyms] [k] copy_user_enhanced_fast_string > > | > > --- copy_user_enhanced_fast_string > > | > > |--64.37%-- inet_sendmsg > > | do_sock_write.isra.10 > > | sock_aio_write > > | do_sync_write > > | vfs_write > > | sys_write > > | system_call_fastpath > > | 0x7f0683ba1ccd > > > > ... Those are just short examples. Another profile I'm working on now > > gets really messy on "perf report -n --stdio"; eg: > > > > perf report -n --stdio -g graph,0.5,caller > > 94.80% 0.10% 2 iperf [kernel.vmlinux] [k] > > entry_SYSCALL_64_fastpath > > | > > |--94.70%-- entry_SYSCALL_64_fastpath > > | | > > > > > The current default never gets beyond 5 levels deep. The new default > > goes to 25 levels. At least with perf report I can override the > > default using "-g". perf script doesn't support that. > > Ok, so changing defaults is not nice, but in this case looked sensible, > ends up not being for you... I'm pretty sure this would surprise anyone looking at dumped stacks, where the convention is caller. pstack, jstack, gdb, systemtap, dtrace, oops message, etc. I get that we want this for the TUI, but not dumped stacks. > > > Can this patch please preserve the callee ordering for non-interactive > > output? (perf script, perf report -n --stdio). Thanks, > > If this is because you do scripting on it? Wouldn't it be better to not > depend on defaults, always specify what you want and then the bug would > be constrained to 'perf script' where we need to provide a way to change > the default? Actually, for my flame graphs we should really have perf report have a --folded output to emit folded output (I emailed perf-users), callee. For scripting we can always specify -g. I'm thinking of others who use perf report/script at the CLI, and expect callee output. Brendan -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com> |
|---|---|
| Date | 2015-10-10 00:30 +0200 |
| Subject | Re: [PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' |
| Message-ID | <qhOkP-73l-51@gated-at.bofh.it> |
| In reply to | #1243696 |
Em Fri, Oct 09, 2015 at 03:10:29PM -0700, Brendan Gregg escreveu: > On Fri, Oct 9, 2015 at 2:56 PM, Arnaldo Carvalho de Melo > <arnaldo.melo@gmail.com> wrote: > > > > Em Fri, Oct 09, 2015 at 01:34:33PM -0700, Brendan Gregg escreveu: > > > On Mon, Oct 5, 2015 at 2:03 PM, Arnaldo Carvalho de Melo > > > <acme@kernel.org> wrote: > > > > > > > > From: Arnaldo Carvalho de Melo <acme@redhat.com> > > > > > > > > Which is the most common default found in other similar tools. > > > > > > Interactive tools, sure, like the perf report TUI. > > > > > But this also changes the ordering of the non-interactive tools which > > > dump stacks: "perf report -n --stdio" and "perf script". The most > > > common default for dumping stacks is caller. Eg: > > > > And you use that for scripting? > > Yes; how I typically CPU profile: > > git clone https://github.com/brendangregg/FlameGraph > cd FlameGraph > perf record -F 99 -a -g -- sleep 60 > perf script | ./stackcollapse-perf.pl | /flamegraph.pl > flame.svg > > Then open flame.svg in a browser and click around. Try it. :) Should've already, guess there are things to merge and save you some time :) > But it's not just scripting; We often email around "perf report -n > --stdio" output, or attach it to tickets, when working on an issue. > Easier than trying to grab the right TUI screenshot. Well, that is something we need to change... But then, are you aware of 'P' in the TUI? It allows you to go, expand whatever callchains you deem necessary and then press P and the current state of the UI will be dumped to a perf.hist.<N> file. I.e. no need to get a png screenshot nor to copy things with gpm like stuff. Maybe that is a digression, you tell me :) > > > > > # perf report -n --stdio > > > [...] > > > 16.87% 334 iperf [kernel.kallsyms] [k] copy_user_enhanced_fast_string > > > | > > > --- 0x7f0683ba1ccd > > > system_call_fastpath > > > sys_write > > > vfs_write > > > do_sync_write > > > sock_aio_write > > > do_sock_write.isra.10 > > > inet_sendmsg > > > copy_user_enhanced_fast_string > > > [...] > > > > > > That's upside down. The current default preserves ordering from the > > > informational line onwards: > > > > > > # perf report -n --stdio -g fractal,0.5,callee > > > [...] > > > 16.87% 334 iperf [kernel.kallsyms] [k] copy_user_enhanced_fast_string > > > | > > > --- copy_user_enhanced_fast_string > > > | > > > |--64.37%-- inet_sendmsg > > > | do_sock_write.isra.10 > > > | sock_aio_write > > > | do_sync_write > > > | vfs_write > > > | sys_write > > > | system_call_fastpath > > > | 0x7f0683ba1ccd > > > > > > ... Those are just short examples. Another profile I'm working on now > > > gets really messy on "perf report -n --stdio"; eg: > > > > > > perf report -n --stdio -g graph,0.5,caller > > > 94.80% 0.10% 2 iperf [kernel.vmlinux] [k] > > > entry_SYSCALL_64_fastpath > > > | > > > |--94.70%-- entry_SYSCALL_64_fastpath > > > | | > > > > > > > > The current default never gets beyond 5 levels deep. The new default > > > goes to 25 levels. At least with perf report I can override the > > > default using "-g". perf script doesn't support that. > > > > Ok, so changing defaults is not nice, but in this case looked sensible, > > ends up not being for you... > > I'm pretty sure this would surprise anyone looking at dumped stacks, > where the convention is caller. pstack, jstack, gdb, systemtap, > dtrace, oops message, etc. I get that we want this for the TUI, but > not dumped stacks. > > > > Can this patch please preserve the callee ordering for non-interactive > > > output? (perf script, perf report -n --stdio). Thanks, > > > > If this is because you do scripting on it? Wouldn't it be better to not > > depend on defaults, always specify what you want and then the bug would > > be constrained to 'perf script' where we need to provide a way to change > > the default? > > Actually, for my flame graphs we should really have perf report have a > --folded output to emit folded output (I emailed perf-users), callee. I'll search that message, but feel free to be more blunt when you think its appropriate. > For scripting we can always specify -g. > > I'm thinking of others who use perf report/script at the CLI, and > expect callee output. - Arnaldo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2015-10-10 09:10 +0200 |
| Subject | Re: [PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' |
| Message-ID | <qhWs2-22e-15@gated-at.bofh.it> |
| In reply to | #1243696 |
* Brendan Gregg <brendan.d.gregg@gmail.com> wrote: > On Fri, Oct 9, 2015 at 2:56 PM, Arnaldo Carvalho de Melo > <arnaldo.melo@gmail.com> wrote: > > > > Em Fri, Oct 09, 2015 at 01:34:33PM -0700, Brendan Gregg escreveu: > > > On Mon, Oct 5, 2015 at 2:03 PM, Arnaldo Carvalho de Melo > > > <acme@kernel.org> wrote: > > > > > > > > From: Arnaldo Carvalho de Melo <acme@redhat.com> > > > > > > > > Which is the most common default found in other similar tools. > > > > > > Interactive tools, sure, like the perf report TUI. > > > > > But this also changes the ordering of the non-interactive tools which > > > dump stacks: "perf report -n --stdio" and "perf script". The most > > > common default for dumping stacks is caller. Eg: > > > > And you use that for scripting? > > Yes; how I typically CPU profile: > > git clone https://github.com/brendangregg/FlameGraph > cd FlameGraph > perf record -F 99 -a -g -- sleep 60 > perf script | ./stackcollapse-perf.pl | /flamegraph.pl > flame.svg > > Then open flame.svg in a browser and click around. Try it. :) So I tried it: triton:~/s/FlameGraph> ls -l flame.svg -rw-rw-r-- 1 mingo mingo 1022870 Oct 10 09:06 flame.svg but when I tried to view it via ImageMagick, it first showed an empty screen: triton:~/s/FlameGraph> display flame.svg then when exiting it said: display: non-conforming drawing primitive definition `text-anchor' @ error/draw.c/DrawImage/3182. although I guess that latter is an unrealted ImageMagick problem, not caused by the SVG. Thanks, Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Brendan Gregg <brendan.d.gregg@gmail.com> |
|---|---|
| Date | 2015-10-10 09:40 +0200 |
| Subject | Re: [PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' |
| Message-ID | <qhWV4-2zq-7@gated-at.bofh.it> |
| In reply to | #1243841 |
On Sat, Oct 10, 2015 at 12:09 AM, Ingo Molnar <mingo@kernel.org> wrote: > > * Brendan Gregg <brendan.d.gregg@gmail.com> wrote: > >> On Fri, Oct 9, 2015 at 2:56 PM, Arnaldo Carvalho de Melo >> <arnaldo.melo@gmail.com> wrote: >> > >> > Em Fri, Oct 09, 2015 at 01:34:33PM -0700, Brendan Gregg escreveu: >> > > On Mon, Oct 5, 2015 at 2:03 PM, Arnaldo Carvalho de Melo >> > > <acme@kernel.org> wrote: >> > > > >> > > > From: Arnaldo Carvalho de Melo <acme@redhat.com> >> > > > >> > > > Which is the most common default found in other similar tools. >> > > >> > > Interactive tools, sure, like the perf report TUI. >> > >> > > But this also changes the ordering of the non-interactive tools which >> > > dump stacks: "perf report -n --stdio" and "perf script". The most >> > > common default for dumping stacks is caller. Eg: >> > >> > And you use that for scripting? >> >> Yes; how I typically CPU profile: >> >> git clone https://github.com/brendangregg/FlameGraph >> cd FlameGraph >> perf record -F 99 -a -g -- sleep 60 >> perf script | ./stackcollapse-perf.pl | /flamegraph.pl > flame.svg >> >> Then open flame.svg in a browser and click around. Try it. :) > > So I tried it: > > triton:~/s/FlameGraph> ls -l flame.svg > -rw-rw-r-- 1 mingo mingo 1022870 Oct 10 09:06 flame.svg > > but when I tried to view it via ImageMagick, it first showed an empty screen: > > triton:~/s/FlameGraph> display flame.svg > > then when exiting it said: > > display: non-conforming drawing primitive definition `text-anchor' @ error/draw.c/DrawImage/3182. > > although I guess that latter is an unrealted ImageMagick problem, not caused by > the SVG. > Sorry, I should have said to open it in a browser (Chrome/Firefox); the SVG contains some (entirely embedded) JavaScript to provide interactivity (click to zoom, Ctrl-F to search). I think it used to work in ImageMagick (without JavaScript interactivity), but I haven't tried in a long time. I'll have to check it again. Brendan -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2015-10-10 11:10 +0200 |
| Subject | Re: [PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' |
| Message-ID | <qhYk9-4Ky-3@gated-at.bofh.it> |
| In reply to | #1243844 |
* Brendan Gregg <brendan.d.gregg@gmail.com> wrote: > On Sat, Oct 10, 2015 at 12:09 AM, Ingo Molnar <mingo@kernel.org> wrote: > > > > * Brendan Gregg <brendan.d.gregg@gmail.com> wrote: > > > >> On Fri, Oct 9, 2015 at 2:56 PM, Arnaldo Carvalho de Melo > >> <arnaldo.melo@gmail.com> wrote: > >> > > >> > Em Fri, Oct 09, 2015 at 01:34:33PM -0700, Brendan Gregg escreveu: > >> > > On Mon, Oct 5, 2015 at 2:03 PM, Arnaldo Carvalho de Melo > >> > > <acme@kernel.org> wrote: > >> > > > > >> > > > From: Arnaldo Carvalho de Melo <acme@redhat.com> > >> > > > > >> > > > Which is the most common default found in other similar tools. > >> > > > >> > > Interactive tools, sure, like the perf report TUI. > >> > > >> > > But this also changes the ordering of the non-interactive tools which > >> > > dump stacks: "perf report -n --stdio" and "perf script". The most > >> > > common default for dumping stacks is caller. Eg: > >> > > >> > And you use that for scripting? > >> > >> Yes; how I typically CPU profile: > >> > >> git clone https://github.com/brendangregg/FlameGraph > >> cd FlameGraph > >> perf record -F 99 -a -g -- sleep 60 > >> perf script | ./stackcollapse-perf.pl | /flamegraph.pl > flame.svg > >> > >> Then open flame.svg in a browser and click around. Try it. :) > > > > So I tried it: > > > > triton:~/s/FlameGraph> ls -l flame.svg > > -rw-rw-r-- 1 mingo mingo 1022870 Oct 10 09:06 flame.svg > > > > but when I tried to view it via ImageMagick, it first showed an empty screen: > > > > triton:~/s/FlameGraph> display flame.svg > > > > then when exiting it said: > > > > display: non-conforming drawing primitive definition `text-anchor' @ error/draw.c/DrawImage/3182. > > > > although I guess that latter is an unrealted ImageMagick problem, not caused by > > the SVG. > > > > Sorry, I should have said to open it in a browser (Chrome/Firefox); > the SVG contains some (entirely embedded) JavaScript to provide > interactivity (click to zoom, Ctrl-F to search). aw, very nice output! Thanks, Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Frederic Weisbecker <fweisbec@gmail.com> |
|---|---|
| Date | 2015-10-12 17:30 +0200 |
| Subject | Re: [PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' |
| Message-ID | <qiNd0-2Xu-13@gated-at.bofh.it> |
| In reply to | #1239964 |
On Mon, Oct 05, 2015 at 06:03:35PM -0300, Arnaldo Carvalho de Melo wrote:
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> Which is the most common default found in other similar tools.
>
> Requested-by: Ingo Molnar <mingo@kernel.org>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Borislav Petkov <bp@suse.de>
> Cc: Chandler Carruth <chandlerc@gmail.com>
> Cc: David Ahern <dsahern@gmail.com>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Jiri Olsa <jolsa@redhat.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Stephane Eranian <eranian@google.com>
> Cc: Wang Nan <wangnan0@huawei.com>
> Link: https://www.youtube.com/watch?v=nXaxk27zwlk
> Link: http://lkml.kernel.org/n/tip-v8lq36aispvdwgxdmt9p9jd9@git.kernel.org
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
> tools/perf/Documentation/perf-report.txt | 2 +-
> tools/perf/builtin-report.c | 4 ++--
> tools/perf/util/util.c | 4 ++--
> 3 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
> index ce499035e6d8..e4fdeeb51123 100644
> --- a/tools/perf/Documentation/perf-report.txt
> +++ b/tools/perf/Documentation/perf-report.txt
> @@ -192,7 +192,7 @@ OPTIONS
> when available. Usually more convenient to use --branch-history
> for this.
>
> - Default: fractal,0.5,callee,function.
> + Default: graph,0.5,caller
>
> --children::
> Accumulate callchain of children to parent entry so that then can
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index b5623639f67d..3b23b25d1589 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -633,7 +633,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
> bool has_br_stack = false;
> int branch_mode = -1;
> bool branch_call_mode = false;
> - char callchain_default_opt[] = "fractal,0.5,callee";
> + char callchain_default_opt[] = "graph,0.5,caller";
I'm a bit worried about that. I find callee order usually useful in most cases.
People tend to run perf to zoom in the culprit of a performance issue.
> const char * const report_usage[] = {
> "perf report [<options>]",
> NULL
> @@ -701,7 +701,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
> "Only display entries with parent-match"),
> OPT_CALLBACK_DEFAULT('g', "call-graph", &report, "output_type,min_percent[,print_limit],call_order[,branch]",
> "Display callchains using output_type (graph, flat, fractal, or none) , min percent threshold, optional print limit, callchain order, key (function or address), add branches. "
> - "Default: fractal,0.5,callee,function", &report_parse_callchain_opt, callchain_default_opt),
> + "Default: graph,0.5,caller", &report_parse_callchain_opt, callchain_default_opt),
> OPT_BOOLEAN(0, "children", &symbol_conf.cumulate_callchain,
> "Accumulate callchains of children and show total overhead as well"),
> OPT_INTEGER(0, "max-stack", &report.max_stack,
> diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
> index ce465b259e52..c1bf9ff210b0 100644
> --- a/tools/perf/util/util.c
> +++ b/tools/perf/util/util.c
> @@ -17,9 +17,9 @@
> #include "callchain.h"
>
> struct callchain_param callchain_param = {
> - .mode = CHAIN_GRAPH_REL,
> + .mode = CHAIN_GRAPH_ABS,
And this worries me as well :-)
> .min_percent = 0.5,
> - .order = ORDER_CALLEE,
> + .order = ORDER_CALLER,
> .key = CCKEY_FUNCTION
> };
>
> --
> 2.1.0
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| Date | 2015-10-13 06:50 +0200 |
| Subject | Re: [PATCH 13/16] perf callchain: Switch default to 'graph,0.5,caller' |
| Message-ID | <qiZHb-4hT-1@gated-at.bofh.it> |
| In reply to | #1239964 |
On Mon, Oct 05, 2015 at 06:03:35PM -0300, Arnaldo Carvalho de Melo wrote:
> From: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> Which is the most common default found in other similar tools.
I think it's more useful to change the default only when --children is
used. And there's a related issue too - please see below link:
https://lkml.org/lkml/2014/8/14/49
Thanks,
Namhyung
>
> Requested-by: Ingo Molnar <mingo@kernel.org>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Borislav Petkov <bp@suse.de>
> Cc: Chandler Carruth <chandlerc@gmail.com>
> Cc: David Ahern <dsahern@gmail.com>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Jiri Olsa <jolsa@redhat.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Stephane Eranian <eranian@google.com>
> Cc: Wang Nan <wangnan0@huawei.com>
> Link: https://www.youtube.com/watch?v=nXaxk27zwlk
> Link: http://lkml.kernel.org/n/tip-v8lq36aispvdwgxdmt9p9jd9@git.kernel.org
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
> tools/perf/Documentation/perf-report.txt | 2 +-
> tools/perf/builtin-report.c | 4 ++--
> tools/perf/util/util.c | 4 ++--
> 3 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
> index ce499035e6d8..e4fdeeb51123 100644
> --- a/tools/perf/Documentation/perf-report.txt
> +++ b/tools/perf/Documentation/perf-report.txt
> @@ -192,7 +192,7 @@ OPTIONS
> when available. Usually more convenient to use --branch-history
> for this.
>
> - Default: fractal,0.5,callee,function.
> + Default: graph,0.5,caller
>
> --children::
> Accumulate callchain of children to parent entry so that then can
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index b5623639f67d..3b23b25d1589 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -633,7 +633,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
> bool has_br_stack = false;
> int branch_mode = -1;
> bool branch_call_mode = false;
> - char callchain_default_opt[] = "fractal,0.5,callee";
> + char callchain_default_opt[] = "graph,0.5,caller";
> const char * const report_usage[] = {
> "perf report [<options>]",
> NULL
> @@ -701,7 +701,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
> "Only display entries with parent-match"),
> OPT_CALLBACK_DEFAULT('g', "call-graph", &report, "output_type,min_percent[,print_limit],call_order[,branch]",
> "Display callchains using output_type (graph, flat, fractal, or none) , min percent threshold, optional print limit, callchain order, key (function or address), add branches. "
> - "Default: fractal,0.5,callee,function", &report_parse_callchain_opt, callchain_default_opt),
> + "Default: graph,0.5,caller", &report_parse_callchain_opt, callchain_default_opt),
> OPT_BOOLEAN(0, "children", &symbol_conf.cumulate_callchain,
> "Accumulate callchains of children and show total overhead as well"),
> OPT_INTEGER(0, "max-stack", &report.max_stack,
> diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
> index ce465b259e52..c1bf9ff210b0 100644
> --- a/tools/perf/util/util.c
> +++ b/tools/perf/util/util.c
> @@ -17,9 +17,9 @@
> #include "callchain.h"
>
> struct callchain_param callchain_param = {
> - .mode = CHAIN_GRAPH_REL,
> + .mode = CHAIN_GRAPH_ABS,
> .min_percent = 0.5,
> - .order = ORDER_CALLEE,
> + .order = ORDER_CALLER,
> .key = CCKEY_FUNCTION
> };
>
> --
> 2.1.0
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2015-10-05 23:10 +0200 |
| Subject | [PATCH 04/16] perf tools: Export perf_event_attr__set_max_precise_ip() |
| Message-ID | <qglbd-2cb-39@gated-at.bofh.it> |
| In reply to | #1239960 |
From: Jiri Olsa <jolsa@kernel.org>
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 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.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2015-10-05 23:10 +0200 |
| Subject | [PATCH 10/16] perf tests: Add arch tests |
| Message-ID | <qglbd-2cb-41@gated-at.bofh.it> |
| In reply to | #1239960 |
From: Matt Fleming <matt.fleming@intel.com>
Tests that only make sense for some architectures currently live in
the same place as the generic tests. Move out the x86-specific tests
into tools/perf/arch/x86/tests and define an 'arch_tests' array, which
is the list of tests that only apply to the build architecture.
The main idea is to encourage developers to add arch tests to build
out perf's test coverage, without dumping everything in
tools/perf/tests.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Kanaka Juvva <kanaka.d.juvva@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Vikas Shivappa <vikas.shivappa@intel.com>
Cc: Vince Weaver <vince@deater.net>
Link: http://lkml.kernel.org/n/tip-p4uc1c15ssbj8xj7ku5slpa6@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/arch/x86/Build | 2 +-
tools/perf/arch/x86/include/arch-tests.h | 6 ++++++
tools/perf/arch/x86/tests/Build | 6 ++++--
tools/perf/arch/x86/tests/arch-tests.c | 10 ++++++++++
tools/perf/tests/builtin-test.c | 28 ++++++++++++++++++++--------
tools/perf/tests/tests.h | 5 +++++
6 files changed, 46 insertions(+), 11 deletions(-)
create mode 100644 tools/perf/arch/x86/include/arch-tests.h
create mode 100644 tools/perf/arch/x86/tests/arch-tests.c
diff --git a/tools/perf/arch/x86/Build b/tools/perf/arch/x86/Build
index 41bf61da476a..db52fa22d3a1 100644
--- a/tools/perf/arch/x86/Build
+++ b/tools/perf/arch/x86/Build
@@ -1,2 +1,2 @@
libperf-y += util/
-libperf-$(CONFIG_DWARF_UNWIND) += tests/
+libperf-y += tests/
diff --git a/tools/perf/arch/x86/include/arch-tests.h b/tools/perf/arch/x86/include/arch-tests.h
new file mode 100644
index 000000000000..4bd41d8e1ca4
--- /dev/null
+++ b/tools/perf/arch/x86/include/arch-tests.h
@@ -0,0 +1,6 @@
+#ifndef ARCH_TESTS_H
+#define ARCH_TESTS_H
+
+extern struct test arch_tests[];
+
+#endif
diff --git a/tools/perf/arch/x86/tests/Build b/tools/perf/arch/x86/tests/Build
index b30eff9bcc83..d827ef384b33 100644
--- a/tools/perf/arch/x86/tests/Build
+++ b/tools/perf/arch/x86/tests/Build
@@ -1,2 +1,4 @@
-libperf-y += regs_load.o
-libperf-y += dwarf-unwind.o
+libperf-$(CONFIG_DWARF_UNWIND) += regs_load.o
+libperf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
+
+libperf-y += arch-tests.o
diff --git a/tools/perf/arch/x86/tests/arch-tests.c b/tools/perf/arch/x86/tests/arch-tests.c
new file mode 100644
index 000000000000..fca9eb9d39a2
--- /dev/null
+++ b/tools/perf/arch/x86/tests/arch-tests.c
@@ -0,0 +1,10 @@
+#include <string.h>
+#include "tests/tests.h"
+#include "arch-tests.h"
+
+struct test arch_tests[] = {
+ {
+ .func = NULL,
+ },
+
+};
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index d9bf51dc8cf5..2b6c1bf13456 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -14,10 +14,13 @@
#include "parse-options.h"
#include "symbol.h"
-static struct test {
- const char *desc;
- int (*func)(void);
-} tests[] = {
+struct test __weak arch_tests[] = {
+ {
+ .func = NULL,
+ },
+};
+
+static struct test generic_tests[] = {
{
.desc = "vmlinux symtab matches kallsyms",
.func = test__vmlinux_matches_kallsyms,
@@ -195,6 +198,11 @@ static struct test {
},
};
+static struct test *tests[] = {
+ generic_tests,
+ arch_tests,
+};
+
static bool perf_test__matches(struct test *test, int curr, int argc, const char *argv[])
{
int i;
@@ -249,22 +257,25 @@ static int run_test(struct test *test)
return err;
}
-#define for_each_test(t) for (t = &tests[0]; t->func; t++)
+#define for_each_test(j, t) \
+ for (j = 0; j < ARRAY_SIZE(tests); j++) \
+ for (t = &tests[j][0]; t->func; t++)
static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist)
{
struct test *t;
+ unsigned int j;
int i = 0;
int width = 0;
- for_each_test(t) {
+ for_each_test(j, t) {
int len = strlen(t->desc);
if (width < len)
width = len;
}
- for_each_test(t) {
+ for_each_test(j, t) {
int curr = i++, err;
if (!perf_test__matches(t, curr, argc, argv))
@@ -300,10 +311,11 @@ static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist)
static int perf_test__list(int argc, const char **argv)
{
+ unsigned int j;
struct test *t;
int i = 0;
- for_each_test(t) {
+ for_each_test(j, t) {
if (argc > 1 && !strstr(t->desc, argv[1]))
continue;
diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h
index 0b3549672c16..b1cb1c081e3c 100644
--- a/tools/perf/tests/tests.h
+++ b/tools/perf/tests/tests.h
@@ -24,6 +24,11 @@ enum {
TEST_SKIP = -2,
};
+struct test {
+ const char *desc;
+ int (*func)(void);
+};
+
/* Tests */
int test__vmlinux_matches_kallsyms(void);
int test__openat_syscall_event(void);
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2015-10-05 23:10 +0200 |
| Subject | [PATCH 09/16] perf tools: Handle -h and -v options |
| Message-ID | <qglbd-2cb-43@gated-at.bofh.it> |
| In reply to | #1239960 |
From: Jiri Olsa <jolsa@kernel.org>
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 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.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2015-10-05 23:10 +0200 |
| Subject | [PATCH 07/16] perf tools: Add support for sorting on the iaddr |
| Message-ID | <qglbd-2cb-49@gated-at.bofh.it> |
| In reply to | #1239960 |
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>
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 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.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Date | 2015-10-05 23:10 +0200 |
| Subject | [PATCH 12/16] perf tests: Add Intel CQM test |
| Message-ID | <qglbd-2cb-53@gated-at.bofh.it> |
| In reply to | #1239960 |
From: Matt Fleming <matt.fleming@intel.com>
Peter reports that it's possible to trigger a WARN_ON_ONCE() in the
Intel CQM code by combining a hardware event and an Intel CQM
(software) event into a group. Unfortunately, the perf tools are not
able to create this bundle and we need to manually construct a test
case.
For posterity, record Peter's proof of concept test case in tools/perf
so that it presents a model for how we can perform architecture
specific tests, or "arch tests", in perf in the future.
The particular issue triggered in the test case is that when the
counter for the hardware event overflows and triggers a PMI we'll read
both the hardware event and the software event counters.
Unfortunately, for CQM that involves performing an IPI to read the CQM
event counters on all sockets, which in NMI context triggers the
WARN_ON_ONCE().
Reported-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Kanaka Juvva <kanaka.d.juvva@intel.com>
Cc: Vikas Shivappa <vikas.shivappa@intel.com>
Cc: Vince Weaver <vince@deater.net>
Link: http://lkml.kernel.org/r/1437490509-15373-1-git-send-email-matt@codeblueprint.co.uk
Link: http://lkml.kernel.org/n/tip-3p4ra0u8vzm7m289a1m799kf@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/arch/x86/include/arch-tests.h | 1 +
tools/perf/arch/x86/tests/Build | 1 +
tools/perf/arch/x86/tests/arch-tests.c | 4 +
tools/perf/arch/x86/tests/intel-cqm.c | 124 +++++++++++++++++++++++++++++++
4 files changed, 130 insertions(+)
create mode 100644 tools/perf/arch/x86/tests/intel-cqm.c
diff --git a/tools/perf/arch/x86/include/arch-tests.h b/tools/perf/arch/x86/include/arch-tests.h
index 5927cf224325..7ed00f4b0908 100644
--- a/tools/perf/arch/x86/include/arch-tests.h
+++ b/tools/perf/arch/x86/include/arch-tests.h
@@ -5,6 +5,7 @@
int test__rdpmc(void);
int test__perf_time_to_tsc(void);
int test__insn_x86(void);
+int test__intel_cqm_count_nmi_context(void);
#ifdef HAVE_DWARF_UNWIND_SUPPORT
struct thread;
diff --git a/tools/perf/arch/x86/tests/Build b/tools/perf/arch/x86/tests/Build
index 8e2c5a38c3b9..cbb7e978166b 100644
--- a/tools/perf/arch/x86/tests/Build
+++ b/tools/perf/arch/x86/tests/Build
@@ -5,3 +5,4 @@ libperf-y += arch-tests.o
libperf-y += rdpmc.o
libperf-y += perf-time-to-tsc.o
libperf-$(CONFIG_AUXTRACE) += insn-x86.o
+libperf-y += intel-cqm.o
diff --git a/tools/perf/arch/x86/tests/arch-tests.c b/tools/perf/arch/x86/tests/arch-tests.c
index d116c217af99..2218cb64f840 100644
--- a/tools/perf/arch/x86/tests/arch-tests.c
+++ b/tools/perf/arch/x86/tests/arch-tests.c
@@ -24,6 +24,10 @@ struct test arch_tests[] = {
},
#endif
{
+ .desc = "Test intel cqm nmi context read",
+ .func = test__intel_cqm_count_nmi_context,
+ },
+ {
.func = NULL,
},
diff --git a/tools/perf/arch/x86/tests/intel-cqm.c b/tools/perf/arch/x86/tests/intel-cqm.c
new file mode 100644
index 000000000000..d28c1b6a3b54
--- /dev/null
+++ b/tools/perf/arch/x86/tests/intel-cqm.c
@@ -0,0 +1,124 @@
+#include "tests/tests.h"
+#include "perf.h"
+#include "cloexec.h"
+#include "debug.h"
+#include "evlist.h"
+#include "evsel.h"
+#include "arch-tests.h"
+
+#include <sys/mman.h>
+#include <string.h>
+
+static pid_t spawn(void)
+{
+ pid_t pid;
+
+ pid = fork();
+ if (pid)
+ return pid;
+
+ while(1);
+ sleep(5);
+ return 0;
+}
+
+/*
+ * Create an event group that contains both a sampled hardware
+ * (cpu-cycles) and software (intel_cqm/llc_occupancy/) event. We then
+ * wait for the hardware perf counter to overflow and generate a PMI,
+ * which triggers an event read for both of the events in the group.
+ *
+ * Since reading Intel CQM event counters requires sending SMP IPIs, the
+ * CQM pmu needs to handle the above situation gracefully, and return
+ * the last read counter value to avoid triggering a WARN_ON_ONCE() in
+ * smp_call_function_many() caused by sending IPIs from NMI context.
+ */
+int test__intel_cqm_count_nmi_context(void)
+{
+ struct perf_evlist *evlist = NULL;
+ struct perf_evsel *evsel = NULL;
+ struct perf_event_attr pe;
+ int i, fd[2], flag, ret;
+ size_t mmap_len;
+ void *event;
+ pid_t pid;
+ int err = TEST_FAIL;
+
+ flag = perf_event_open_cloexec_flag();
+
+ evlist = perf_evlist__new();
+ if (!evlist) {
+ pr_debug("perf_evlist__new failed\n");
+ return TEST_FAIL;
+ }
+
+ ret = parse_events(evlist, "intel_cqm/llc_occupancy/", NULL);
+ if (ret) {
+ pr_debug("parse_events failed\n");
+ err = TEST_SKIP;
+ goto out;
+ }
+
+ evsel = perf_evlist__first(evlist);
+ if (!evsel) {
+ pr_debug("perf_evlist__first failed\n");
+ goto out;
+ }
+
+ memset(&pe, 0, sizeof(pe));
+ pe.size = sizeof(pe);
+
+ pe.type = PERF_TYPE_HARDWARE;
+ pe.config = PERF_COUNT_HW_CPU_CYCLES;
+ pe.read_format = PERF_FORMAT_GROUP;
+
+ pe.sample_period = 128;
+ pe.sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_READ;
+
+ pid = spawn();
+
+ fd[0] = sys_perf_event_open(&pe, pid, -1, -1, flag);
+ if (fd[0] < 0) {
+ pr_debug("failed to open event\n");
+ goto out;
+ }
+
+ memset(&pe, 0, sizeof(pe));
+ pe.size = sizeof(pe);
+
+ pe.type = evsel->attr.type;
+ pe.config = evsel->attr.config;
+
+ fd[1] = sys_perf_event_open(&pe, pid, -1, fd[0], flag);
+ if (fd[1] < 0) {
+ pr_debug("failed to open event\n");
+ goto out;
+ }
+
+ /*
+ * Pick a power-of-two number of pages + 1 for the meta-data
+ * page (struct perf_event_mmap_page). See tools/perf/design.txt.
+ */
+ mmap_len = page_size * 65;
+
+ event = mmap(NULL, mmap_len, PROT_READ, MAP_SHARED, fd[0], 0);
+ if (event == (void *)(-1)) {
+ pr_debug("failed to mmap %d\n", errno);
+ goto out;
+ }
+
+ sleep(1);
+
+ err = TEST_OK;
+
+ munmap(event, mmap_len);
+
+ for (i = 0; i < 2; i++)
+ close(fd[i]);
+
+ kill(pid, SIGKILL);
+ wait(NULL);
+out:
+ perf_evlist__delete(evlist);
+ return err;
+}
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Date | 2015-10-06 09:10 +0200 |
| Message-ID | <qguxQ-7kY-25@gated-at.bofh.it> |
| In reply to | #1239960 |
* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> Hi Ingo,
>
> Please consider pulling,
>
> - Arnaldo
>
> The following changes since commit e3b0ac1b7a8a590440a2030e7d10d48c59ab8a2a:
>
> Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2015-10-03 08:20:14 +0200)
>
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo
>
> for you to fetch changes up to 27bf90bf0690f55c3679bcc4c325823cf1cfd19d:
>
> perf tools: Fail properly in case pattern matching fails to find tracepoint (2015-10-05 17:59:50 -0300)
>
> ----------------------------------------------------------------
> perf/core improvements and fixes:
>
> User visible:
>
> - Switch the default callchain output mode to 'graph,0.5,caller', to make it
> look like the default for other tools, reducing the learning curve for
> people used to 'caller' based viewing (Arnaldo Carvalho de Melo)
>
> - Implement column based horizontal scrolling in the hists browser (top, report),
> making it possible to use the TUI for things like 'perf mem report' where
> there are many more columns than can fit in a terminal (Arnaldo Carvalho de Melo)
>
> - Support sorting by symbol_iaddr with perf.data files produced by
> 'perf mem record' (Don Zickus)
>
> - Display DATA_SRC sample type bit, i.e. when running 'perf evlist -v' the
> "DATA_SRC" wasn't appearing when set, fix it to look like: (Jiri Olsa)
>
> cpu/mem-loads/pp: ...SNIP... sample_type: IP|TID|TIME|ADDR|CPU|PERIOD|DATA_SRC
>
> - Introduce 'P' event modified, meaning 'max precision level, please', i.e.:
>
> $ perf record -e cycles:P usleep 1
>
> Is now similar to:
>
> $ perf record usleep 1
>
> Useful, for instance, when specifying multiple events (Jiri Olsa)
>
> - Make 'perf -v' and 'perf -h' work (Jiri Olsa)
>
> - Fail properly when pattern matching fails to find a tracepoint, i.e.
> '-e non:existent' was being correctly handled, with a proper error message
> about that not being a valid event, but '-e non:existent*' wasn't,
> fix it (Jiri Olsa)
>
> Infrastructure:
>
> - Separate arch specific entries in 'perf test' and add an 'Intel CQM' one
> to be fun on x86 only (Matt Fleming)
>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> ----------------------------------------------------------------
> Arnaldo Carvalho de Melo (3):
> perf callchain: Switch default to 'graph,0.5,caller'
> perf ui browser: Optional horizontal scrolling key binding
> perf hists browser: Implement horizontal scrolling
>
> Don Zickus (1):
> perf tools: Add support for sorting on the iaddr
>
> Jiri Olsa (9):
> tools lib api fs: No need to use PATH_MAX + 1
> perf evlist: Display DATA_SRC sample type bit
> perf annotate: Fix sizeof_sym_hist overflow issue
> perf tools: Export perf_event_attr__set_max_precise_ip()
> perf tools: Introduce 'P' modifier to request max precision
> perf tests: Add parsing test for 'P' modifier
> perf tools: Setup proper width for symbol_iaddr field
> perf tools: Handle -h and -v options
> perf tools: Fail properly in case pattern matching fails to find tracepoint
>
> Matt Fleming (3):
> perf tests: Add arch tests
> perf tests: Move x86 tests into arch directory
> perf tests: Add Intel CQM test
>
> 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-report.txt | 2 +-
> tools/perf/Documentation/perf.txt | 8 ++
> tools/perf/arch/x86/Build | 2 +-
> tools/perf/arch/x86/include/arch-tests.h | 19 ++++
> tools/perf/arch/x86/tests/Build | 10 +-
> tools/perf/arch/x86/tests/arch-tests.c | 34 ++++++
> tools/perf/arch/x86/tests/dwarf-unwind.c | 1 +
> .../perf/{ => arch/x86}/tests/gen-insn-x86-dat.awk | 0
> .../perf/{ => arch/x86}/tests/gen-insn-x86-dat.sh | 0
> tools/perf/{ => arch/x86}/tests/insn-x86-dat-32.c | 0
> tools/perf/{ => arch/x86}/tests/insn-x86-dat-64.c | 0
> tools/perf/{ => arch/x86}/tests/insn-x86-dat-src.c | 0
> tools/perf/{ => arch/x86}/tests/insn-x86.c | 3 +-
> tools/perf/arch/x86/tests/intel-cqm.c | 124 +++++++++++++++++++++
> tools/perf/{ => arch/x86}/tests/perf-time-to-tsc.c | 4 +-
> tools/perf/{ => arch/x86}/tests/rdpmc.c | 7 +-
> tools/perf/builtin-report.c | 4 +-
> tools/perf/perf.c | 14 +++
> tools/perf/tests/Build | 6 -
> tools/perf/tests/builtin-test.c | 56 ++++------
> tools/perf/tests/dwarf-unwind.c | 4 +
> tools/perf/tests/parse-events.c | 16 +++
> tools/perf/tests/tests.h | 10 +-
> tools/perf/ui/browser.c | 14 +++
> tools/perf/ui/browser.h | 2 +-
> tools/perf/ui/browsers/hists.c | 22 +++-
> 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 | 17 ++-
> tools/perf/util/parse-events.l | 2 +-
> tools/perf/util/sort.c | 37 ++++++
> tools/perf/util/sort.h | 1 +
> tools/perf/util/util.c | 4 +-
> 41 files changed, 381 insertions(+), 77 deletions(-)
> create mode 100644 tools/perf/arch/x86/include/arch-tests.h
> create mode 100644 tools/perf/arch/x86/tests/arch-tests.c
> rename tools/perf/{ => arch/x86}/tests/gen-insn-x86-dat.awk (100%)
> rename tools/perf/{ => arch/x86}/tests/gen-insn-x86-dat.sh (100%)
> rename tools/perf/{ => arch/x86}/tests/insn-x86-dat-32.c (100%)
> rename tools/perf/{ => arch/x86}/tests/insn-x86-dat-64.c (100%)
> rename tools/perf/{ => arch/x86}/tests/insn-x86-dat-src.c (100%)
> rename tools/perf/{ => arch/x86}/tests/insn-x86.c (98%)
> create mode 100644 tools/perf/arch/x86/tests/intel-cqm.c
> rename tools/perf/{ => arch/x86}/tests/perf-time-to-tsc.c (98%)
> rename tools/perf/{ => arch/x86}/tests/rdpmc.c (97%)
Pulled, thanks a lot Arnaldo!
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web