Re: [PATCH 2/3] perf tools: Introduce struct hist_browser_timer

2012-11-05 Thread David Ahern

On 11/1/12 11:50 PM, Namhyung Kim wrote:

From: Namhyung Kim 

Currently various hist browser functions receive 3 arguments for
refreshing histogram but only used from a few places.  Also it's only
for perf top command so that it can be NULL for other (and probably
most) cases.  Pack them into a struct in order to reduce number of
those unused arguments.

This is a mechanical change and does not intend a functional change.

Cc: David Ahern 
Cc: Irina Tirdea 
Signed-off-by: Namhyung Kim 
---
  tools/perf/builtin-annotate.c |  2 +-
  tools/perf/builtin-report.c   |  4 ++--
  tools/perf/builtin-top.c  |  9 +---
  tools/perf/ui/browsers/annotate.c | 27 +++-
  tools/perf/ui/browsers/hists.c| 43 +--
  tools/perf/ui/gtk/browser.c   |  4 +---
  tools/perf/util/annotate.h|  8 
  tools/perf/util/hist.h| 28 -
  8 files changed, 58 insertions(+), 67 deletions(-)


Tested-by: David Ahern 

--
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 2/3] perf tools: Introduce struct hist_browser_timer

2012-11-05 Thread David Ahern

On 11/1/12 11:50 PM, Namhyung Kim wrote:

From: Namhyung Kim namhyung@lge.com

Currently various hist browser functions receive 3 arguments for
refreshing histogram but only used from a few places.  Also it's only
for perf top command so that it can be NULL for other (and probably
most) cases.  Pack them into a struct in order to reduce number of
those unused arguments.

This is a mechanical change and does not intend a functional change.

Cc: David Ahern dsah...@gmail.com
Cc: Irina Tirdea irina.tir...@gmail.com
Signed-off-by: Namhyung Kim namhy...@kernel.org
---
  tools/perf/builtin-annotate.c |  2 +-
  tools/perf/builtin-report.c   |  4 ++--
  tools/perf/builtin-top.c  |  9 +---
  tools/perf/ui/browsers/annotate.c | 27 +++-
  tools/perf/ui/browsers/hists.c| 43 +--
  tools/perf/ui/gtk/browser.c   |  4 +---
  tools/perf/util/annotate.h|  8 
  tools/perf/util/hist.h| 28 -
  8 files changed, 58 insertions(+), 67 deletions(-)


Tested-by: David Ahern dsah...@gmail.com

--
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 2/3] perf tools: Introduce struct hist_browser_timer

2012-11-01 Thread Namhyung Kim
From: Namhyung Kim 

Currently various hist browser functions receive 3 arguments for
refreshing histogram but only used from a few places.  Also it's only
for perf top command so that it can be NULL for other (and probably
most) cases.  Pack them into a struct in order to reduce number of
those unused arguments.

This is a mechanical change and does not intend a functional change.

Cc: David Ahern 
Cc: Irina Tirdea 
Signed-off-by: Namhyung Kim 
---
 tools/perf/builtin-annotate.c |  2 +-
 tools/perf/builtin-report.c   |  4 ++--
 tools/perf/builtin-top.c  |  9 +---
 tools/perf/ui/browsers/annotate.c | 27 +++-
 tools/perf/ui/browsers/hists.c| 43 +--
 tools/perf/ui/gtk/browser.c   |  4 +---
 tools/perf/util/annotate.h|  8 
 tools/perf/util/hist.h| 28 -
 8 files changed, 58 insertions(+), 67 deletions(-)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index cb234765ce3d..dc870cf31b79 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -139,7 +139,7 @@ find_next:
}
 
if (use_browser > 0) {
-   key = hist_entry__tui_annotate(he, evidx, NULL, NULL, 
0);
+   key = hist_entry__tui_annotate(he, evidx, NULL);
switch (key) {
case K_RIGHT:
next = rb_next(nd);
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index f07eae73e692..234f34d466e3 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -428,10 +428,10 @@ static int __cmd_report(struct perf_report *rep)
if (use_browser > 0) {
if (use_browser == 1) {
perf_evlist__tui_browse_hists(session->evlist, help,
- NULL, NULL, 0);
+ NULL);
} else if (use_browser == 2) {
perf_evlist__gtk_browse_hists(session->evlist, help,
- NULL, NULL, 0);
+ NULL);
}
} else
perf_evlist__tty_browse_hists(session->evlist, rep, help);
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index f2ecd498c72d..102b43c9905d 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -582,6 +582,11 @@ static void *display_thread_tui(void *arg)
struct perf_evsel *pos;
struct perf_top *top = arg;
const char *help = "For a higher level overview, try: perf top --sort 
comm,dso";
+   struct hist_browser_timer hbt = {
+   .timer  = perf_top__sort_new_samples,
+   .arg= top,
+   .refresh= top->delay_secs,
+   };
 
perf_top__sort_new_samples(top);
 
@@ -593,9 +598,7 @@ static void *display_thread_tui(void *arg)
list_for_each_entry(pos, >evlist->entries, node)
pos->hists.uid_filter_str = top->target.uid_str;
 
-   perf_evlist__tui_browse_hists(top->evlist, help,
- perf_top__sort_new_samples,
- top, top->delay_secs);
+   perf_evlist__tui_browse_hists(top->evlist, help, );
 
exit_browser(0);
exit(0);
diff --git a/tools/perf/ui/browsers/annotate.c 
b/tools/perf/ui/browsers/annotate.c
index 28f8aab73aee..3eff17f703f3 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -386,9 +386,8 @@ static void annotate_browser__init_asm_mode(struct 
annotate_browser *browser)
browser->b.nr_entries = browser->nr_asm_entries;
 }
 
