* [PATCH 0/8] perf tools: Various fixes
@ 2016-06-20 21:58 Jiri Olsa
2016-06-20 21:58 ` [PATCH 1/8] perf tools: Rename __hists__add_entry to hists__add_entry Jiri Olsa
` (7 more replies)
0 siblings, 8 replies; 16+ messages in thread
From: Jiri Olsa @ 2016-06-20 21:58 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra
hi,
another bunch of generic enough fixes
to submit separately.
Available also in:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
perf/fixes
thanks,
jirka
---
Jiri Olsa (8):
perf tools: Rename __hists__add_entry to hists__add_entry
perf tools: Move hist_browser into header file
perf tools: Make hist_browser__(new|delete|run) public
perf tools: Introduce struct hist_browser title callback
perf tools: Move horizontal scroll init into hist_browser__new
perf tools: Introduce perf_evsel_browser_new function
perf tools: Introduce hist_browser__init
perf tools: Enlarge pid sort entry size
tools/perf/builtin-annotate.c | 2 +-
tools/perf/builtin-diff.c | 12 +-----------
tools/perf/tests/hists_link.c | 4 ++--
tools/perf/ui/browsers/hists.c | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------
tools/perf/ui/browsers/hists.h | 32 ++++++++++++++++++++++++++++++++
tools/perf/util/hist.c | 36 ++++++++++++++++++------------------
tools/perf/util/hist.h | 14 +++++++-------
tools/perf/util/sort.c | 6 +++---
8 files changed, 115 insertions(+), 96 deletions(-)
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 1/8] perf tools: Rename __hists__add_entry to hists__add_entry
2016-06-20 21:58 [PATCH 0/8] perf tools: Various fixes Jiri Olsa
@ 2016-06-20 21:58 ` Jiri Olsa
2016-06-20 21:58 ` [PATCH 2/8] perf tools: Move hist_browser into header file Jiri Olsa
` (6 subsequent siblings)
7 siblings, 0 replies; 16+ messages in thread
From: Jiri Olsa @ 2016-06-20 21:58 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra
There's no reason we should suffer the '__' prefix
for the base global function.
Link: http://lkml.kernel.org/n/tip-ue4xj3xn3uo1qndejfimtxhz@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/builtin-annotate.c | 2 +-
tools/perf/builtin-diff.c | 12 +-----------
tools/perf/tests/hists_link.c | 4 ++--
tools/perf/util/hist.c | 34 +++++++++++++++++-----------------
tools/perf/util/hist.h | 14 +++++++-------
5 files changed, 28 insertions(+), 38 deletions(-)
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 25c81734a950..a2324e1892aa 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -75,7 +75,7 @@ static int perf_evsel__add_sample(struct perf_evsel *evsel,
sample->period = 1;
sample->weight = 1;
- he = __hists__add_entry(hists, al, NULL, NULL, NULL, sample, true);
+ he = hists__add_entry(hists, al, NULL, NULL, NULL, sample, true);
if (he == NULL)
return -ENOMEM;
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 7f628f9c2fb4..8b6735f35179 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -310,16 +310,6 @@ static int formula_fprintf(struct hist_entry *he, struct hist_entry *pair,
return -1;
}
-static int hists__add_entry(struct hists *hists,
- struct addr_location *al,
- struct perf_sample *sample)
-{
- if (__hists__add_entry(hists, al, NULL, NULL, NULL,
- sample, true) != NULL)
- return 0;
- return -ENOMEM;
-}
-
static int diff__process_sample_event(struct perf_tool *tool __maybe_unused,
union perf_event *event,
struct perf_sample *sample,
@@ -336,7 +326,7 @@ static int diff__process_sample_event(struct perf_tool *tool __maybe_unused,
return -1;
}
- if (hists__add_entry(hists, &al, sample)) {
+ if (!hists__add_entry(hists, &al, NULL, NULL, NULL, sample, true)) {
pr_warning("problem incrementing symbol period, skipping event\n");
goto out_put;
}
diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c
index acf5a1301c07..6f96ca4d4fc0 100644
--- a/tools/perf/tests/hists_link.c
+++ b/tools/perf/tests/hists_link.c
@@ -84,7 +84,7 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)
if (machine__resolve(machine, &al, &sample) < 0)
goto out;
- he = __hists__add_entry(hists, &al, NULL,
+ he = hists__add_entry(hists, &al, NULL,
NULL, NULL, &sample, true);
if (he == NULL) {
addr_location__put(&al);
@@ -103,7 +103,7 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)
if (machine__resolve(machine, &al, &sample) < 0)
goto out;
- he = __hists__add_entry(hists, &al, NULL,
+ he = hists__add_entry(hists, &al, NULL,
NULL, NULL, &sample, true);
if (he == NULL) {
addr_location__put(&al);
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 2515cfdb7365..d2647b1d82c0 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -531,13 +531,13 @@ out:
return he;
}
-struct hist_entry *__hists__add_entry(struct hists *hists,
- struct addr_location *al,
- struct symbol *sym_parent,
- struct branch_info *bi,
- struct mem_info *mi,
- struct perf_sample *sample,
- bool sample_self)
+struct hist_entry *hists__add_entry(struct hists *hists,
+ struct addr_location *al,
+ struct symbol *sym_parent,
+ struct branch_info *bi,
+ struct mem_info *mi,
+ struct perf_sample *sample,
+ bool sample_self)
{
struct hist_entry entry = {
.thread = al->thread,
@@ -622,8 +622,8 @@ iter_add_single_mem_entry(struct hist_entry_iter *iter, struct addr_location *al
*/
sample->period = cost;
- he = __hists__add_entry(hists, al, iter->parent, NULL, mi,
- sample, true);
+ he = hists__add_entry(hists, al, iter->parent, NULL, mi,
+ sample, true);
if (!he)
return -ENOMEM;
@@ -727,8 +727,8 @@ iter_add_next_branch_entry(struct hist_entry_iter *iter, struct addr_location *a
sample->period = 1;
sample->weight = bi->flags.cycles ? bi->flags.cycles : 1;
- he = __hists__add_entry(hists, al, iter->parent, &bi[i], NULL,
- sample, true);
+ he = hists__add_entry(hists, al, iter->parent, &bi[i], NULL,
+ sample, true);
if (he == NULL)
return -ENOMEM;
@@ -764,8 +764,8 @@ iter_add_single_normal_entry(struct hist_entry_iter *iter, struct addr_location
struct perf_sample *sample = iter->sample;
struct hist_entry *he;
- he = __hists__add_entry(evsel__hists(evsel), al, iter->parent, NULL, NULL,
- sample, true);
+ he = hists__add_entry(evsel__hists(evsel), al, iter->parent, NULL, NULL,
+ sample, true);
if (he == NULL)
return -ENOMEM;
@@ -825,8 +825,8 @@ iter_add_single_cumulative_entry(struct hist_entry_iter *iter,
struct hist_entry *he;
int err = 0;
- he = __hists__add_entry(hists, al, iter->parent, NULL, NULL,
- sample, true);
+ he = hists__add_entry(hists, al, iter->parent, NULL, NULL,
+ sample, true);
if (he == NULL)
return -ENOMEM;
@@ -900,8 +900,8 @@ iter_add_next_cumulative_entry(struct hist_entry_iter *iter,
}
}
- he = __hists__add_entry(evsel__hists(evsel), al, iter->parent, NULL, NULL,
- sample, false);
+ he = hists__add_entry(evsel__hists(evsel), al, iter->parent, NULL, NULL,
+ sample, false);
if (he == NULL)
return -ENOMEM;
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index a19112872ff9..0a03e08be503 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -120,13 +120,13 @@ extern const struct hist_iter_ops hist_iter_branch;
extern const struct hist_iter_ops hist_iter_mem;
extern const struct hist_iter_ops hist_iter_cumulative;
-struct hist_entry *__hists__add_entry(struct hists *hists,
- struct addr_location *al,
- struct symbol *parent,
- struct branch_info *bi,
- struct mem_info *mi,
- struct perf_sample *sample,
- bool sample_self);
+struct hist_entry *hists__add_entry(struct hists *hists,
+ struct addr_location *al,
+ struct symbol *parent,
+ struct branch_info *bi,
+ struct mem_info *mi,
+ struct perf_sample *sample,
+ bool sample_self);
int hist_entry_iter__add(struct hist_entry_iter *iter, struct addr_location *al,
int max_stack_depth, void *arg);
--
2.4.11
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 2/8] perf tools: Move hist_browser into header file
2016-06-20 21:58 [PATCH 0/8] perf tools: Various fixes Jiri Olsa
2016-06-20 21:58 ` [PATCH 1/8] perf tools: Rename __hists__add_entry to hists__add_entry Jiri Olsa
@ 2016-06-20 21:58 ` Jiri Olsa
2016-06-26 10:49 ` [tip:perf/core] perf hists browser: " tip-bot for Jiri Olsa
2016-06-20 21:58 ` [PATCH 3/8] perf tools: Make hist_browser__(new|delete|run) public Jiri Olsa
` (5 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Jiri Olsa @ 2016-06-20 21:58 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra
This way we can use it outside of ui/browsers/hists.c
and extend it in following patches.
Link: http://lkml.kernel.org/n/tip-ro0o11n0c8k6czqnbnrh4ypc@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/ui/browsers/hists.c | 19 +------------------
tools/perf/ui/browsers/hists.h | 23 +++++++++++++++++++++++
2 files changed, 24 insertions(+), 18 deletions(-)
create mode 100644 tools/perf/ui/browsers/hists.h
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index b1b60544a545..cc8dece609ad 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -12,30 +12,13 @@
#include "../../util/top.h"
#include "../../arch/common.h"
-#include "../browser.h"
+#include "../browsers/hists.h"
#include "../helpline.h"
#include "../util.h"
#include "../ui.h"
#include "map.h"
#include "annotate.h"
-struct hist_browser {
- struct ui_browser b;
- struct hists *hists;
- struct hist_entry *he_selection;
- struct map_symbol *selection;
- struct hist_browser_timer *hbt;
- struct pstack *pstack;
- struct perf_env *env;
- int print_seq;
- bool show_dso;
- bool show_headers;
- float min_pcnt;
- u64 nr_non_filtered_entries;
- u64 nr_hierarchy_entries;
- u64 nr_callchain_rows;
-};
-
extern void hist_browser__init_hpp(void);
static int hists__browser_title(struct hists *hists,
diff --git a/tools/perf/ui/browsers/hists.h b/tools/perf/ui/browsers/hists.h
new file mode 100644
index 000000000000..9b6785ce79b4
--- /dev/null
+++ b/tools/perf/ui/browsers/hists.h
@@ -0,0 +1,23 @@
+#ifndef _PERF_UI_BROWSER_HISTS_H_
+#define _PERF_UI_BROWSER_HISTS_H_ 1
+
+#include "ui/browser.h"
+
+struct hist_browser {
+ struct ui_browser b;
+ struct hists *hists;
+ struct hist_entry *he_selection;
+ struct map_symbol *selection;
+ struct hist_browser_timer *hbt;
+ struct pstack *pstack;
+ struct perf_env *env;
+ int print_seq;
+ bool show_dso;
+ bool show_headers;
+ float min_pcnt;
+ u64 nr_non_filtered_entries;
+ u64 nr_hierarchy_entries;
+ u64 nr_callchain_rows;
+};
+
+#endif /* _PERF_UI_BROWSER_HISTS_H_ */
--
2.4.11
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 3/8] perf tools: Make hist_browser__(new|delete|run) public
2016-06-20 21:58 [PATCH 0/8] perf tools: Various fixes Jiri Olsa
2016-06-20 21:58 ` [PATCH 1/8] perf tools: Rename __hists__add_entry to hists__add_entry Jiri Olsa
2016-06-20 21:58 ` [PATCH 2/8] perf tools: Move hist_browser into header file Jiri Olsa
@ 2016-06-20 21:58 ` Jiri Olsa
2016-06-26 10:50 ` [tip:perf/core] perf hists browser: Make (new|delete|run) public tip-bot for Jiri Olsa
2016-06-20 21:58 ` [PATCH 4/8] perf tools: Introduce struct hist_browser title callback Jiri Olsa
` (4 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Jiri Olsa @ 2016-06-20 21:58 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra
This way we can use it outside of ui/browsers/hists.c
and extend it in following patches.
Link: http://lkml.kernel.org/n/tip-tmlkgjsd5bf6ebsmks9wlhut@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/ui/browsers/hists.c | 10 +++++-----
tools/perf/ui/browsers/hists.h | 5 +++++
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index cc8dece609ad..539b69065d9d 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -568,7 +568,7 @@ static void ui_browser__warn_lost_events(struct ui_browser *browser)
"Or reduce the sampling frequency.");
}
-static int hist_browser__run(struct hist_browser *browser, const char *help)
+int hist_browser__run(struct hist_browser *browser, const char *help)
{
int key;
char title[160];
@@ -2039,9 +2039,9 @@ static int hist_browser__dump(struct hist_browser *browser)
return 0;
}
-static struct hist_browser *hist_browser__new(struct hists *hists,
- struct hist_browser_timer *hbt,
- struct perf_env *env)
+struct hist_browser *hist_browser__new(struct hists *hists,
+ struct hist_browser_timer *hbt,
+ struct perf_env *env)
{
struct hist_browser *browser = zalloc(sizeof(*browser));
@@ -2059,7 +2059,7 @@ static struct hist_browser *hist_browser__new(struct hists *hists,
return browser;
}
-static void hist_browser__delete(struct hist_browser *browser)
+void hist_browser__delete(struct hist_browser *browser)
{
free(browser);
}
diff --git a/tools/perf/ui/browsers/hists.h b/tools/perf/ui/browsers/hists.h
index 9b6785ce79b4..57b7764800b7 100644
--- a/tools/perf/ui/browsers/hists.h
+++ b/tools/perf/ui/browsers/hists.h
@@ -20,4 +20,9 @@ struct hist_browser {
u64 nr_callchain_rows;
};
+struct hist_browser *hist_browser__new(struct hists *hists,
+ struct hist_browser_timer *hbt,
+ struct perf_env *env);
+void hist_browser__delete(struct hist_browser *browser);
+int hist_browser__run(struct hist_browser *browser, const char *help);
#endif /* _PERF_UI_BROWSER_HISTS_H_ */
--
2.4.11
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 4/8] perf tools: Introduce struct hist_browser title callback
2016-06-20 21:58 [PATCH 0/8] perf tools: Various fixes Jiri Olsa
` (2 preceding siblings ...)
2016-06-20 21:58 ` [PATCH 3/8] perf tools: Make hist_browser__(new|delete|run) public Jiri Olsa
@ 2016-06-20 21:58 ` Jiri Olsa
2016-06-26 10:50 ` [tip:perf/core] perf hists browser: " tip-bot for Jiri Olsa
2016-06-20 21:58 ` [PATCH 5/8] perf tools: Move horizontal scroll init into hist_browser__new Jiri Olsa
` (3 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Jiri Olsa @ 2016-06-20 21:58 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra
We can now setup title callback for hist_browser,
which will be useful in following changes to
create customized hist_browsers.
This also separates struct perf_evsel dependency
out of hist_browser basic code.
Link: http://lkml.kernel.org/n/tip-5v3wd2r5njgnokbnz4nxfg4v@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/ui/browsers/hists.c | 21 +++++++++++++--------
tools/perf/ui/browsers/hists.h | 4 ++++
2 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 539b69065d9d..a74cbd381607 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -21,9 +21,8 @@
extern void hist_browser__init_hpp(void);
-static int hists__browser_title(struct hists *hists,
- struct hist_browser_timer *hbt,
- char *bf, size_t size);
+static int perf_evsel_browser_title(struct hist_browser *browser,
+ char *bf, size_t size);
static void hist_browser__update_nr_entries(struct hist_browser *hb);
static struct rb_node *hists__filter_entries(struct rb_node *nd,
@@ -568,6 +567,11 @@ static void ui_browser__warn_lost_events(struct ui_browser *browser)
"Or reduce the sampling frequency.");
}
+static int hist_browser__title(struct hist_browser *browser, char *bf, size_t size)
+{
+ return browser->title ? browser->title(browser, bf, size) : 0;
+}
+
int hist_browser__run(struct hist_browser *browser, const char *help)
{
int key;
@@ -578,7 +582,7 @@ int hist_browser__run(struct hist_browser *browser, const char *help)
browser->b.entries = &browser->hists->entries;
browser->b.nr_entries = hist_browser__nr_entries(browser);
- hists__browser_title(browser->hists, hbt, title, sizeof(title));
+ hist_browser__title(browser, title, sizeof(title));
if (ui_browser__show(&browser->b, title, "%s", help) < 0)
return -1;
@@ -604,8 +608,7 @@ int hist_browser__run(struct hist_browser *browser, const char *help)
ui_browser__warn_lost_events(&browser->b);
}
- hists__browser_title(browser->hists,
- hbt, title, sizeof(title));
+ hist_browser__title(browser, title, sizeof(title));
ui_browser__show_title(&browser->b, title);
continue;
}
@@ -2054,6 +2057,7 @@ struct hist_browser *hist_browser__new(struct hists *hists,
browser->show_headers = symbol_conf.show_hist_headers;
browser->hbt = hbt;
browser->env = env;
+ browser->title = perf_evsel_browser_title;
}
return browser;
@@ -2080,10 +2084,11 @@ static inline bool is_report_browser(void *timer)
return timer == NULL;
}
-static int hists__browser_title(struct hists *hists,
- struct hist_browser_timer *hbt,
+static int perf_evsel_browser_title(struct hist_browser *browser,
char *bf, size_t size)
{
+ struct hist_browser_timer *hbt = browser->hbt;
+ struct hists *hists = browser->hists;
char unit;
int printed;
const struct dso *dso = hists->dso_filter;
diff --git a/tools/perf/ui/browsers/hists.h b/tools/perf/ui/browsers/hists.h
index 57b7764800b7..cf9d04928ccc 100644
--- a/tools/perf/ui/browsers/hists.h
+++ b/tools/perf/ui/browsers/hists.h
@@ -18,6 +18,10 @@ struct hist_browser {
u64 nr_non_filtered_entries;
u64 nr_hierarchy_entries;
u64 nr_callchain_rows;
+
+ /* Get title string. */
+ int (*title)(struct hist_browser *browser,
+ char *bf, size_t size);
};
struct hist_browser *hist_browser__new(struct hists *hists,
--
2.4.11
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 5/8] perf tools: Move horizontal scroll init into hist_browser__new
2016-06-20 21:58 [PATCH 0/8] perf tools: Various fixes Jiri Olsa
` (3 preceding siblings ...)
2016-06-20 21:58 ` [PATCH 4/8] perf tools: Introduce struct hist_browser title callback Jiri Olsa
@ 2016-06-20 21:58 ` Jiri Olsa
2016-06-26 10:51 ` [tip:perf/core] perf hists browser: Move horizontal scroll init to new() tip-bot for Jiri Olsa
2016-06-20 21:58 ` [PATCH 6/8] perf tools: Introduce perf_evsel_browser_new function Jiri Olsa
` (2 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Jiri Olsa @ 2016-06-20 21:58 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra
Moving horizontal scroll init into initialization
function as already intended.
Link: http://lkml.kernel.org/n/tip-5w6e9whw8iy5ve3szil9076y@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/ui/browsers/hists.c | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index a74cbd381607..ccb9ed62a037 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2049,6 +2049,8 @@ struct hist_browser *hist_browser__new(struct hists *hists,
struct hist_browser *browser = zalloc(sizeof(*browser));
if (browser) {
+ struct perf_hpp_fmt *fmt;
+
browser->hists = hists;
browser->b.refresh = hist_browser__refresh;
browser->b.refresh_dimensions = hist_browser__refresh_dimensions;
@@ -2058,6 +2060,11 @@ struct hist_browser *hist_browser__new(struct hists *hists,
browser->hbt = hbt;
browser->env = env;
browser->title = perf_evsel_browser_title;
+
+ hists__for_each_format(hists, fmt) {
+ perf_hpp__reset_width(fmt, hists);
+ ++browser->b.columns;
+ }
}
return browser;
@@ -2654,7 +2661,6 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
int key = -1;
char buf[64];
int delay_secs = hbt ? hbt->refresh : 0;
- struct perf_hpp_fmt *fmt;
#define HIST_BROWSER_HELP_COMMON \
"h/?/F1 Show this window\n" \
@@ -2713,18 +2719,6 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
memset(options, 0, sizeof(options));
memset(actions, 0, sizeof(actions));
- hists__for_each_format(browser->hists, fmt) {
- perf_hpp__reset_width(fmt, hists);
- /*
- * This is done just once, and activates the horizontal scrolling
- * code in the ui_browser code, it would be better to have a the
- * counter in the perf_hpp code, but I couldn't find doing it here
- * works, FIXME by setting this in hist_browser__new, for now, be
- * clever 8-)
- */
- ++browser->b.columns;
- }
-
if (symbol_conf.col_width_list_str)
perf_hpp__set_user_width(symbol_conf.col_width_list_str);
--
2.4.11
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 6/8] perf tools: Introduce perf_evsel_browser_new function
2016-06-20 21:58 [PATCH 0/8] perf tools: Various fixes Jiri Olsa
` (4 preceding siblings ...)
2016-06-20 21:58 ` [PATCH 5/8] perf tools: Move horizontal scroll init into hist_browser__new Jiri Olsa
@ 2016-06-20 21:58 ` Jiri Olsa
2016-06-26 10:51 ` [tip:perf/core] perf hists browser: Introduce perf_evsel_browser constructor tip-bot for Jiri Olsa
2016-06-20 21:58 ` [PATCH 7/8] perf tools: Introduce hist_browser__init Jiri Olsa
2016-06-20 21:58 ` [PATCH 8/8] perf tools: Enlarge pid sort entry size Jiri Olsa
7 siblings, 1 reply; 16+ messages in thread
From: Jiri Olsa @ 2016-06-20 21:58 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra
So we could use hist_browser__new for generic hist browser
in following patches.
Link: http://lkml.kernel.org/n/tip-rb9doy3pgsgu1vs9fryuwjb6@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/ui/browsers/hists.c | 24 +++++++++++++++++-------
tools/perf/ui/browsers/hists.h | 4 +---
2 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index ccb9ed62a037..fcb06b413325 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2042,9 +2042,7 @@ static int hist_browser__dump(struct hist_browser *browser)
return 0;
}
-struct hist_browser *hist_browser__new(struct hists *hists,
- struct hist_browser_timer *hbt,
- struct perf_env *env)
+struct hist_browser *hist_browser__new(struct hists *hists)
{
struct hist_browser *browser = zalloc(sizeof(*browser));
@@ -2057,9 +2055,6 @@ struct hist_browser *hist_browser__new(struct hists *hists,
browser->b.seek = ui_browser__hists_seek;
browser->b.use_navkeypressed = true;
browser->show_headers = symbol_conf.show_hist_headers;
- browser->hbt = hbt;
- browser->env = env;
- browser->title = perf_evsel_browser_title;
hists__for_each_format(hists, fmt) {
perf_hpp__reset_width(fmt, hists);
@@ -2070,6 +2065,21 @@ struct hist_browser *hist_browser__new(struct hists *hists,
return browser;
}
+static struct hist_browser*
+perf_evsel_browser_new(struct perf_evsel *evsel,
+ struct hist_browser_timer *hbt,
+ struct perf_env *env)
+{
+ struct hist_browser *browser = hist_browser__new(evsel__hists(evsel));
+
+ if (browser) {
+ browser->hbt = hbt;
+ browser->env = env;
+ browser->title = perf_evsel_browser_title;
+ }
+ return browser;
+}
+
void hist_browser__delete(struct hist_browser *browser)
{
free(browser);
@@ -2652,7 +2662,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
struct perf_env *env)
{
struct hists *hists = evsel__hists(evsel);
- struct hist_browser *browser = hist_browser__new(hists, hbt, env);
+ struct hist_browser *browser = perf_evsel_browser_new(evsel, hbt, env);
struct branch_info *bi;
#define MAX_OPTIONS 16
char *options[MAX_OPTIONS];
diff --git a/tools/perf/ui/browsers/hists.h b/tools/perf/ui/browsers/hists.h
index cf9d04928ccc..ec55a511d910 100644
--- a/tools/perf/ui/browsers/hists.h
+++ b/tools/perf/ui/browsers/hists.h
@@ -24,9 +24,7 @@ struct hist_browser {
char *bf, size_t size);
};
-struct hist_browser *hist_browser__new(struct hists *hists,
- struct hist_browser_timer *hbt,
- struct perf_env *env);
+struct hist_browser *hist_browser__new(struct hists *hists);
void hist_browser__delete(struct hist_browser *browser);
int hist_browser__run(struct hist_browser *browser, const char *help);
#endif /* _PERF_UI_BROWSER_HISTS_H_ */
--
2.4.11
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 7/8] perf tools: Introduce hist_browser__init
2016-06-20 21:58 [PATCH 0/8] perf tools: Various fixes Jiri Olsa
` (5 preceding siblings ...)
2016-06-20 21:58 ` [PATCH 6/8] perf tools: Introduce perf_evsel_browser_new function Jiri Olsa
@ 2016-06-20 21:58 ` Jiri Olsa
2016-06-26 10:52 ` [tip:perf/core] perf hists browser: Introduce init() tip-bot for Jiri Olsa
2016-06-20 21:58 ` [PATCH 8/8] perf tools: Enlarge pid sort entry size Jiri Olsa
7 siblings, 1 reply; 16+ messages in thread
From: Jiri Olsa @ 2016-06-20 21:58 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra
Factoring out the hist_browser initialization code,
so it could be used from other parts in following
patches.
Link: http://lkml.kernel.org/n/tip-wpnz9geiwesk0stkiumwc904@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/ui/browsers/hists.c | 35 ++++++++++++++++++++---------------
tools/perf/ui/browsers/hists.h | 2 ++
2 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index fcb06b413325..196e2a87765a 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2042,25 +2042,30 @@ static int hist_browser__dump(struct hist_browser *browser)
return 0;
}
+void hist_browser__init(struct hist_browser *browser,
+ struct hists *hists)
+{
+ struct perf_hpp_fmt *fmt;
+
+ browser->hists = hists;
+ browser->b.refresh = hist_browser__refresh;
+ browser->b.refresh_dimensions = hist_browser__refresh_dimensions;
+ browser->b.seek = ui_browser__hists_seek;
+ browser->b.use_navkeypressed = true;
+ browser->show_headers = symbol_conf.show_hist_headers;
+
+ hists__for_each_format(hists, fmt) {
+ perf_hpp__reset_width(fmt, hists);
+ ++browser->b.columns;
+ }
+}
+
struct hist_browser *hist_browser__new(struct hists *hists)
{
struct hist_browser *browser = zalloc(sizeof(*browser));
- if (browser) {
- struct perf_hpp_fmt *fmt;
-
- browser->hists = hists;
- browser->b.refresh = hist_browser__refresh;
- browser->b.refresh_dimensions = hist_browser__refresh_dimensions;
- browser->b.seek = ui_browser__hists_seek;
- browser->b.use_navkeypressed = true;
- browser->show_headers = symbol_conf.show_hist_headers;
-
- hists__for_each_format(hists, fmt) {
- perf_hpp__reset_width(fmt, hists);
- ++browser->b.columns;
- }
- }
+ if (browser)
+ hist_browser__init(browser, hists);
return browser;
}
diff --git a/tools/perf/ui/browsers/hists.h b/tools/perf/ui/browsers/hists.h
index ec55a511d910..39bd0f28f211 100644
--- a/tools/perf/ui/browsers/hists.h
+++ b/tools/perf/ui/browsers/hists.h
@@ -27,4 +27,6 @@ struct hist_browser {
struct hist_browser *hist_browser__new(struct hists *hists);
void hist_browser__delete(struct hist_browser *browser);
int hist_browser__run(struct hist_browser *browser, const char *help);
+void hist_browser__init(struct hist_browser *browser,
+ struct hists *hists);
#endif /* _PERF_UI_BROWSER_HISTS_H_ */
--
2.4.11
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 8/8] perf tools: Enlarge pid sort entry size
2016-06-20 21:58 [PATCH 0/8] perf tools: Various fixes Jiri Olsa
` (6 preceding siblings ...)
2016-06-20 21:58 ` [PATCH 7/8] perf tools: Introduce hist_browser__init Jiri Olsa
@ 2016-06-20 21:58 ` Jiri Olsa
2016-06-26 10:52 ` [tip:perf/core] perf hists: " tip-bot for Jiri Olsa
7 siblings, 1 reply; 16+ messages in thread
From: Jiri Olsa @ 2016-06-20 21:58 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra
The pid sort entry currently aligns pids with 5 digits,
which is not enough for current 4 million pids limit.
This leads to unaligned ':' header-data output when
we display 7 digits pid:
# Children Self Symbol Pid:Command
# ........ ........ ...................... .....................
#
0.12% 0.12% [.] 0x0000000000147e0f 2052894:krava
...
Adding 2 more digit to properly align the pid limit:
# Children Self Symbol Pid:Command
# ........ ........ ...................... .......................
#
0.12% 0.12% [.] 0x0000000000147e0f 2052894:krava
Link: http://lkml.kernel.org/n/tip-85bawguk56i4te6a4u8i6s37@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/util/hist.c | 2 +-
tools/perf/util/sort.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index d2647b1d82c0..d9826cce6801 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -79,7 +79,7 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h)
len = thread__comm_len(h->thread);
if (hists__new_col_len(hists, HISTC_COMM, len))
- hists__set_col_len(hists, HISTC_THREAD, len + 6);
+ hists__set_col_len(hists, HISTC_THREAD, len + 8);
if (h->ms.map) {
len = dso__name_len(h->ms.map->dso);
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 896d34ebcc1e..a764139af485 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -79,8 +79,8 @@ static int hist_entry__thread_snprintf(struct hist_entry *he, char *bf,
{
const char *comm = thread__comm_str(he->thread);
- width = max(7U, width) - 6;
- return repsep_snprintf(bf, size, "%5d:%-*.*s", he->thread->tid,
+ width = max(7U, width) - 8;
+ return repsep_snprintf(bf, size, "%7d:%-*.*s", he->thread->tid,
width, width, comm ?: "");
}
@@ -95,7 +95,7 @@ static int hist_entry__thread_filter(struct hist_entry *he, int type, const void
}
struct sort_entry sort_thread = {
- .se_header = " Pid:Command",
+ .se_header = " Pid:Command",
.se_cmp = sort__thread_cmp,
.se_snprintf = hist_entry__thread_snprintf,
.se_filter = hist_entry__thread_filter,
--
2.4.11
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [tip:perf/core] perf hists browser: Move hist_browser into header file
2016-06-20 21:58 ` [PATCH 2/8] perf tools: Move hist_browser into header file Jiri Olsa
@ 2016-06-26 10:49 ` tip-bot for Jiri Olsa
0 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Jiri Olsa @ 2016-06-26 10:49 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, jolsa, tglx, hpa, a.p.zijlstra, dsahern, acme,
namhyung, mingo
Commit-ID: f758990f25d159c067f31ded52b298a4f15cb08e
Gitweb: http://git.kernel.org/tip/f758990f25d159c067f31ded52b298a4f15cb08e
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 20 Jun 2016 23:58:13 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 22 Jun 2016 09:56:34 -0300
perf hists browser: Move hist_browser into header file
This way we can use it outside of ui/browsers/hists.c and extend it in
following patches.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1466459899-1166-3-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/ui/browsers/hists.c | 19 +------------------
tools/perf/ui/browsers/hists.h | 23 +++++++++++++++++++++++
2 files changed, 24 insertions(+), 18 deletions(-)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index b1b6054..cc8dece 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -12,30 +12,13 @@
#include "../../util/top.h"
#include "../../arch/common.h"
-#include "../browser.h"
+#include "../browsers/hists.h"
#include "../helpline.h"
#include "../util.h"
#include "../ui.h"
#include "map.h"
#include "annotate.h"
-struct hist_browser {
- struct ui_browser b;
- struct hists *hists;
- struct hist_entry *he_selection;
- struct map_symbol *selection;
- struct hist_browser_timer *hbt;
- struct pstack *pstack;
- struct perf_env *env;
- int print_seq;
- bool show_dso;
- bool show_headers;
- float min_pcnt;
- u64 nr_non_filtered_entries;
- u64 nr_hierarchy_entries;
- u64 nr_callchain_rows;
-};
-
extern void hist_browser__init_hpp(void);
static int hists__browser_title(struct hists *hists,
diff --git a/tools/perf/ui/browsers/hists.h b/tools/perf/ui/browsers/hists.h
new file mode 100644
index 0000000..9b6785c
--- /dev/null
+++ b/tools/perf/ui/browsers/hists.h
@@ -0,0 +1,23 @@
+#ifndef _PERF_UI_BROWSER_HISTS_H_
+#define _PERF_UI_BROWSER_HISTS_H_ 1
+
+#include "ui/browser.h"
+
+struct hist_browser {
+ struct ui_browser b;
+ struct hists *hists;
+ struct hist_entry *he_selection;
+ struct map_symbol *selection;
+ struct hist_browser_timer *hbt;
+ struct pstack *pstack;
+ struct perf_env *env;
+ int print_seq;
+ bool show_dso;
+ bool show_headers;
+ float min_pcnt;
+ u64 nr_non_filtered_entries;
+ u64 nr_hierarchy_entries;
+ u64 nr_callchain_rows;
+};
+
+#endif /* _PERF_UI_BROWSER_HISTS_H_ */
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [tip:perf/core] perf hists browser: Make (new|delete|run) public
2016-06-20 21:58 ` [PATCH 3/8] perf tools: Make hist_browser__(new|delete|run) public Jiri Olsa
@ 2016-06-26 10:50 ` tip-bot for Jiri Olsa
0 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Jiri Olsa @ 2016-06-26 10:50 UTC (permalink / raw)
To: linux-tip-commits
Cc: namhyung, acme, dsahern, tglx, linux-kernel, jolsa, a.p.zijlstra,
hpa, mingo
Commit-ID: dabd201239b5a521c3a5406c86dd273f47f37f1a
Gitweb: http://git.kernel.org/tip/dabd201239b5a521c3a5406c86dd273f47f37f1a
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 20 Jun 2016 23:58:14 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 22 Jun 2016 09:56:34 -0300
perf hists browser: Make (new|delete|run) public
This way we can use it outside of ui/browsers/hists.c and extend it in
following patches.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1466459899-1166-4-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/ui/browsers/hists.c | 10 +++++-----
tools/perf/ui/browsers/hists.h | 5 +++++
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index cc8dece..539b690 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -568,7 +568,7 @@ static void ui_browser__warn_lost_events(struct ui_browser *browser)
"Or reduce the sampling frequency.");
}
-static int hist_browser__run(struct hist_browser *browser, const char *help)
+int hist_browser__run(struct hist_browser *browser, const char *help)
{
int key;
char title[160];
@@ -2039,9 +2039,9 @@ static int hist_browser__dump(struct hist_browser *browser)
return 0;
}
-static struct hist_browser *hist_browser__new(struct hists *hists,
- struct hist_browser_timer *hbt,
- struct perf_env *env)
+struct hist_browser *hist_browser__new(struct hists *hists,
+ struct hist_browser_timer *hbt,
+ struct perf_env *env)
{
struct hist_browser *browser = zalloc(sizeof(*browser));
@@ -2059,7 +2059,7 @@ static struct hist_browser *hist_browser__new(struct hists *hists,
return browser;
}
-static void hist_browser__delete(struct hist_browser *browser)
+void hist_browser__delete(struct hist_browser *browser)
{
free(browser);
}
diff --git a/tools/perf/ui/browsers/hists.h b/tools/perf/ui/browsers/hists.h
index 9b6785c..57b7764 100644
--- a/tools/perf/ui/browsers/hists.h
+++ b/tools/perf/ui/browsers/hists.h
@@ -20,4 +20,9 @@ struct hist_browser {
u64 nr_callchain_rows;
};
+struct hist_browser *hist_browser__new(struct hists *hists,
+ struct hist_browser_timer *hbt,
+ struct perf_env *env);
+void hist_browser__delete(struct hist_browser *browser);
+int hist_browser__run(struct hist_browser *browser, const char *help);
#endif /* _PERF_UI_BROWSER_HISTS_H_ */
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [tip:perf/core] perf hists browser: Introduce struct hist_browser title callback
2016-06-20 21:58 ` [PATCH 4/8] perf tools: Introduce struct hist_browser title callback Jiri Olsa
@ 2016-06-26 10:50 ` tip-bot for Jiri Olsa
0 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Jiri Olsa @ 2016-06-26 10:50 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, jolsa, hpa, namhyung, linux-kernel, tglx, a.p.zijlstra,
dsahern, mingo
Commit-ID: 5b91a86f47669898d6f2fe625844ab65cf258c34
Gitweb: http://git.kernel.org/tip/5b91a86f47669898d6f2fe625844ab65cf258c34
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 20 Jun 2016 23:58:15 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 22 Jun 2016 09:56:34 -0300
perf hists browser: Introduce struct hist_browser title callback
We can now setup title callback for hist_browser, which will be useful
in following changes to create customized hist_browsers.
This also separates struct perf_evsel dependency out of hist_browser
basic code.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1466459899-1166-5-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/ui/browsers/hists.c | 21 +++++++++++++--------
tools/perf/ui/browsers/hists.h | 4 ++++
2 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 539b690..a74cbd3 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -21,9 +21,8 @@
extern void hist_browser__init_hpp(void);
-static int hists__browser_title(struct hists *hists,
- struct hist_browser_timer *hbt,
- char *bf, size_t size);
+static int perf_evsel_browser_title(struct hist_browser *browser,
+ char *bf, size_t size);
static void hist_browser__update_nr_entries(struct hist_browser *hb);
static struct rb_node *hists__filter_entries(struct rb_node *nd,
@@ -568,6 +567,11 @@ static void ui_browser__warn_lost_events(struct ui_browser *browser)
"Or reduce the sampling frequency.");
}
+static int hist_browser__title(struct hist_browser *browser, char *bf, size_t size)
+{
+ return browser->title ? browser->title(browser, bf, size) : 0;
+}
+
int hist_browser__run(struct hist_browser *browser, const char *help)
{
int key;
@@ -578,7 +582,7 @@ int hist_browser__run(struct hist_browser *browser, const char *help)
browser->b.entries = &browser->hists->entries;
browser->b.nr_entries = hist_browser__nr_entries(browser);
- hists__browser_title(browser->hists, hbt, title, sizeof(title));
+ hist_browser__title(browser, title, sizeof(title));
if (ui_browser__show(&browser->b, title, "%s", help) < 0)
return -1;
@@ -604,8 +608,7 @@ int hist_browser__run(struct hist_browser *browser, const char *help)
ui_browser__warn_lost_events(&browser->b);
}
- hists__browser_title(browser->hists,
- hbt, title, sizeof(title));
+ hist_browser__title(browser, title, sizeof(title));
ui_browser__show_title(&browser->b, title);
continue;
}
@@ -2054,6 +2057,7 @@ struct hist_browser *hist_browser__new(struct hists *hists,
browser->show_headers = symbol_conf.show_hist_headers;
browser->hbt = hbt;
browser->env = env;
+ browser->title = perf_evsel_browser_title;
}
return browser;
@@ -2080,10 +2084,11 @@ static inline bool is_report_browser(void *timer)
return timer == NULL;
}
-static int hists__browser_title(struct hists *hists,
- struct hist_browser_timer *hbt,
+static int perf_evsel_browser_title(struct hist_browser *browser,
char *bf, size_t size)
{
+ struct hist_browser_timer *hbt = browser->hbt;
+ struct hists *hists = browser->hists;
char unit;
int printed;
const struct dso *dso = hists->dso_filter;
diff --git a/tools/perf/ui/browsers/hists.h b/tools/perf/ui/browsers/hists.h
index 57b7764..cf9d049 100644
--- a/tools/perf/ui/browsers/hists.h
+++ b/tools/perf/ui/browsers/hists.h
@@ -18,6 +18,10 @@ struct hist_browser {
u64 nr_non_filtered_entries;
u64 nr_hierarchy_entries;
u64 nr_callchain_rows;
+
+ /* Get title string. */
+ int (*title)(struct hist_browser *browser,
+ char *bf, size_t size);
};
struct hist_browser *hist_browser__new(struct hists *hists,
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [tip:perf/core] perf hists browser: Move horizontal scroll init to new()
2016-06-20 21:58 ` [PATCH 5/8] perf tools: Move horizontal scroll init into hist_browser__new Jiri Olsa
@ 2016-06-26 10:51 ` tip-bot for Jiri Olsa
0 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Jiri Olsa @ 2016-06-26 10:51 UTC (permalink / raw)
To: linux-tip-commits
Cc: namhyung, jolsa, tglx, hpa, mingo, linux-kernel, a.p.zijlstra,
acme, dsahern
Commit-ID: b1c7a8f7a1dad1aa46ec26cdfa487598634c5267
Gitweb: http://git.kernel.org/tip/b1c7a8f7a1dad1aa46ec26cdfa487598634c5267
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 20 Jun 2016 23:58:16 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 22 Jun 2016 09:56:35 -0300
perf hists browser: Move horizontal scroll init to new()
Moving horizontal scroll init to initialization function as already
intended.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1466459899-1166-6-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/ui/browsers/hists.c | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index a74cbd3..ccb9ed6 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2049,6 +2049,8 @@ struct hist_browser *hist_browser__new(struct hists *hists,
struct hist_browser *browser = zalloc(sizeof(*browser));
if (browser) {
+ struct perf_hpp_fmt *fmt;
+
browser->hists = hists;
browser->b.refresh = hist_browser__refresh;
browser->b.refresh_dimensions = hist_browser__refresh_dimensions;
@@ -2058,6 +2060,11 @@ struct hist_browser *hist_browser__new(struct hists *hists,
browser->hbt = hbt;
browser->env = env;
browser->title = perf_evsel_browser_title;
+
+ hists__for_each_format(hists, fmt) {
+ perf_hpp__reset_width(fmt, hists);
+ ++browser->b.columns;
+ }
}
return browser;
@@ -2654,7 +2661,6 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
int key = -1;
char buf[64];
int delay_secs = hbt ? hbt->refresh : 0;
- struct perf_hpp_fmt *fmt;
#define HIST_BROWSER_HELP_COMMON \
"h/?/F1 Show this window\n" \
@@ -2713,18 +2719,6 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
memset(options, 0, sizeof(options));
memset(actions, 0, sizeof(actions));
- hists__for_each_format(browser->hists, fmt) {
- perf_hpp__reset_width(fmt, hists);
- /*
- * This is done just once, and activates the horizontal scrolling
- * code in the ui_browser code, it would be better to have a the
- * counter in the perf_hpp code, but I couldn't find doing it here
- * works, FIXME by setting this in hist_browser__new, for now, be
- * clever 8-)
- */
- ++browser->b.columns;
- }
-
if (symbol_conf.col_width_list_str)
perf_hpp__set_user_width(symbol_conf.col_width_list_str);
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [tip:perf/core] perf hists browser: Introduce perf_evsel_browser constructor
2016-06-20 21:58 ` [PATCH 6/8] perf tools: Introduce perf_evsel_browser_new function Jiri Olsa
@ 2016-06-26 10:51 ` tip-bot for Jiri Olsa
0 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Jiri Olsa @ 2016-06-26 10:51 UTC (permalink / raw)
To: linux-tip-commits
Cc: hpa, mingo, tglx, acme, namhyung, jolsa, linux-kernel,
a.p.zijlstra, dsahern
Commit-ID: a6ec894dea730bdc5568289898d27311e4031da0
Gitweb: http://git.kernel.org/tip/a6ec894dea730bdc5568289898d27311e4031da0
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 20 Jun 2016 23:58:17 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 22 Jun 2016 09:56:35 -0300
perf hists browser: Introduce perf_evsel_browser constructor
So we could use hist_browser__new for generic hist browser in following
patches.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1466459899-1166-7-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/ui/browsers/hists.c | 24 +++++++++++++++++-------
tools/perf/ui/browsers/hists.h | 4 +---
2 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index ccb9ed6..a81b298b 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2042,9 +2042,7 @@ static int hist_browser__dump(struct hist_browser *browser)
return 0;
}
-struct hist_browser *hist_browser__new(struct hists *hists,
- struct hist_browser_timer *hbt,
- struct perf_env *env)
+struct hist_browser *hist_browser__new(struct hists *hists)
{
struct hist_browser *browser = zalloc(sizeof(*browser));
@@ -2057,9 +2055,6 @@ struct hist_browser *hist_browser__new(struct hists *hists,
browser->b.seek = ui_browser__hists_seek;
browser->b.use_navkeypressed = true;
browser->show_headers = symbol_conf.show_hist_headers;
- browser->hbt = hbt;
- browser->env = env;
- browser->title = perf_evsel_browser_title;
hists__for_each_format(hists, fmt) {
perf_hpp__reset_width(fmt, hists);
@@ -2070,6 +2065,21 @@ struct hist_browser *hist_browser__new(struct hists *hists,
return browser;
}
+static struct hist_browser *
+perf_evsel_browser__new(struct perf_evsel *evsel,
+ struct hist_browser_timer *hbt,
+ struct perf_env *env)
+{
+ struct hist_browser *browser = hist_browser__new(evsel__hists(evsel));
+
+ if (browser) {
+ browser->hbt = hbt;
+ browser->env = env;
+ browser->title = perf_evsel_browser_title;
+ }
+ return browser;
+}
+
void hist_browser__delete(struct hist_browser *browser)
{
free(browser);
@@ -2652,7 +2662,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
struct perf_env *env)
{
struct hists *hists = evsel__hists(evsel);
- struct hist_browser *browser = hist_browser__new(hists, hbt, env);
+ struct hist_browser *browser = perf_evsel_browser__new(evsel, hbt, env);
struct branch_info *bi;
#define MAX_OPTIONS 16
char *options[MAX_OPTIONS];
diff --git a/tools/perf/ui/browsers/hists.h b/tools/perf/ui/browsers/hists.h
index cf9d049..ec55a51 100644
--- a/tools/perf/ui/browsers/hists.h
+++ b/tools/perf/ui/browsers/hists.h
@@ -24,9 +24,7 @@ struct hist_browser {
char *bf, size_t size);
};
-struct hist_browser *hist_browser__new(struct hists *hists,
- struct hist_browser_timer *hbt,
- struct perf_env *env);
+struct hist_browser *hist_browser__new(struct hists *hists);
void hist_browser__delete(struct hist_browser *browser);
int hist_browser__run(struct hist_browser *browser, const char *help);
#endif /* _PERF_UI_BROWSER_HISTS_H_ */
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [tip:perf/core] perf hists browser: Introduce init()
2016-06-20 21:58 ` [PATCH 7/8] perf tools: Introduce hist_browser__init Jiri Olsa
@ 2016-06-26 10:52 ` tip-bot for Jiri Olsa
0 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Jiri Olsa @ 2016-06-26 10:52 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, mingo, dsahern, a.p.zijlstra, namhyung, tglx, linux-kernel,
jolsa, hpa
Commit-ID: fcd864265028b65bf154f35fe5a17591ffd49cb9
Gitweb: http://git.kernel.org/tip/fcd864265028b65bf154f35fe5a17591ffd49cb9
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 20 Jun 2016 23:58:18 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 22 Jun 2016 09:56:35 -0300
perf hists browser: Introduce init()
Factoring out the hist_browser initialization code, so it could be used
from other parts in following patches.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1466459899-1166-8-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/ui/browsers/hists.c | 35 ++++++++++++++++++++---------------
tools/perf/ui/browsers/hists.h | 2 ++
2 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index a81b298b..9d74435 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2042,25 +2042,30 @@ static int hist_browser__dump(struct hist_browser *browser)
return 0;
}
+void hist_browser__init(struct hist_browser *browser,
+ struct hists *hists)
+{
+ struct perf_hpp_fmt *fmt;
+
+ browser->hists = hists;
+ browser->b.refresh = hist_browser__refresh;
+ browser->b.refresh_dimensions = hist_browser__refresh_dimensions;
+ browser->b.seek = ui_browser__hists_seek;
+ browser->b.use_navkeypressed = true;
+ browser->show_headers = symbol_conf.show_hist_headers;
+
+ hists__for_each_format(hists, fmt) {
+ perf_hpp__reset_width(fmt, hists);
+ ++browser->b.columns;
+ }
+}
+
struct hist_browser *hist_browser__new(struct hists *hists)
{
struct hist_browser *browser = zalloc(sizeof(*browser));
- if (browser) {
- struct perf_hpp_fmt *fmt;
-
- browser->hists = hists;
- browser->b.refresh = hist_browser__refresh;
- browser->b.refresh_dimensions = hist_browser__refresh_dimensions;
- browser->b.seek = ui_browser__hists_seek;
- browser->b.use_navkeypressed = true;
- browser->show_headers = symbol_conf.show_hist_headers;
-
- hists__for_each_format(hists, fmt) {
- perf_hpp__reset_width(fmt, hists);
- ++browser->b.columns;
- }
- }
+ if (browser)
+ hist_browser__init(browser, hists);
return browser;
}
diff --git a/tools/perf/ui/browsers/hists.h b/tools/perf/ui/browsers/hists.h
index ec55a51..39bd0f2 100644
--- a/tools/perf/ui/browsers/hists.h
+++ b/tools/perf/ui/browsers/hists.h
@@ -27,4 +27,6 @@ struct hist_browser {
struct hist_browser *hist_browser__new(struct hists *hists);
void hist_browser__delete(struct hist_browser *browser);
int hist_browser__run(struct hist_browser *browser, const char *help);
+void hist_browser__init(struct hist_browser *browser,
+ struct hists *hists);
#endif /* _PERF_UI_BROWSER_HISTS_H_ */
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [tip:perf/core] perf hists: Enlarge pid sort entry size
2016-06-20 21:58 ` [PATCH 8/8] perf tools: Enlarge pid sort entry size Jiri Olsa
@ 2016-06-26 10:52 ` tip-bot for Jiri Olsa
0 siblings, 0 replies; 16+ messages in thread
From: tip-bot for Jiri Olsa @ 2016-06-26 10:52 UTC (permalink / raw)
To: linux-tip-commits
Cc: mingo, jolsa, namhyung, hpa, dsahern, acme, a.p.zijlstra,
linux-kernel, tglx
Commit-ID: 89c7cb2cad5e5e3675df3ba1c12fe2f64dc691d6
Gitweb: http://git.kernel.org/tip/89c7cb2cad5e5e3675df3ba1c12fe2f64dc691d6
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 20 Jun 2016 23:58:19 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 22 Jun 2016 09:56:35 -0300
perf hists: Enlarge pid sort entry size
The pid sort entry currently aligns pids with 5 digits, which is not
enough for current 4 million pids limit.
This leads to unaligned ':' header-data output when we display 7 digits
pid:
# Children Self Symbol Pid:Command
# ........ ........ ...................... .....................
#
0.12% 0.12% [.] 0x0000000000147e0f 2052894:krava
...
Adding 2 more digit to properly align the pid limit:
# Children Self Symbol Pid:Command
# ........ ........ ...................... .......................
#
0.12% 0.12% [.] 0x0000000000147e0f 2052894:krava
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1466459899-1166-9-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/hist.c | 2 +-
tools/perf/util/sort.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index d2647b1..d9826cc 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -79,7 +79,7 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h)
len = thread__comm_len(h->thread);
if (hists__new_col_len(hists, HISTC_COMM, len))
- hists__set_col_len(hists, HISTC_THREAD, len + 6);
+ hists__set_col_len(hists, HISTC_THREAD, len + 8);
if (h->ms.map) {
len = dso__name_len(h->ms.map->dso);
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 896d34eb..a764139 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -79,8 +79,8 @@ static int hist_entry__thread_snprintf(struct hist_entry *he, char *bf,
{
const char *comm = thread__comm_str(he->thread);
- width = max(7U, width) - 6;
- return repsep_snprintf(bf, size, "%5d:%-*.*s", he->thread->tid,
+ width = max(7U, width) - 8;
+ return repsep_snprintf(bf, size, "%7d:%-*.*s", he->thread->tid,
width, width, comm ?: "");
}
@@ -95,7 +95,7 @@ static int hist_entry__thread_filter(struct hist_entry *he, int type, const void
}
struct sort_entry sort_thread = {
- .se_header = " Pid:Command",
+ .se_header = " Pid:Command",
.se_cmp = sort__thread_cmp,
.se_snprintf = hist_entry__thread_snprintf,
.se_filter = hist_entry__thread_filter,
^ permalink raw reply related [flat|nested] 16+ messages in thread
end of thread, other threads:[~2016-06-26 10:52 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-20 21:58 [PATCH 0/8] perf tools: Various fixes Jiri Olsa
2016-06-20 21:58 ` [PATCH 1/8] perf tools: Rename __hists__add_entry to hists__add_entry Jiri Olsa
2016-06-20 21:58 ` [PATCH 2/8] perf tools: Move hist_browser into header file Jiri Olsa
2016-06-26 10:49 ` [tip:perf/core] perf hists browser: " tip-bot for Jiri Olsa
2016-06-20 21:58 ` [PATCH 3/8] perf tools: Make hist_browser__(new|delete|run) public Jiri Olsa
2016-06-26 10:50 ` [tip:perf/core] perf hists browser: Make (new|delete|run) public tip-bot for Jiri Olsa
2016-06-20 21:58 ` [PATCH 4/8] perf tools: Introduce struct hist_browser title callback Jiri Olsa
2016-06-26 10:50 ` [tip:perf/core] perf hists browser: " tip-bot for Jiri Olsa
2016-06-20 21:58 ` [PATCH 5/8] perf tools: Move horizontal scroll init into hist_browser__new Jiri Olsa
2016-06-26 10:51 ` [tip:perf/core] perf hists browser: Move horizontal scroll init to new() tip-bot for Jiri Olsa
2016-06-20 21:58 ` [PATCH 6/8] perf tools: Introduce perf_evsel_browser_new function Jiri Olsa
2016-06-26 10:51 ` [tip:perf/core] perf hists browser: Introduce perf_evsel_browser constructor tip-bot for Jiri Olsa
2016-06-20 21:58 ` [PATCH 7/8] perf tools: Introduce hist_browser__init Jiri Olsa
2016-06-26 10:52 ` [tip:perf/core] perf hists browser: Introduce init() tip-bot for Jiri Olsa
2016-06-20 21:58 ` [PATCH 8/8] perf tools: Enlarge pid sort entry size Jiri Olsa
2016-06-26 10:52 ` [tip:perf/core] perf hists: " 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).