* [PATCH 0/6] perf c2c report: Change default HITM sort/display
@ 2016-11-21 21:33 Jiri Olsa
2016-11-21 21:33 ` [PATCH 1/6] perf tools: Show event fd in debug output Jiri Olsa
` (5 more replies)
0 siblings, 6 replies; 13+ messages in thread
From: Jiri Olsa @ 2016-11-21 21:33 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, Don Zickus, Joe Mario, Ingo Molnar, Peter Zijlstra,
Namhyung Kim, David Ahern, Andi Kleen
hi,
sending the c2c default HITM sort/display fix (patch 4,5) plus
few other small fixes.
Also available in here:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
perf/fixes
thanks,
jirka
---
Jiri Olsa (6):
perf tools: Show event fd in debug output
perf c2c report: Setup browser after opening perf.data
perf c2c report: Add -f/--force option
perf c2c report: Add struct c2c_stats::tot_hitm field
perf c2c report: Display total HITMs on default
perf c2c: Support cascading options
tools/perf/Documentation/perf-c2c.txt | 8 ++++++++
tools/perf/builtin-c2c.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------
tools/perf/util/evsel.c | 6 ++++--
tools/perf/util/mem-events.c | 12 ++++++++++--
tools/perf/util/mem-events.h | 1 +
5 files changed, 76 insertions(+), 31 deletions(-)
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/6] perf tools: Show event fd in debug output
2016-11-21 21:33 [PATCH 0/6] perf c2c report: Change default HITM sort/display Jiri Olsa
@ 2016-11-21 21:33 ` Jiri Olsa
2016-11-24 4:15 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-11-21 21:33 ` [PATCH 2/6] perf c2c report: Setup browser after opening perf.data Jiri Olsa
` (4 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Jiri Olsa @ 2016-11-21 21:33 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, Don Zickus, Joe Mario, Ingo Molnar, Peter Zijlstra,
Namhyung Kim, David Ahern, Andi Kleen
It was useful for debug to see file descriptors for each event.
Before:
$ perf stat -vvv -e cycles,cache-misses ls
...
sys_perf_event_open: pid 12146 cpu -1 group_fd -1 flags 0x8
...
sys_perf_event_open: pid 12146 cpu -1 group_fd 3 flags 0x8
sys_perf_event_open failed, error -13
Now:
$ perf stat -vvv -e cycles,cache-misses ls
...
sys_perf_event_open: pid 12858 cpu -1 group_fd -1 flags 0x8 = 3
...
sys_perf_event_open: pid 12858 cpu -1 group_fd 3 flags 0x8
sys_perf_event_open failed, error -13
Link: http://lkml.kernel.org/n/tip-7drsvjamul8bawh8ga1vpnx1@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
tools/perf/util/evsel.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index e58a2fbf3b16..b2365a63db45 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1481,7 +1481,7 @@ static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
group_fd = get_group_fd(evsel, cpu, thread);
retry_open:
- pr_debug2("sys_perf_event_open: pid %d cpu %d group_fd %d flags %#lx\n",
+ pr_debug2("sys_perf_event_open: pid %d cpu %d group_fd %d flags %#lx",
pid, cpus->map[cpu], group_fd, flags);
FD(evsel, cpu, thread) = sys_perf_event_open(&evsel->attr,
@@ -1490,11 +1490,13 @@ static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
group_fd, flags);
if (FD(evsel, cpu, thread) < 0) {
err = -errno;
- pr_debug2("sys_perf_event_open failed, error %d\n",
+ pr_debug2("\nsys_perf_event_open failed, error %d\n",
err);
goto try_fallback;
}
+ pr_debug2(" = %d\n", FD(evsel, cpu, thread));
+
if (evsel->bpf_fd >= 0) {
int evt_fd = FD(evsel, cpu, thread);
int bpf_fd = evsel->bpf_fd;
--
2.7.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/6] perf c2c report: Setup browser after opening perf.data
2016-11-21 21:33 [PATCH 0/6] perf c2c report: Change default HITM sort/display Jiri Olsa
2016-11-21 21:33 ` [PATCH 1/6] perf tools: Show event fd in debug output Jiri Olsa
@ 2016-11-21 21:33 ` Jiri Olsa
2016-11-24 4:16 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-11-21 21:33 ` [PATCH 3/6] perf c2c report: Add -f/--force option Jiri Olsa
` (3 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Jiri Olsa @ 2016-11-21 21:33 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, Don Zickus, Joe Mario, Ingo Molnar, Peter Zijlstra,
Namhyung Kim, David Ahern, Andi Kleen
Because of the early browser switch we won't get possible
error messages, like for:
$ sudo perf c2c report -d lcl
File perf.data not owned by current user or root (use -f to override)
Link: http://lkml.kernel.org/n/tip-hn3lrw728ealu38e2gfanhs0@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
tools/perf/builtin-c2c.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index c6d0dda594d9..15addb06d611 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -2535,13 +2535,6 @@ static int perf_c2c__report(int argc, const char **argv)
if (c2c.stats_only)
c2c.use_stdio = true;
- if (c2c.use_stdio)
- use_browser = 0;
- else
- use_browser = 1;
-
- setup_browser(false);
-
if (!input_name || !strlen(input_name))
input_name = "perf.data";
@@ -2568,6 +2561,7 @@ static int perf_c2c__report(int argc, const char **argv)
pr_debug("No memory for session\n");
goto out;
}
+
err = setup_nodes(session);
if (err) {
pr_err("Failed setup nodes\n");
@@ -2587,6 +2581,13 @@ static int perf_c2c__report(int argc, const char **argv)
goto out_session;
}
+ if (c2c.use_stdio)
+ use_browser = 0;
+ else
+ use_browser = 1;
+
+ setup_browser(false);
+
err = perf_session__process_events(session);
if (err) {
pr_err("failed to process sample\n");
--
2.7.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/6] perf c2c report: Add -f/--force option
2016-11-21 21:33 [PATCH 0/6] perf c2c report: Change default HITM sort/display Jiri Olsa
2016-11-21 21:33 ` [PATCH 1/6] perf tools: Show event fd in debug output Jiri Olsa
2016-11-21 21:33 ` [PATCH 2/6] perf c2c report: Setup browser after opening perf.data Jiri Olsa
@ 2016-11-21 21:33 ` Jiri Olsa
2016-11-24 4:16 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-11-21 21:33 ` [PATCH 4/6] perf c2c report: Add struct c2c_stats::tot_hitm field Jiri Olsa
` (2 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Jiri Olsa @ 2016-11-21 21:33 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, Don Zickus, Joe Mario, Ingo Molnar, Peter Zijlstra,
Namhyung Kim, David Ahern, Andi Kleen
Adding -f/--force option to go through ownership validation:
$ sudo perf c2c report
File perf.data not owned by current user or root (use -f to override)
$ sudo perf c2c report -f
Link: http://lkml.kernel.org/n/tip-p035bwv1lr24lf6n5apt2lwn@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
tools/perf/Documentation/perf-c2c.txt | 4 ++++
tools/perf/builtin-c2c.c | 4 +++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/tools/perf/Documentation/perf-c2c.txt b/tools/perf/Documentation/perf-c2c.txt
index 21810d711f5f..5eda9336267e 100644
--- a/tools/perf/Documentation/perf-c2c.txt
+++ b/tools/perf/Documentation/perf-c2c.txt
@@ -100,6 +100,10 @@ REPORT OPTIONS
--show-all::
Show all captured HITM lines, with no regard to HITM % 0.0005 limit.
+-f::
+--force::
+ Don't do ownership validation.
+
C2C RECORD
----------
The perf c2c record command setup options related to HITM cacheline analysis
diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index 15addb06d611..d873977b8fb6 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -2523,6 +2523,7 @@ static int perf_c2c__report(int argc, const char **argv)
OPT_STRING('d', "display", &display, NULL, "lcl,rmt"),
OPT_STRING('c', "coalesce", &coalesce, "coalesce fields",
"coalesce fields: pid,tid,iaddr,dso"),
+ OPT_BOOLEAN('f', "force", &symbol_conf.force, "don't complain, do it"),
OPT_END()
};
int err = 0;
@@ -2538,7 +2539,8 @@ static int perf_c2c__report(int argc, const char **argv)
if (!input_name || !strlen(input_name))
input_name = "perf.data";
- file.path = input_name;
+ file.path = input_name;
+ file.force = symbol_conf.force;
err = setup_display(display);
if (err)
--
2.7.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 4/6] perf c2c report: Add struct c2c_stats::tot_hitm field
2016-11-21 21:33 [PATCH 0/6] perf c2c report: Change default HITM sort/display Jiri Olsa
` (2 preceding siblings ...)
2016-11-21 21:33 ` [PATCH 3/6] perf c2c report: Add -f/--force option Jiri Olsa
@ 2016-11-21 21:33 ` Jiri Olsa
2016-11-24 4:16 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-11-21 21:33 ` [PATCH 5/6] perf c2c report: Display total HITMs on default Jiri Olsa
2016-11-21 21:33 ` [PATCH 6/6] perf c2c: Support cascading options Jiri Olsa
5 siblings, 1 reply; 13+ messages in thread
From: Jiri Olsa @ 2016-11-21 21:33 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, Don Zickus, Joe Mario, Ingo Molnar, Peter Zijlstra,
Namhyung Kim, David Ahern, Andi Kleen
Counting total HITMs in special field. This will ease
up addition of total HITM sorting into c2c report in
following patch.
Link: http://lkml.kernel.org/n/tip-wkmgepbip59wui4pnm6yjvam@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
tools/perf/util/mem-events.c | 12 ++++++++++--
tools/perf/util/mem-events.h | 1 +
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c
index e50773286ef6..1d4ab53c60ca 100644
--- a/tools/perf/util/mem-events.c
+++ b/tools/perf/util/mem-events.c
@@ -280,6 +280,12 @@ int c2c_decode_stats(struct c2c_stats *stats, struct mem_info *mi)
u64 lock = data_src->mem_lock;
int err = 0;
+#define HITM_INC(__f) \
+do { \
+ stats->__f++; \
+ stats->tot_hitm++; \
+} while (0)
+
#define P(a, b) PERF_MEM_##a##_##b
stats->nr_entries++;
@@ -303,7 +309,7 @@ int c2c_decode_stats(struct c2c_stats *stats, struct mem_info *mi)
if (lvl & P(LVL, L2 )) stats->ld_l2hit++;
if (lvl & P(LVL, L3 )) {
if (snoop & P(SNOOP, HITM))
- stats->lcl_hitm++;
+ HITM_INC(lcl_hitm);
else
stats->ld_llchit++;
}
@@ -331,7 +337,7 @@ int c2c_decode_stats(struct c2c_stats *stats, struct mem_info *mi)
if (snoop & P(SNOOP, HIT))
stats->rmt_hit++;
else if (snoop & P(SNOOP, HITM))
- stats->rmt_hitm++;
+ HITM_INC(rmt_hitm);
}
if ((lvl & P(LVL, MISS)))
@@ -364,6 +370,7 @@ int c2c_decode_stats(struct c2c_stats *stats, struct mem_info *mi)
}
#undef P
+#undef HITM_INC
return err;
}
@@ -390,6 +397,7 @@ void c2c_add_stats(struct c2c_stats *stats, struct c2c_stats *add)
stats->ld_llchit += add->ld_llchit;
stats->lcl_hitm += add->lcl_hitm;
stats->rmt_hitm += add->rmt_hitm;
+ stats->tot_hitm += add->tot_hitm;
stats->rmt_hit += add->rmt_hit;
stats->lcl_dram += add->lcl_dram;
stats->rmt_dram += add->rmt_dram;
diff --git a/tools/perf/util/mem-events.h b/tools/perf/util/mem-events.h
index faf80403b519..40f72ee4f42a 100644
--- a/tools/perf/util/mem-events.h
+++ b/tools/perf/util/mem-events.h
@@ -59,6 +59,7 @@ struct c2c_stats {
u32 ld_llchit; /* count of loads that hit LLC */
u32 lcl_hitm; /* count of loads with local HITM */
u32 rmt_hitm; /* count of loads with remote HITM */
+ u32 tot_hitm; /* count of loads with local and remote HITM */
u32 rmt_hit; /* count of loads with remote hit clean; */
u32 lcl_dram; /* count of loads miss to local DRAM */
u32 rmt_dram; /* count of loads miss to remote DRAM */
--
2.7.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 5/6] perf c2c report: Display total HITMs on default
2016-11-21 21:33 [PATCH 0/6] perf c2c report: Change default HITM sort/display Jiri Olsa
` (3 preceding siblings ...)
2016-11-21 21:33 ` [PATCH 4/6] perf c2c report: Add struct c2c_stats::tot_hitm field Jiri Olsa
@ 2016-11-21 21:33 ` Jiri Olsa
2016-11-24 4:17 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-11-21 21:33 ` [PATCH 6/6] perf c2c: Support cascading options Jiri Olsa
5 siblings, 1 reply; 13+ messages in thread
From: Jiri Olsa @ 2016-11-21 21:33 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, Don Zickus, Joe Mario, Ingo Molnar, Peter Zijlstra,
Namhyung Kim, David Ahern, Andi Kleen
Currently we display cacheline list sorted on remote HITMs by default.
The problem is that they might not be always counted and 'perf c2c report'
displays empty output. Thus it's more convenient to display and sort
cacheline list based on total HITMs and have the best change to see data
in default report run.
Link: http://lkml.kernel.org/n/tip-wkmgepbip59wui4pnm6yjvam@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
tools/perf/Documentation/perf-c2c.txt | 4 ++++
tools/perf/builtin-c2c.c | 39 ++++++++++++++++++++++++++++-------
2 files changed, 36 insertions(+), 7 deletions(-)
diff --git a/tools/perf/Documentation/perf-c2c.txt b/tools/perf/Documentation/perf-c2c.txt
index 5eda9336267e..3f06730c7f47 100644
--- a/tools/perf/Documentation/perf-c2c.txt
+++ b/tools/perf/Documentation/perf-c2c.txt
@@ -104,6 +104,10 @@ REPORT OPTIONS
--force::
Don't do ownership validation.
+-d::
+--display::
+ Siwtch to HITM type (rmt, lcl) to display and sort on. Total HITMs as default.
+
C2C RECORD
----------
The perf c2c record command setup options related to HITM cacheline analysis
diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index d873977b8fb6..54924717ae8e 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -91,6 +91,14 @@ struct perf_c2c {
enum {
DISPLAY_LCL,
DISPLAY_RMT,
+ DISPLAY_TOT,
+ DISPLAY_MAX,
+};
+
+static const char *display_str[DISPLAY_MAX] = {
+ [DISPLAY_LCL] = "Local",
+ [DISPLAY_RMT] = "Remote",
+ [DISPLAY_TOT] = "Total",
};
static struct perf_c2c c2c;
@@ -745,6 +753,10 @@ static double percent_hitm(struct c2c_hist_entry *c2c_he)
case DISPLAY_LCL:
st = stats->lcl_hitm;
tot = total->lcl_hitm;
+ break;
+ case DISPLAY_TOT:
+ st = stats->tot_hitm;
+ tot = total->tot_hitm;
default:
break;
}
@@ -1044,6 +1056,9 @@ node_entry(struct perf_hpp_fmt *fmt __maybe_unused, struct perf_hpp *hpp,
break;
case DISPLAY_LCL:
DISPLAY_HITM(lcl_hitm);
+ break;
+ case DISPLAY_TOT:
+ DISPLAY_HITM(tot_hitm);
default:
break;
}
@@ -1351,6 +1366,7 @@ static struct c2c_dimension dim_tot_loads = {
static struct c2c_header percent_hitm_header[] = {
[DISPLAY_LCL] = HEADER_BOTH("Lcl", "Hitm"),
[DISPLAY_RMT] = HEADER_BOTH("Rmt", "Hitm"),
+ [DISPLAY_TOT] = HEADER_BOTH("Tot", "Hitm"),
};
static struct c2c_dimension dim_percent_hitm = {
@@ -1794,6 +1810,9 @@ static bool he__display(struct hist_entry *he, struct c2c_stats *stats)
break;
case DISPLAY_RMT:
FILTER_HITM(rmt_hitm);
+ break;
+ case DISPLAY_TOT:
+ FILTER_HITM(tot_hitm);
default:
break;
};
@@ -1809,8 +1828,9 @@ static inline int valid_hitm_or_store(struct hist_entry *he)
bool has_hitm;
c2c_he = container_of(he, struct c2c_hist_entry, he);
- has_hitm = c2c.display == DISPLAY_LCL ?
- c2c_he->stats.lcl_hitm : c2c_he->stats.rmt_hitm;
+ has_hitm = c2c.display == DISPLAY_TOT ? c2c_he->stats.tot_hitm :
+ c2c.display == DISPLAY_LCL ? c2c_he->stats.lcl_hitm :
+ c2c_he->stats.rmt_hitm;
return has_hitm || c2c_he->stats.store;
}
@@ -2095,7 +2115,7 @@ static void print_c2c_info(FILE *out, struct perf_session *session)
first = false;
}
fprintf(out, " Cachelines sort on : %s HITMs\n",
- c2c.display == DISPLAY_LCL ? "Local" : "Remote");
+ display_str[c2c.display]);
fprintf(out, " Cacheline data grouping : %s\n", c2c.cl_sort);
}
@@ -2250,7 +2270,7 @@ static int perf_c2c_browser__title(struct hist_browser *browser,
"Shared Data Cache Line Table "
"(%lu entries, sorted on %s HITMs)",
browser->nr_non_filtered_entries,
- c2c.display == DISPLAY_LCL ? "local" : "remote");
+ display_str[c2c.display]);
return 0;
}
@@ -2387,9 +2407,11 @@ static int setup_callchain(struct perf_evlist *evlist)
static int setup_display(const char *str)
{
- const char *display = str ?: "rmt";
+ const char *display = str ?: "tot";
- if (!strcmp(display, "rmt"))
+ if (!strcmp(display, "tot"))
+ c2c.display = DISPLAY_TOT;
+ else if (!strcmp(display, "rmt"))
c2c.display = DISPLAY_RMT;
else if (!strcmp(display, "lcl"))
c2c.display = DISPLAY_LCL;
@@ -2474,6 +2496,8 @@ static int setup_coalesce(const char *coalesce, bool no_source)
return -1;
if (asprintf(&c2c.cl_resort, "offset,%s",
+ c2c.display == DISPLAY_TOT ?
+ "tot_hitm" :
c2c.display == DISPLAY_RMT ?
"rmt_hitm,lcl_hitm" :
"lcl_hitm,rmt_hitm") < 0)
@@ -2520,7 +2544,7 @@ static int perf_c2c__report(int argc, const char **argv)
"print_type,threshold[,print_limit],order,sort_key[,branch],value",
callchain_help, &parse_callchain_opt,
callchain_default_opt),
- OPT_STRING('d', "display", &display, NULL, "lcl,rmt"),
+ OPT_STRING('d', "display", &display, "Switch HITM output type", "lcl,rmt"),
OPT_STRING('c', "coalesce", &coalesce, "coalesce fields",
"coalesce fields: pid,tid,iaddr,dso"),
OPT_BOOLEAN('f', "force", &symbol_conf.force, "don't complain, do it"),
@@ -2608,6 +2632,7 @@ static int perf_c2c__report(int argc, const char **argv)
"tot_loads,"
"ld_fbhit,ld_l1hit,ld_l2hit,"
"ld_lclhit,ld_rmthit",
+ c2c.display == DISPLAY_TOT ? "tot_hitm" :
c2c.display == DISPLAY_LCL ? "lcl_hitm" : "rmt_hitm"
);
--
2.7.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 6/6] perf c2c: Support cascading options
2016-11-21 21:33 [PATCH 0/6] perf c2c report: Change default HITM sort/display Jiri Olsa
` (4 preceding siblings ...)
2016-11-21 21:33 ` [PATCH 5/6] perf c2c report: Display total HITMs on default Jiri Olsa
@ 2016-11-21 21:33 ` Jiri Olsa
2016-11-24 4:17 ` [tip:perf/core] " tip-bot for Jiri Olsa
5 siblings, 1 reply; 13+ messages in thread
From: Jiri Olsa @ 2016-11-21 21:33 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, Don Zickus, Joe Mario, Ingo Molnar, Peter Zijlstra,
Namhyung Kim, David Ahern, Andi Kleen
Adding support for cascading options added by Namhyung in:
commit 369a2478973a ("tools lib subcmd: Support cascading options")
This way the report and record command share options with
with c2c command and can save some option duplicates. For
now it's the 'v' option.
Link: http://lkml.kernel.org/n/tip-wpn7i6k1nryhlaukt2fvkhrw@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
tools/perf/builtin-c2c.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index 54924717ae8e..4b419631753d 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -101,6 +101,11 @@ static const char *display_str[DISPLAY_MAX] = {
[DISPLAY_TOT] = "Total",
};
+static const struct option c2c_options[] = {
+ OPT_INCR('v', "verbose", &verbose, "be more verbose (show counter open errors, etc)"),
+ OPT_END()
+};
+
static struct perf_c2c c2c;
static void *c2c_he_zalloc(size_t size)
@@ -2520,11 +2525,9 @@ static int perf_c2c__report(int argc, const char **argv)
const char *display = NULL;
const char *coalesce = NULL;
bool no_source = false;
- const struct option c2c_options[] = {
+ const struct option options[] = {
OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
"file", "vmlinux pathname"),
- OPT_INCR('v', "verbose", &verbose,
- "be more verbose (show counter open errors, etc)"),
OPT_STRING('i', "input", &input_name, "file",
"the input file to process"),
OPT_INCR('N', "node-info", &c2c.node_info,
@@ -2548,14 +2551,15 @@ static int perf_c2c__report(int argc, const char **argv)
OPT_STRING('c', "coalesce", &coalesce, "coalesce fields",
"coalesce fields: pid,tid,iaddr,dso"),
OPT_BOOLEAN('f', "force", &symbol_conf.force, "don't complain, do it"),
+ OPT_PARENT(c2c_options),
OPT_END()
};
int err = 0;
- argc = parse_options(argc, argv, c2c_options, report_c2c_usage,
+ argc = parse_options(argc, argv, options, report_c2c_usage,
PARSE_OPT_STOP_AT_NON_OPTION);
if (argc)
- usage_with_options(report_c2c_usage, c2c_options);
+ usage_with_options(report_c2c_usage, options);
if (c2c.stats_only)
c2c.use_stdio = true;
@@ -2683,11 +2687,10 @@ static int perf_c2c__record(int argc, const char **argv)
OPT_CALLBACK('e', "event", &event_set, "event",
"event selector. Use 'perf mem record -e list' to list available events",
parse_record_events),
- OPT_INCR('v', "verbose", &verbose,
- "be more verbose (show counter open errors, etc)"),
OPT_BOOLEAN('u', "all-user", &all_user, "collect only user level data"),
OPT_BOOLEAN('k', "all-kernel", &all_kernel, "collect only kernel level data"),
OPT_UINTEGER('l', "ldlat", &perf_mem_events__loads_ldlat, "setup mem-loads latency"),
+ OPT_PARENT(c2c_options),
OPT_END()
};
@@ -2759,11 +2762,6 @@ static int perf_c2c__record(int argc, const char **argv)
int cmd_c2c(int argc, const char **argv, const char *prefix __maybe_unused)
{
- const struct option c2c_options[] = {
- OPT_INCR('v', "verbose", &verbose, "be more verbose"),
- OPT_END()
- };
-
argc = parse_options(argc, argv, c2c_options, c2c_usage,
PARSE_OPT_STOP_AT_NON_OPTION);
--
2.7.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [tip:perf/core] perf tools: Show event fd in debug output
2016-11-21 21:33 ` [PATCH 1/6] perf tools: Show event fd in debug output Jiri Olsa
@ 2016-11-24 4:15 ` tip-bot for Jiri Olsa
0 siblings, 0 replies; 13+ messages in thread
From: tip-bot for Jiri Olsa @ 2016-11-24 4:15 UTC (permalink / raw)
To: linux-tip-commits
Cc: namhyung, jmario, dzickus, dsahern, mingo, a.p.zijlstra, jolsa,
jolsa, hpa, linux-kernel, andi, tglx, acme
Commit-ID: 7b4b82bced0755aecc026d8c14c2608aa0f9e89b
Gitweb: http://git.kernel.org/tip/7b4b82bced0755aecc026d8c14c2608aa0f9e89b
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 21 Nov 2016 22:33:26 +0100
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 23 Nov 2016 10:44:03 -0300
perf tools: Show event fd in debug output
It is useful for debug to see file descriptors for each event.
Before:
$ perf stat -vvv -e cycles,cache-misses ls
...
sys_perf_event_open: pid 12146 cpu -1 group_fd -1 flags 0x8
...
sys_perf_event_open: pid 12146 cpu -1 group_fd 3 flags 0x8
sys_perf_event_open failed, error -13
Now:
$ perf stat -vvv -e cycles,cache-misses ls
...
sys_perf_event_open: pid 12858 cpu -1 group_fd -1 flags 0x8 = 3
...
sys_perf_event_open: pid 12858 cpu -1 group_fd 3 flags 0x8
sys_perf_event_open failed, error -13
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Joe Mario <jmario@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1479764011-10732-2-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/evsel.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index e58a2fb..b2365a63 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1481,7 +1481,7 @@ retry_sample_id:
group_fd = get_group_fd(evsel, cpu, thread);
retry_open:
- pr_debug2("sys_perf_event_open: pid %d cpu %d group_fd %d flags %#lx\n",
+ pr_debug2("sys_perf_event_open: pid %d cpu %d group_fd %d flags %#lx",
pid, cpus->map[cpu], group_fd, flags);
FD(evsel, cpu, thread) = sys_perf_event_open(&evsel->attr,
@@ -1490,11 +1490,13 @@ retry_open:
group_fd, flags);
if (FD(evsel, cpu, thread) < 0) {
err = -errno;
- pr_debug2("sys_perf_event_open failed, error %d\n",
+ pr_debug2("\nsys_perf_event_open failed, error %d\n",
err);
goto try_fallback;
}
+ pr_debug2(" = %d\n", FD(evsel, cpu, thread));
+
if (evsel->bpf_fd >= 0) {
int evt_fd = FD(evsel, cpu, thread);
int bpf_fd = evsel->bpf_fd;
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [tip:perf/core] perf c2c report: Setup browser after opening perf.data
2016-11-21 21:33 ` [PATCH 2/6] perf c2c report: Setup browser after opening perf.data Jiri Olsa
@ 2016-11-24 4:16 ` tip-bot for Jiri Olsa
0 siblings, 0 replies; 13+ messages in thread
From: tip-bot for Jiri Olsa @ 2016-11-24 4:16 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, dzickus, a.p.zijlstra, hpa, namhyung, tglx, jolsa,
dsahern, jmario, andi, acme, jolsa, mingo
Commit-ID: e8c5fe101e55e4c45a2859cea2b4c374595f8867
Gitweb: http://git.kernel.org/tip/e8c5fe101e55e4c45a2859cea2b4c374595f8867
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 21 Nov 2016 22:33:27 +0100
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 23 Nov 2016 10:44:04 -0300
perf c2c report: Setup browser after opening perf.data
Because of the early browser switch we won't get possible error
messages, as it will clear the screen right after showing the message,
e.g.:
Before:
$ sudo perf c2c report -d lcl
$
After:
$ sudo perf c2c report -d lcl
File perf.data not owned by current user or root (use -f to override)
$
$ ls -la perf.data
-rw-------. 1 acme acme 26648 Nov 22 15:11 perf.data
$
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Joe Mario <jmario@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1479764011-10732-3-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-c2c.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index c6d0dda..15addb0 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -2535,13 +2535,6 @@ static int perf_c2c__report(int argc, const char **argv)
if (c2c.stats_only)
c2c.use_stdio = true;
- if (c2c.use_stdio)
- use_browser = 0;
- else
- use_browser = 1;
-
- setup_browser(false);
-
if (!input_name || !strlen(input_name))
input_name = "perf.data";
@@ -2568,6 +2561,7 @@ static int perf_c2c__report(int argc, const char **argv)
pr_debug("No memory for session\n");
goto out;
}
+
err = setup_nodes(session);
if (err) {
pr_err("Failed setup nodes\n");
@@ -2587,6 +2581,13 @@ static int perf_c2c__report(int argc, const char **argv)
goto out_session;
}
+ if (c2c.use_stdio)
+ use_browser = 0;
+ else
+ use_browser = 1;
+
+ setup_browser(false);
+
err = perf_session__process_events(session);
if (err) {
pr_err("failed to process sample\n");
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [tip:perf/core] perf c2c report: Add -f/--force option
2016-11-21 21:33 ` [PATCH 3/6] perf c2c report: Add -f/--force option Jiri Olsa
@ 2016-11-24 4:16 ` tip-bot for Jiri Olsa
0 siblings, 0 replies; 13+ messages in thread
From: tip-bot for Jiri Olsa @ 2016-11-24 4:16 UTC (permalink / raw)
To: linux-tip-commits
Cc: namhyung, linux-kernel, acme, jmario, a.p.zijlstra, dzickus,
dsahern, hpa, jolsa, tglx, jolsa, mingo, andi
Commit-ID: b7ac4f9f3b2532b4e3dcd3d402c405c46a8ec811
Gitweb: http://git.kernel.org/tip/b7ac4f9f3b2532b4e3dcd3d402c405c46a8ec811
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 21 Nov 2016 22:33:28 +0100
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 23 Nov 2016 10:44:04 -0300
perf c2c report: Add -f/--force option
Adding -f/--force option to go through ownership validation:
$ sudo perf c2c report
File perf.data not owned by current user or root (use -f to override)
$
$ sudo perf c2c report -f
< c2c report output >
$
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Joe Mario <jmario@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1479764011-10732-4-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Documentation/perf-c2c.txt | 4 ++++
tools/perf/builtin-c2c.c | 4 +++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/tools/perf/Documentation/perf-c2c.txt b/tools/perf/Documentation/perf-c2c.txt
index 21810d7..5eda933 100644
--- a/tools/perf/Documentation/perf-c2c.txt
+++ b/tools/perf/Documentation/perf-c2c.txt
@@ -100,6 +100,10 @@ REPORT OPTIONS
--show-all::
Show all captured HITM lines, with no regard to HITM % 0.0005 limit.
+-f::
+--force::
+ Don't do ownership validation.
+
C2C RECORD
----------
The perf c2c record command setup options related to HITM cacheline analysis
diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index 15addb0..d873977 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -2523,6 +2523,7 @@ static int perf_c2c__report(int argc, const char **argv)
OPT_STRING('d', "display", &display, NULL, "lcl,rmt"),
OPT_STRING('c', "coalesce", &coalesce, "coalesce fields",
"coalesce fields: pid,tid,iaddr,dso"),
+ OPT_BOOLEAN('f', "force", &symbol_conf.force, "don't complain, do it"),
OPT_END()
};
int err = 0;
@@ -2538,7 +2539,8 @@ static int perf_c2c__report(int argc, const char **argv)
if (!input_name || !strlen(input_name))
input_name = "perf.data";
- file.path = input_name;
+ file.path = input_name;
+ file.force = symbol_conf.force;
err = setup_display(display);
if (err)
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [tip:perf/core] perf c2c report: Add struct c2c_stats::tot_hitm field
2016-11-21 21:33 ` [PATCH 4/6] perf c2c report: Add struct c2c_stats::tot_hitm field Jiri Olsa
@ 2016-11-24 4:16 ` tip-bot for Jiri Olsa
0 siblings, 0 replies; 13+ messages in thread
From: tip-bot for Jiri Olsa @ 2016-11-24 4:16 UTC (permalink / raw)
To: linux-tip-commits
Cc: tglx, linux-kernel, dsahern, jolsa, dzickus, mingo, a.p.zijlstra,
namhyung, acme, andi, hpa, jmario, jolsa
Commit-ID: dba8ab93792a3a864ff741efe435b2ecbdfb66b1
Gitweb: http://git.kernel.org/tip/dba8ab93792a3a864ff741efe435b2ecbdfb66b1
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 21 Nov 2016 22:33:29 +0100
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 23 Nov 2016 10:44:05 -0300
perf c2c report: Add struct c2c_stats::tot_hitm field
Count total number of HITMs in a special field. This will ease up
addition of total HITM sorting into c2c report in the following patch.
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Joe Mario <jmario@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1479764011-10732-5-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/mem-events.c | 12 ++++++++++--
tools/perf/util/mem-events.h | 1 +
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c
index e507732..1d4ab53 100644
--- a/tools/perf/util/mem-events.c
+++ b/tools/perf/util/mem-events.c
@@ -280,6 +280,12 @@ int c2c_decode_stats(struct c2c_stats *stats, struct mem_info *mi)
u64 lock = data_src->mem_lock;
int err = 0;
+#define HITM_INC(__f) \
+do { \
+ stats->__f++; \
+ stats->tot_hitm++; \
+} while (0)
+
#define P(a, b) PERF_MEM_##a##_##b
stats->nr_entries++;
@@ -303,7 +309,7 @@ int c2c_decode_stats(struct c2c_stats *stats, struct mem_info *mi)
if (lvl & P(LVL, L2 )) stats->ld_l2hit++;
if (lvl & P(LVL, L3 )) {
if (snoop & P(SNOOP, HITM))
- stats->lcl_hitm++;
+ HITM_INC(lcl_hitm);
else
stats->ld_llchit++;
}
@@ -331,7 +337,7 @@ int c2c_decode_stats(struct c2c_stats *stats, struct mem_info *mi)
if (snoop & P(SNOOP, HIT))
stats->rmt_hit++;
else if (snoop & P(SNOOP, HITM))
- stats->rmt_hitm++;
+ HITM_INC(rmt_hitm);
}
if ((lvl & P(LVL, MISS)))
@@ -364,6 +370,7 @@ int c2c_decode_stats(struct c2c_stats *stats, struct mem_info *mi)
}
#undef P
+#undef HITM_INC
return err;
}
@@ -390,6 +397,7 @@ void c2c_add_stats(struct c2c_stats *stats, struct c2c_stats *add)
stats->ld_llchit += add->ld_llchit;
stats->lcl_hitm += add->lcl_hitm;
stats->rmt_hitm += add->rmt_hitm;
+ stats->tot_hitm += add->tot_hitm;
stats->rmt_hit += add->rmt_hit;
stats->lcl_dram += add->lcl_dram;
stats->rmt_dram += add->rmt_dram;
diff --git a/tools/perf/util/mem-events.h b/tools/perf/util/mem-events.h
index faf8040..40f72ee 100644
--- a/tools/perf/util/mem-events.h
+++ b/tools/perf/util/mem-events.h
@@ -59,6 +59,7 @@ struct c2c_stats {
u32 ld_llchit; /* count of loads that hit LLC */
u32 lcl_hitm; /* count of loads with local HITM */
u32 rmt_hitm; /* count of loads with remote HITM */
+ u32 tot_hitm; /* count of loads with local and remote HITM */
u32 rmt_hit; /* count of loads with remote hit clean; */
u32 lcl_dram; /* count of loads miss to local DRAM */
u32 rmt_dram; /* count of loads miss to remote DRAM */
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [tip:perf/core] perf c2c report: Display total HITMs on default
2016-11-21 21:33 ` [PATCH 5/6] perf c2c report: Display total HITMs on default Jiri Olsa
@ 2016-11-24 4:17 ` tip-bot for Jiri Olsa
0 siblings, 0 replies; 13+ messages in thread
From: tip-bot for Jiri Olsa @ 2016-11-24 4:17 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, andi, jolsa, jmario, dzickus, tglx, mingo, dsahern,
namhyung, a.p.zijlstra, linux-kernel, hpa, jolsa
Commit-ID: d940baccc990c29f0343843db7cf669bb8e91a6f
Gitweb: http://git.kernel.org/tip/d940baccc990c29f0343843db7cf669bb8e91a6f
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 21 Nov 2016 22:33:30 +0100
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 23 Nov 2016 10:44:05 -0300
perf c2c report: Display total HITMs on default
Currently we display the cacheline list sorted on remote HITMs by
default.
The problem is that they might not be always counted and 'perf c2c
report' displays an empty output. Thus it's more convenient to display
and sort the cacheline list based on the total of HITMs and have the
best change to see data in the default report run.
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Joe Mario <jmario@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1479764011-10732-6-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Documentation/perf-c2c.txt | 4 ++++
tools/perf/builtin-c2c.c | 39 ++++++++++++++++++++++++++++-------
2 files changed, 36 insertions(+), 7 deletions(-)
diff --git a/tools/perf/Documentation/perf-c2c.txt b/tools/perf/Documentation/perf-c2c.txt
index 5eda933..3f06730 100644
--- a/tools/perf/Documentation/perf-c2c.txt
+++ b/tools/perf/Documentation/perf-c2c.txt
@@ -104,6 +104,10 @@ REPORT OPTIONS
--force::
Don't do ownership validation.
+-d::
+--display::
+ Siwtch to HITM type (rmt, lcl) to display and sort on. Total HITMs as default.
+
C2C RECORD
----------
The perf c2c record command setup options related to HITM cacheline analysis
diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index d873977..5492471 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -91,6 +91,14 @@ struct perf_c2c {
enum {
DISPLAY_LCL,
DISPLAY_RMT,
+ DISPLAY_TOT,
+ DISPLAY_MAX,
+};
+
+static const char *display_str[DISPLAY_MAX] = {
+ [DISPLAY_LCL] = "Local",
+ [DISPLAY_RMT] = "Remote",
+ [DISPLAY_TOT] = "Total",
};
static struct perf_c2c c2c;
@@ -745,6 +753,10 @@ static double percent_hitm(struct c2c_hist_entry *c2c_he)
case DISPLAY_LCL:
st = stats->lcl_hitm;
tot = total->lcl_hitm;
+ break;
+ case DISPLAY_TOT:
+ st = stats->tot_hitm;
+ tot = total->tot_hitm;
default:
break;
}
@@ -1044,6 +1056,9 @@ node_entry(struct perf_hpp_fmt *fmt __maybe_unused, struct perf_hpp *hpp,
break;
case DISPLAY_LCL:
DISPLAY_HITM(lcl_hitm);
+ break;
+ case DISPLAY_TOT:
+ DISPLAY_HITM(tot_hitm);
default:
break;
}
@@ -1351,6 +1366,7 @@ static struct c2c_dimension dim_tot_loads = {
static struct c2c_header percent_hitm_header[] = {
[DISPLAY_LCL] = HEADER_BOTH("Lcl", "Hitm"),
[DISPLAY_RMT] = HEADER_BOTH("Rmt", "Hitm"),
+ [DISPLAY_TOT] = HEADER_BOTH("Tot", "Hitm"),
};
static struct c2c_dimension dim_percent_hitm = {
@@ -1794,6 +1810,9 @@ static bool he__display(struct hist_entry *he, struct c2c_stats *stats)
break;
case DISPLAY_RMT:
FILTER_HITM(rmt_hitm);
+ break;
+ case DISPLAY_TOT:
+ FILTER_HITM(tot_hitm);
default:
break;
};
@@ -1809,8 +1828,9 @@ static inline int valid_hitm_or_store(struct hist_entry *he)
bool has_hitm;
c2c_he = container_of(he, struct c2c_hist_entry, he);
- has_hitm = c2c.display == DISPLAY_LCL ?
- c2c_he->stats.lcl_hitm : c2c_he->stats.rmt_hitm;
+ has_hitm = c2c.display == DISPLAY_TOT ? c2c_he->stats.tot_hitm :
+ c2c.display == DISPLAY_LCL ? c2c_he->stats.lcl_hitm :
+ c2c_he->stats.rmt_hitm;
return has_hitm || c2c_he->stats.store;
}
@@ -2095,7 +2115,7 @@ static void print_c2c_info(FILE *out, struct perf_session *session)
first = false;
}
fprintf(out, " Cachelines sort on : %s HITMs\n",
- c2c.display == DISPLAY_LCL ? "Local" : "Remote");
+ display_str[c2c.display]);
fprintf(out, " Cacheline data grouping : %s\n", c2c.cl_sort);
}
@@ -2250,7 +2270,7 @@ static int perf_c2c_browser__title(struct hist_browser *browser,
"Shared Data Cache Line Table "
"(%lu entries, sorted on %s HITMs)",
browser->nr_non_filtered_entries,
- c2c.display == DISPLAY_LCL ? "local" : "remote");
+ display_str[c2c.display]);
return 0;
}
@@ -2387,9 +2407,11 @@ static int setup_callchain(struct perf_evlist *evlist)
static int setup_display(const char *str)
{
- const char *display = str ?: "rmt";
+ const char *display = str ?: "tot";
- if (!strcmp(display, "rmt"))
+ if (!strcmp(display, "tot"))
+ c2c.display = DISPLAY_TOT;
+ else if (!strcmp(display, "rmt"))
c2c.display = DISPLAY_RMT;
else if (!strcmp(display, "lcl"))
c2c.display = DISPLAY_LCL;
@@ -2474,6 +2496,8 @@ static int setup_coalesce(const char *coalesce, bool no_source)
return -1;
if (asprintf(&c2c.cl_resort, "offset,%s",
+ c2c.display == DISPLAY_TOT ?
+ "tot_hitm" :
c2c.display == DISPLAY_RMT ?
"rmt_hitm,lcl_hitm" :
"lcl_hitm,rmt_hitm") < 0)
@@ -2520,7 +2544,7 @@ static int perf_c2c__report(int argc, const char **argv)
"print_type,threshold[,print_limit],order,sort_key[,branch],value",
callchain_help, &parse_callchain_opt,
callchain_default_opt),
- OPT_STRING('d', "display", &display, NULL, "lcl,rmt"),
+ OPT_STRING('d', "display", &display, "Switch HITM output type", "lcl,rmt"),
OPT_STRING('c', "coalesce", &coalesce, "coalesce fields",
"coalesce fields: pid,tid,iaddr,dso"),
OPT_BOOLEAN('f', "force", &symbol_conf.force, "don't complain, do it"),
@@ -2608,6 +2632,7 @@ static int perf_c2c__report(int argc, const char **argv)
"tot_loads,"
"ld_fbhit,ld_l1hit,ld_l2hit,"
"ld_lclhit,ld_rmthit",
+ c2c.display == DISPLAY_TOT ? "tot_hitm" :
c2c.display == DISPLAY_LCL ? "lcl_hitm" : "rmt_hitm"
);
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [tip:perf/core] perf c2c: Support cascading options
2016-11-21 21:33 ` [PATCH 6/6] perf c2c: Support cascading options Jiri Olsa
@ 2016-11-24 4:17 ` tip-bot for Jiri Olsa
0 siblings, 0 replies; 13+ messages in thread
From: tip-bot for Jiri Olsa @ 2016-11-24 4:17 UTC (permalink / raw)
To: linux-tip-commits
Cc: jolsa, namhyung, tglx, dsahern, andi, acme, jmario, jolsa,
linux-kernel, a.p.zijlstra, mingo, dzickus, hpa
Commit-ID: 3a5bfab60e59d9407b69f447702c4cd14326c825
Gitweb: http://git.kernel.org/tip/3a5bfab60e59d9407b69f447702c4cd14326c825
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 21 Nov 2016 22:33:31 +0100
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 23 Nov 2016 10:44:06 -0300
perf c2c: Support cascading options
Adding support for cascading options added by Namhyung in:
commit 369a2478973a ("tools lib subcmd: Support cascading options")
This way the report and record command share options with with c2c
command and can save some option duplicates. For now it's the 'v'
option.
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Joe Mario <jmario@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1479764011-10732-7-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-c2c.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index 5492471..4b41963 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -101,6 +101,11 @@ static const char *display_str[DISPLAY_MAX] = {
[DISPLAY_TOT] = "Total",
};
+static const struct option c2c_options[] = {
+ OPT_INCR('v', "verbose", &verbose, "be more verbose (show counter open errors, etc)"),
+ OPT_END()
+};
+
static struct perf_c2c c2c;
static void *c2c_he_zalloc(size_t size)
@@ -2520,11 +2525,9 @@ static int perf_c2c__report(int argc, const char **argv)
const char *display = NULL;
const char *coalesce = NULL;
bool no_source = false;
- const struct option c2c_options[] = {
+ const struct option options[] = {
OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
"file", "vmlinux pathname"),
- OPT_INCR('v', "verbose", &verbose,
- "be more verbose (show counter open errors, etc)"),
OPT_STRING('i', "input", &input_name, "file",
"the input file to process"),
OPT_INCR('N', "node-info", &c2c.node_info,
@@ -2548,14 +2551,15 @@ static int perf_c2c__report(int argc, const char **argv)
OPT_STRING('c', "coalesce", &coalesce, "coalesce fields",
"coalesce fields: pid,tid,iaddr,dso"),
OPT_BOOLEAN('f', "force", &symbol_conf.force, "don't complain, do it"),
+ OPT_PARENT(c2c_options),
OPT_END()
};
int err = 0;
- argc = parse_options(argc, argv, c2c_options, report_c2c_usage,
+ argc = parse_options(argc, argv, options, report_c2c_usage,
PARSE_OPT_STOP_AT_NON_OPTION);
if (argc)
- usage_with_options(report_c2c_usage, c2c_options);
+ usage_with_options(report_c2c_usage, options);
if (c2c.stats_only)
c2c.use_stdio = true;
@@ -2683,11 +2687,10 @@ static int perf_c2c__record(int argc, const char **argv)
OPT_CALLBACK('e', "event", &event_set, "event",
"event selector. Use 'perf mem record -e list' to list available events",
parse_record_events),
- OPT_INCR('v', "verbose", &verbose,
- "be more verbose (show counter open errors, etc)"),
OPT_BOOLEAN('u', "all-user", &all_user, "collect only user level data"),
OPT_BOOLEAN('k', "all-kernel", &all_kernel, "collect only kernel level data"),
OPT_UINTEGER('l', "ldlat", &perf_mem_events__loads_ldlat, "setup mem-loads latency"),
+ OPT_PARENT(c2c_options),
OPT_END()
};
@@ -2759,11 +2762,6 @@ static int perf_c2c__record(int argc, const char **argv)
int cmd_c2c(int argc, const char **argv, const char *prefix __maybe_unused)
{
- const struct option c2c_options[] = {
- OPT_INCR('v', "verbose", &verbose, "be more verbose"),
- OPT_END()
- };
-
argc = parse_options(argc, argv, c2c_options, c2c_usage,
PARSE_OPT_STOP_AT_NON_OPTION);
^ permalink raw reply related [flat|nested] 13+ messages in thread
end of thread, other threads:[~2016-11-24 4:48 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-21 21:33 [PATCH 0/6] perf c2c report: Change default HITM sort/display Jiri Olsa
2016-11-21 21:33 ` [PATCH 1/6] perf tools: Show event fd in debug output Jiri Olsa
2016-11-24 4:15 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-11-21 21:33 ` [PATCH 2/6] perf c2c report: Setup browser after opening perf.data Jiri Olsa
2016-11-24 4:16 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-11-21 21:33 ` [PATCH 3/6] perf c2c report: Add -f/--force option Jiri Olsa
2016-11-24 4:16 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-11-21 21:33 ` [PATCH 4/6] perf c2c report: Add struct c2c_stats::tot_hitm field Jiri Olsa
2016-11-24 4:16 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-11-21 21:33 ` [PATCH 5/6] perf c2c report: Display total HITMs on default Jiri Olsa
2016-11-24 4:17 ` [tip:perf/core] " tip-bot for Jiri Olsa
2016-11-21 21:33 ` [PATCH 6/6] perf c2c: Support cascading options Jiri Olsa
2016-11-24 4:17 ` [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).