-static bool annotate_browser__callq(struct annotate_browser *browser,
-   int evidx, void (*timer)(void *arg),
-   void *arg, int delay_secs)
+static bool annotate_browser__callq(struct annotate_browser *browser, int 
evidx,
+   struct hist_browser_timer *hbt)
 {
struct map_symbol *ms = browser->b.priv;
struct disasm_line *dl = browser->selection;
@@ -418,7 +417,7 @@ static bool annotate_browser__callq(struct annotate_browser 
*browser,
}
 
pthread_mutex_unlock(>lock);
-   symbol__tui_annotate(target, ms->map, evidx, timer, arg, delay_secs);
+   symbol__tui_annotate(target, ms->map, evidx, hbt);
ui_browser__show_title(>b, sym->name);
return true;
 }
@@ -602,13 +601,13 @@ static void annotate_browser__update_addr_width(struct 
annotate_browser *browser
 }
 
 static int annotate_browser__run(struct annotate_browser *browser, int evidx,
-void(*timer)(void *arg),
-void *arg, int delay_secs)

[PATCH 2/3] perf tools: Introduce struct hist_browser_timer

2012-11-01 Thread Namhyung Kim
From: Namhyung Kim namhyung@lge.com

Currently various hist browser functions receive 3 arguments for
refreshing histogram but only used from a few places.  Also it's only
for perf top command so that it can be NULL for other (and probably
most) cases.  Pack them into a struct in order to reduce number of
those unused arguments.

This is a mechanical change and does not intend a functional change.

Cc: David Ahern dsah...@gmail.com
Cc: Irina Tirdea irina.tir...@gmail.com
Signed-off-by: Namhyung Kim namhy...@kernel.org
---
 tools/perf/builtin-annotate.c |  2 +-
 tools/perf/builtin-report.c   |  4 ++--
 tools/perf/builtin-top.c  |  9 +---
 tools/perf/ui/browsers/annotate.c | 27 +++-
 tools/perf/ui/browsers/hists.c| 43 +--
 tools/perf/ui/gtk/browser.c   |  4 +---
 tools/perf/util/annotate.h|  8 
 tools/perf/util/hist.h| 28 -
 8 files changed, 58 insertions(+), 67 deletions(-)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index cb234765ce3d..dc870cf31b79 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -139,7 +139,7 @@ find_next:
}
 
if (use_browser  0) {
-   key = hist_entry__tui_annotate(he, evidx, NULL, NULL, 
0);
+   key = hist_entry__tui_annotate(he, evidx, NULL);
switch (key) {
case K_RIGHT:
next = rb_next(nd);
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index f07eae73e692..234f34d466e3 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -428,10 +428,10 @@ static int __cmd_report(struct perf_report *rep)
if (use_browser  0) {
if (use_browser == 1) {
perf_evlist__tui_browse_hists(session-evlist, help,
- NULL, NULL, 0);
+ NULL);
} else if (use_browser == 2) {
perf_evlist__gtk_browse_hists(session-evlist, help,
- NULL, NULL, 0);
+ NULL);
}
} else
perf_evlist__tty_browse_hists(session-evlist, rep, help);
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index f2ecd498c72d..102b43c9905d 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -582,6 +582,11 @@ static void *display_thread_tui(void *arg)
struct perf_evsel *pos;
struct perf_top *top = arg;
const char *help = For a higher level overview, try: perf top --sort 
comm,dso;
+   struct hist_browser_timer hbt = {
+   .timer  = perf_top__sort_new_samples,
+   .arg= top,
+   .refresh= top-delay_secs,
+   };
 
perf_top__sort_new_samples(top);
 
@@ -593,9 +598,7 @@ static void *display_thread_tui(void *arg)
list_for_each_entry(pos, top-evlist-entries, node)
pos-hists.uid_filter_str = top-target.uid_str;
 
-   perf_evlist__tui_browse_hists(top-evlist, help,
- perf_top__sort_new_samples,
- top, top-delay_secs);
+   perf_evlist__tui_browse_hists(top-evlist, help, hbt);
 
exit_browser(0);
exit(0);
diff --git a/tools/perf/ui/browsers/annotate.c 
b/tools/perf/ui/browsers/annotate.c
index 28f8aab73aee..3eff17f703f3 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -386,9 +386,8 @@ static void annotate_browser__init_asm_mode(struct 
annotate_browser *browser)
browser-b.nr_entries = browser-nr_asm_entries;
 }
 
-static bool annotate_browser__callq(struct annotate_browser *browser,
-   int evidx, void (*timer)(void *arg),
-   void *arg, int delay_secs)
+static bool annotate_browser__callq(struct annotate_browser *browser, int 
evidx,
+   struct hist_browser_timer *hbt)
 {
struct map_symbol *ms = browser-b.priv;
struct disasm_line *dl = browser-selection;
@@ -418,7 +417,7 @@ static bool annotate_browser__callq(struct annotate_browser 
*browser,
}
 
pthread_mutex_unlock(notes-lock);
-   symbol__tui_annotate(target, ms-map, evidx, timer, arg, delay_secs);
+   symbol__tui_annotate(target, ms-map, evidx, hbt);
ui_browser__show_title(browser-b, sym-name);
return true;
 }
@@ -602,13 +601,13 @@ static void annotate_browser__update_addr_width(struct 
annotate_browser *browser
 }
 
 static int annotate_browser__run(struct annotate_browser *browser, int evidx,
-