Re: [PATCH 03/14] perf tools: Add struct perf_hpp_fmt into hpp callbacks
Em Thu, Dec 13, 2012 at 02:09:01PM +0100, Jiri Olsa escreveu: > Adding 'struct perf_hpp_fmt' into hpp callbacks, so commands > can access their private data. > tools/perf/ui/gtk/browser.c| 10 +-- Doesn't apply here, can you please take a look? - Arnaldo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 03/14] perf tools: Add struct perf_hpp_fmt into hpp callbacks
Em Thu, Dec 13, 2012 at 02:09:01PM +0100, Jiri Olsa escreveu: Adding 'struct perf_hpp_fmt' into hpp callbacks, so commands can access their private data. tools/perf/ui/gtk/browser.c| 10 +-- Doesn't apply here, can you please take a look? - Arnaldo -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 03/14] perf tools: Add struct perf_hpp_fmt into hpp callbacks
Adding 'struct perf_hpp_fmt' into hpp callbacks, so commands can access their private data. It'll be handy for diff command in future to be able to access file related data for each column. Signed-off-by: Jiri Olsa Cc: Arnaldo Carvalho de Melo Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Paul Mackerras Cc: Corey Ashford Cc: Frederic Weisbecker Cc: Namhyung Kim --- tools/perf/ui/browsers/hists.c | 10 +-- tools/perf/ui/gtk/browser.c| 10 +-- tools/perf/ui/hist.c | 159 +++-- tools/perf/ui/stdio/hist.c | 4 +- tools/perf/util/hist.h | 10 +-- 5 files changed, 127 insertions(+), 66 deletions(-) diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index 57b82c2..b560abd 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c @@ -568,8 +568,10 @@ static int hist_browser__show_callchain(struct hist_browser *browser, } #define HPP__COLOR_FN(_name, _field) \ -static int hist_browser__hpp_color_ ## _name(struct perf_hpp *hpp, \ -struct hist_entry *he) \ +static int hist_browser__hpp_color_ ## _name( \ + struct perf_hpp_fmt *fmt __maybe_unused,\ + struct perf_hpp *hpp, \ + struct hist_entry *he) \ { \ struct hists *hists = he->hists;\ double percent = 100.0 * he->stat._field / hists->stats.total_period; \ @@ -647,7 +649,7 @@ static int hist_browser__show_entry(struct hist_browser *browser, if (fmt->color) { hpp.ptr = /* It will set percent for us. See HPP__COLOR_FN above. */ - width -= fmt->color(, entry); + width -= fmt->color(fmt, , entry); ui_browser__set_percent_color(>b, percent, current_entry); @@ -661,7 +663,7 @@ static int hist_browser__show_entry(struct hist_browser *browser, if (!current_entry || !browser->b.navkeypressed) ui_browser__set_color(>b, HE_COLORSET_NORMAL); } else { - width -= fmt->entry(, entry); + width -= fmt->entry(fmt, , entry); slsmg_printf("%s", s); } diff --git a/tools/perf/ui/gtk/browser.c b/tools/perf/ui/gtk/browser.c index e59ba33..e3ae11a 100644 --- a/tools/perf/ui/gtk/browser.c +++ b/tools/perf/ui/gtk/browser.c @@ -46,7 +46,9 @@ static const char *perf_gtk__get_percent_color(double percent) } #define HPP__COLOR_FN(_name, _field) \ -static int perf_gtk__hpp_color_ ## _name(struct perf_hpp *hpp, \ +static int \ +perf_gtk__hpp_color_ ## _name(struct perf_hpp_fmt *fmt __maybe_unused, \ +struct perf_hpp *hpp, \ struct hist_entry *he) \ { \ struct hists *hists = he->hists; \ @@ -129,7 +131,7 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists) col_idx = 0; perf_hpp__for_each_format(fmt) { - fmt->header(); + fmt->header(fmt, ); gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), -1, s, renderer, "markup", @@ -163,9 +165,9 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists) perf_hpp__for_each_format(fmt) { if (fmt->color) - fmt->color(, h); + fmt->color(fmt, , h); else - fmt->entry(, h); + fmt->entry(fmt, , h); gtk_list_store_set(store, , col_idx++, s, -1); } diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c index 1889c12..093ccf3 100644 --- a/tools/perf/ui/hist.c +++ b/tools/perf/ui/hist.c @@ -6,17 +6,20 @@ /* hist period print (hpp) functions */ -static int hpp__header_overhead(struct perf_hpp *hpp) +static int hpp__header_overhead(struct perf_hpp_fmt *fmt __maybe_unused, + struct perf_hpp *hpp) { return scnprintf(hpp->buf,
[PATCH 03/14] perf tools: Add struct perf_hpp_fmt into hpp callbacks
Adding 'struct perf_hpp_fmt' into hpp callbacks, so commands can access their private data. It'll be handy for diff command in future to be able to access file related data for each column. Signed-off-by: Jiri Olsa jo...@redhat.com Cc: Arnaldo Carvalho de Melo a...@ghostprotocols.net Cc: Peter Zijlstra a.p.zijls...@chello.nl Cc: Ingo Molnar mi...@elte.hu Cc: Paul Mackerras pau...@samba.org Cc: Corey Ashford cjash...@linux.vnet.ibm.com Cc: Frederic Weisbecker fweis...@gmail.com Cc: Namhyung Kim namhy...@kernel.org --- tools/perf/ui/browsers/hists.c | 10 +-- tools/perf/ui/gtk/browser.c| 10 +-- tools/perf/ui/hist.c | 159 +++-- tools/perf/ui/stdio/hist.c | 4 +- tools/perf/util/hist.h | 10 +-- 5 files changed, 127 insertions(+), 66 deletions(-) diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index 57b82c2..b560abd 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c @@ -568,8 +568,10 @@ static int hist_browser__show_callchain(struct hist_browser *browser, } #define HPP__COLOR_FN(_name, _field) \ -static int hist_browser__hpp_color_ ## _name(struct perf_hpp *hpp, \ -struct hist_entry *he) \ +static int hist_browser__hpp_color_ ## _name( \ + struct perf_hpp_fmt *fmt __maybe_unused,\ + struct perf_hpp *hpp, \ + struct hist_entry *he) \ { \ struct hists *hists = he-hists;\ double percent = 100.0 * he-stat._field / hists-stats.total_period; \ @@ -647,7 +649,7 @@ static int hist_browser__show_entry(struct hist_browser *browser, if (fmt-color) { hpp.ptr = percent; /* It will set percent for us. See HPP__COLOR_FN above. */ - width -= fmt-color(hpp, entry); + width -= fmt-color(fmt, hpp, entry); ui_browser__set_percent_color(browser-b, percent, current_entry); @@ -661,7 +663,7 @@ static int hist_browser__show_entry(struct hist_browser *browser, if (!current_entry || !browser-b.navkeypressed) ui_browser__set_color(browser-b, HE_COLORSET_NORMAL); } else { - width -= fmt-entry(hpp, entry); + width -= fmt-entry(fmt, hpp, entry); slsmg_printf(%s, s); } diff --git a/tools/perf/ui/gtk/browser.c b/tools/perf/ui/gtk/browser.c index e59ba33..e3ae11a 100644 --- a/tools/perf/ui/gtk/browser.c +++ b/tools/perf/ui/gtk/browser.c @@ -46,7 +46,9 @@ static const char *perf_gtk__get_percent_color(double percent) } #define HPP__COLOR_FN(_name, _field) \ -static int perf_gtk__hpp_color_ ## _name(struct perf_hpp *hpp, \ +static int \ +perf_gtk__hpp_color_ ## _name(struct perf_hpp_fmt *fmt __maybe_unused, \ +struct perf_hpp *hpp, \ struct hist_entry *he) \ { \ struct hists *hists = he-hists; \ @@ -129,7 +131,7 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists) col_idx = 0; perf_hpp__for_each_format(fmt) { - fmt-header(hpp); + fmt-header(fmt, hpp); gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), -1, s, renderer, markup, @@ -163,9 +165,9 @@ static void perf_gtk__show_hists(GtkWidget *window, struct hists *hists) perf_hpp__for_each_format(fmt) { if (fmt-color) - fmt-color(hpp, h); + fmt-color(fmt, hpp, h); else - fmt-entry(hpp, h); + fmt-entry(fmt, hpp, h); gtk_list_store_set(store, iter, col_idx++, s, -1); } diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c index 1889c12..093ccf3 100644 --- a/tools/perf/ui/hist.c +++ b/tools/perf/ui/hist.c @@ -6,17 +6,20 @@ /* hist period print (hpp) functions */ -static int