[PATCH 23/32] perf, tools: Add browser support for transaction flags v3
From: Andi Kleen Add histogram support for the transaction flags. Each flags instance becomes a separate histogram. Support sorting and displaying the flags in report and top. The patch is fairly large, but it's really mostly just plumbing to pass the flags around. v2: Increase column. Fix flags decoding. Use longer strings for flags to be more user friendly. v3: Fix WERROR=1 build. Tidy display Signed-off-by: Andi Kleen --- tools/perf/builtin-annotate.c |2 +- tools/perf/builtin-diff.c |8 +++-- tools/perf/builtin-report.c |4 +- tools/perf/builtin-top.c |4 +- tools/perf/util/hist.c|3 +- tools/perf/util/hist.h|3 +- tools/perf/util/sort.c| 61 + tools/perf/util/sort.h|2 + 8 files changed, 77 insertions(+), 10 deletions(-) diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 0b9cd0f..5a27016 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c @@ -62,7 +62,7 @@ static int perf_evsel__add_sample(struct perf_evsel *evsel, return 0; } - he = __hists__add_entry(>hists, al, NULL, 1, 1); + he = __hists__add_entry(>hists, al, NULL, 1, 1, 0); if (he == NULL) return -ENOMEM; diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 84cdbd1..aebff56 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c @@ -249,9 +249,10 @@ int perf_diff__formula(char *buf, size_t size, struct hist_entry *he) static int hists__add_entry(struct hists *self, struct addr_location *al, u64 period, - u64 weight) + u64 weight, u64 transaction) { - if (__hists__add_entry(self, al, NULL, period, weight) != NULL) + if (__hists__add_entry(self, al, NULL, period, weight, transaction) + != NULL) return 0; return -ENOMEM; } @@ -273,7 +274,8 @@ static int diff__process_sample_event(struct perf_tool *tool __maybe_unused, if (al.filtered) return 0; - if (hists__add_entry(>hists, , sample->period, sample->weight)) { + if (hists__add_entry(>hists, , sample->period, sample->weight, +sample->transaction)) { pr_warning("problem incrementing symbol period, skipping event\n"); return -1; } diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index bd7bb66..c3d3fb7 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c @@ -147,7 +147,7 @@ static int perf_evsel__add_hist_entry(struct perf_evsel *evsel, } he = __hists__add_entry(>hists, al, parent, sample->period, - sample->weight); + sample->weight, sample->transaction); if (he == NULL) return -ENOMEM; @@ -597,7 +597,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) OPT_STRING('s', "sort", _order, "key[,key2...]", "sort by key(s): pid, comm, dso, symbol, parent, dso_to," " dso_from, symbol_to, symbol_from, mispredict, srcline," - " abort, intx, weight, local_weight"), + " abort, intx, weight, local_weight, transaction"), OPT_BOOLEAN(0, "showcpuutilization", _conf.show_cpu_utilization, "Show sample percentage for different cpu modes"), OPT_STRING('p', "parent", _pattern, "regex", diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index eb4ba1d5..0d2a33d 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -272,7 +272,7 @@ static struct hist_entry *perf_evsel__add_hist_entry(struct perf_evsel *evsel, struct hist_entry *he; he = __hists__add_entry(>hists, al, NULL, sample->period, - sample->weight); + sample->weight, sample->transaction); if (he == NULL) return NULL; @@ -1229,7 +1229,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused) OPT_STRING('s', "sort", _order, "key[,key2...]", "sort by key(s): pid, comm, dso, symbol, parent, dso_to," " dso_from, symbol_to, symbol_from, mispredict, srcline," - " abort, intx, weight, local_weight"), + " abort, intx, weight, local_weight, transaction"), OPT_BOOLEAN('n', "show-nr-samples", _conf.show_nr_samples, "Show a column with the number of samples"), OPT_CALLBACK_DEFAULT('G', "call-graph", , "output_type,min_percent, call_order", diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index cbedba7..df79b9f 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -359,7
[PATCH 23/32] perf, tools: Add browser support for transaction flags v3
From: Andi Kleen a...@linux.intel.com Add histogram support for the transaction flags. Each flags instance becomes a separate histogram. Support sorting and displaying the flags in report and top. The patch is fairly large, but it's really mostly just plumbing to pass the flags around. v2: Increase column. Fix flags decoding. Use longer strings for flags to be more user friendly. v3: Fix WERROR=1 build. Tidy display Signed-off-by: Andi Kleen a...@linux.intel.com --- tools/perf/builtin-annotate.c |2 +- tools/perf/builtin-diff.c |8 +++-- tools/perf/builtin-report.c |4 +- tools/perf/builtin-top.c |4 +- tools/perf/util/hist.c|3 +- tools/perf/util/hist.h|3 +- tools/perf/util/sort.c| 61 + tools/perf/util/sort.h|2 + 8 files changed, 77 insertions(+), 10 deletions(-) diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 0b9cd0f..5a27016 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c @@ -62,7 +62,7 @@ static int perf_evsel__add_sample(struct perf_evsel *evsel, return 0; } - he = __hists__add_entry(evsel-hists, al, NULL, 1, 1); + he = __hists__add_entry(evsel-hists, al, NULL, 1, 1, 0); if (he == NULL) return -ENOMEM; diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 84cdbd1..aebff56 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c @@ -249,9 +249,10 @@ int perf_diff__formula(char *buf, size_t size, struct hist_entry *he) static int hists__add_entry(struct hists *self, struct addr_location *al, u64 period, - u64 weight) + u64 weight, u64 transaction) { - if (__hists__add_entry(self, al, NULL, period, weight) != NULL) + if (__hists__add_entry(self, al, NULL, period, weight, transaction) + != NULL) return 0; return -ENOMEM; } @@ -273,7 +274,8 @@ static int diff__process_sample_event(struct perf_tool *tool __maybe_unused, if (al.filtered) return 0; - if (hists__add_entry(evsel-hists, al, sample-period, sample-weight)) { + if (hists__add_entry(evsel-hists, al, sample-period, sample-weight, +sample-transaction)) { pr_warning(problem incrementing symbol period, skipping event\n); return -1; } diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index bd7bb66..c3d3fb7 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c @@ -147,7 +147,7 @@ static int perf_evsel__add_hist_entry(struct perf_evsel *evsel, } he = __hists__add_entry(evsel-hists, al, parent, sample-period, - sample-weight); + sample-weight, sample-transaction); if (he == NULL) return -ENOMEM; @@ -597,7 +597,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) OPT_STRING('s', sort, sort_order, key[,key2...], sort by key(s): pid, comm, dso, symbol, parent, dso_to, dso_from, symbol_to, symbol_from, mispredict, srcline, - abort, intx, weight, local_weight), + abort, intx, weight, local_weight, transaction), OPT_BOOLEAN(0, showcpuutilization, symbol_conf.show_cpu_utilization, Show sample percentage for different cpu modes), OPT_STRING('p', parent, parent_pattern, regex, diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index eb4ba1d5..0d2a33d 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -272,7 +272,7 @@ static struct hist_entry *perf_evsel__add_hist_entry(struct perf_evsel *evsel, struct hist_entry *he; he = __hists__add_entry(evsel-hists, al, NULL, sample-period, - sample-weight); + sample-weight, sample-transaction); if (he == NULL) return NULL; @@ -1229,7 +1229,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused) OPT_STRING('s', sort, sort_order, key[,key2...], sort by key(s): pid, comm, dso, symbol, parent, dso_to, dso_from, symbol_to, symbol_from, mispredict, srcline, - abort, intx, weight, local_weight), + abort, intx, weight, local_weight, transaction), OPT_BOOLEAN('n', show-nr-samples, symbol_conf.show_nr_samples, Show a column with the number of samples), OPT_CALLBACK_DEFAULT('G', call-graph, top, output_type,min_percent, call_order, diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index cbedba7..df79b9f 100644 ---