linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH resend] perf top: Add a visual cue for toggle zeroing of samples
@ 2014-10-07  7:13 Taeung Song
  2014-10-08  0:48 ` Namhyung Kim
  2014-10-16  5:21 ` [tip:perf/urgent] " tip-bot for Taeung Song
  0 siblings, 2 replies; 4+ messages in thread
From: Taeung Song @ 2014-10-07  7:13 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: namhyung, linux-kernel, Taeung Song

When 'perf top' is run, one can't easily find a difference
between -z option and normal output.
So I added a visual cue to know whether it is the zeroing or not.

Output is as below.

Before:
 $ perf top

 Samples: 61K of event 'cycles', Event count (approx.): 3908136933
 Overhead  Shared Object                       Symbol
    1.42%  firefox                             [.] 0x0000000000011e76
    1.32%  libpthread-2.17.so                  [.] pthread_mutex_lock

If you press key 'z' or run with zero option like '$ perf top --zero', it is as below.

After:
 Samples: 61K of event 'cycles', Event count (approx.): 3908136933 [z]
 Overhead  Shared Object                       Symbol
    1.42%  firefox                             [.] 0x0000000000011e76
    1.32%  libpthread-2.17.so                  [.] pthread_mutex_lock

Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
---
 tools/perf/ui/browsers/hists.c | 32 ++++++++++++++++++++++----------
 1 file changed, 22 insertions(+), 10 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 8f60a97..79b66d0 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -35,7 +35,9 @@ struct hist_browser {
 
 extern void hist_browser__init_hpp(void);
 
-static int hists__browser_title(struct hists *hists, char *bf, size_t size);
+static int hists__browser_title(struct hists *hists,
+				struct hist_browser_timer *hbt,
+				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,
@@ -390,7 +392,7 @@ static int hist_browser__run(struct hist_browser *browser,
 	browser->b.entries = &browser->hists->entries;
 	browser->b.nr_entries = hist_browser__nr_entries(browser);
 
-	hists__browser_title(browser->hists, title, sizeof(title));
+	hists__browser_title(browser->hists, hbt, title, sizeof(title));
 
 	if (ui_browser__show(&browser->b, title,
 			     "Press '?' for help on key bindings") < 0)
@@ -417,7 +419,8 @@ static int hist_browser__run(struct hist_browser *browser,
 				ui_browser__warn_lost_events(&browser->b);
 			}
 
-			hists__browser_title(browser->hists, title, sizeof(title));
+			hists__browser_title(browser->hists,
+					     hbt, title, sizeof(title));
 			ui_browser__show_title(&browser->b, title);
 			continue;
 		}
@@ -1204,7 +1207,15 @@ static struct thread *hist_browser__selected_thread(struct hist_browser *browser
 	return browser->he_selection->thread;
 }
 
-static int hists__browser_title(struct hists *hists, char *bf, size_t size)
+/* Check whether the browser is for 'top' or 'report' */
+static inline bool is_report_browser(void *timer)
+{
+	return timer == NULL;
+}
+
+static int hists__browser_title(struct hists *hists,
+				struct hist_browser_timer *hbt,
+				char *bf, size_t size)
 {
 	char unit;
 	int printed;
@@ -1256,6 +1267,13 @@ static int hists__browser_title(struct hists *hists, char *bf, size_t size)
 	if (dso)
 		printed += scnprintf(bf + printed, size - printed,
 				    ", DSO: %s", dso->short_name);
+	if (!is_report_browser(hbt)) {
+		struct perf_top *top = hbt->arg;
+
+		if (top->zero)
+			printed += scnprintf(bf + printed, size - printed, " [z]");
+	}
+
 	return printed;
 }
 
@@ -1267,12 +1285,6 @@ static inline void free_popup_options(char **options, int n)
 		zfree(&options[i]);
 }
 
-/* Check whether the browser is for 'top' or 'report' */
-static inline bool is_report_browser(void *timer)
-{
-	return timer == NULL;
-}
-
 /*
  * Only runtime switching of perf data file will make "input_name" point
  * to a malloced buffer. So add "is_input_name_malloced" flag to decide
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH resend] perf top: Add a visual cue for toggle zeroing of samples
  2014-10-07  7:13 [PATCH resend] perf top: Add a visual cue for toggle zeroing of samples Taeung Song
@ 2014-10-08  0:48 ` Namhyung Kim
  2014-10-15 18:48   ` Arnaldo Carvalho de Melo
  2014-10-16  5:21 ` [tip:perf/urgent] " tip-bot for Taeung Song
  1 sibling, 1 reply; 4+ messages in thread
From: Namhyung Kim @ 2014-10-08  0:48 UTC (permalink / raw)
  To: Taeung Song; +Cc: Arnaldo Carvalho de Melo, linux-kernel

Hi Taeung,

On Tue,  7 Oct 2014 16:13:15 +0900, Taeung Song wrote:
> When 'perf top' is run, one can't easily find a difference
> between -z option and normal output.
> So I added a visual cue to know whether it is the zeroing or not.
>
> Output is as below.
>
> Before:
>  $ perf top
>
>  Samples: 61K of event 'cycles', Event count (approx.): 3908136933
>  Overhead  Shared Object                       Symbol
>     1.42%  firefox                             [.] 0x0000000000011e76
>     1.32%  libpthread-2.17.so                  [.] pthread_mutex_lock
>
> If you press key 'z' or run with zero option like '$ perf top --zero', it is as below.
>
> After:
>  Samples: 61K of event 'cycles', Event count (approx.): 3908136933 [z]
>  Overhead  Shared Object                       Symbol
>     1.42%  firefox                             [.] 0x0000000000011e76
>     1.32%  libpthread-2.17.so                  [.] pthread_mutex_lock
>
> Signed-off-by: Taeung Song <treeze.taeung@gmail.com>

Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung


> ---
>  tools/perf/ui/browsers/hists.c | 32 ++++++++++++++++++++++----------
>  1 file changed, 22 insertions(+), 10 deletions(-)
>
> diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
> index 8f60a97..79b66d0 100644
> --- a/tools/perf/ui/browsers/hists.c
> +++ b/tools/perf/ui/browsers/hists.c
> @@ -35,7 +35,9 @@ struct hist_browser {
>  
>  extern void hist_browser__init_hpp(void);
>  
> -static int hists__browser_title(struct hists *hists, char *bf, size_t size);
> +static int hists__browser_title(struct hists *hists,
> +				struct hist_browser_timer *hbt,
> +				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,
> @@ -390,7 +392,7 @@ static int hist_browser__run(struct hist_browser *browser,
>  	browser->b.entries = &browser->hists->entries;
>  	browser->b.nr_entries = hist_browser__nr_entries(browser);
>  
> -	hists__browser_title(browser->hists, title, sizeof(title));
> +	hists__browser_title(browser->hists, hbt, title, sizeof(title));
>  
>  	if (ui_browser__show(&browser->b, title,
>  			     "Press '?' for help on key bindings") < 0)
> @@ -417,7 +419,8 @@ static int hist_browser__run(struct hist_browser *browser,
>  				ui_browser__warn_lost_events(&browser->b);
>  			}
>  
> -			hists__browser_title(browser->hists, title, sizeof(title));
> +			hists__browser_title(browser->hists,
> +					     hbt, title, sizeof(title));
>  			ui_browser__show_title(&browser->b, title);
>  			continue;
>  		}
> @@ -1204,7 +1207,15 @@ static struct thread *hist_browser__selected_thread(struct hist_browser *browser
>  	return browser->he_selection->thread;
>  }
>  
> -static int hists__browser_title(struct hists *hists, char *bf, size_t size)
> +/* Check whether the browser is for 'top' or 'report' */
> +static inline bool is_report_browser(void *timer)
> +{
> +	return timer == NULL;
> +}
> +
> +static int hists__browser_title(struct hists *hists,
> +				struct hist_browser_timer *hbt,
> +				char *bf, size_t size)
>  {
>  	char unit;
>  	int printed;
> @@ -1256,6 +1267,13 @@ static int hists__browser_title(struct hists *hists, char *bf, size_t size)
>  	if (dso)
>  		printed += scnprintf(bf + printed, size - printed,
>  				    ", DSO: %s", dso->short_name);
> +	if (!is_report_browser(hbt)) {
> +		struct perf_top *top = hbt->arg;
> +
> +		if (top->zero)
> +			printed += scnprintf(bf + printed, size - printed, " [z]");
> +	}
> +
>  	return printed;
>  }
>  
> @@ -1267,12 +1285,6 @@ static inline void free_popup_options(char **options, int n)
>  		zfree(&options[i]);
>  }
>  
> -/* Check whether the browser is for 'top' or 'report' */
> -static inline bool is_report_browser(void *timer)
> -{
> -	return timer == NULL;
> -}
> -
>  /*
>   * Only runtime switching of perf data file will make "input_name" point
>   * to a malloced buffer. So add "is_input_name_malloced" flag to decide

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH resend] perf top: Add a visual cue for toggle zeroing of samples
  2014-10-08  0:48 ` Namhyung Kim
@ 2014-10-15 18:48   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2014-10-15 18:48 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: Taeung Song, linux-kernel, Stephane Eranian

Em Wed, Oct 08, 2014 at 09:48:48AM +0900, Namhyung Kim escreveu:
> Hi Taeung,
> 
> On Tue,  7 Oct 2014 16:13:15 +0900, Taeung Song wrote:
> > When 'perf top' is run, one can't easily find a difference
> > between -z option and normal output.
> > So I added a visual cue to know whether it is the zeroing or not.
> >
> > Output is as below.
> >
> > Before:
> >  $ perf top
> >
> >  Samples: 61K of event 'cycles', Event count (approx.): 3908136933
> >  Overhead  Shared Object                       Symbol
> >     1.42%  firefox                             [.] 0x0000000000011e76
> >     1.32%  libpthread-2.17.so                  [.] pthread_mutex_lock
> >
> > If you press key 'z' or run with zero option like '$ perf top --zero', it is as below.
> >
> > After:
> >  Samples: 61K of event 'cycles', Event count (approx.): 3908136933 [z]
> >  Overhead  Shared Object                       Symbol
> >     1.42%  firefox                             [.] 0x0000000000011e76
> >     1.32%  libpthread-2.17.so                  [.] pthread_mutex_lock
> >
> > Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
> 
> Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks, applied.

- Arnaldo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip:perf/urgent] perf top: Add a visual cue for toggle zeroing of samples
  2014-10-07  7:13 [PATCH resend] perf top: Add a visual cue for toggle zeroing of samples Taeung Song
  2014-10-08  0:48 ` Namhyung Kim
@ 2014-10-16  5:21 ` tip-bot for Taeung Song
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Taeung Song @ 2014-10-16  5:21 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: eranian, tglx, linux-kernel, hpa, acme, treeze.taeung, mingo, namhyung

Commit-ID:  1e378ebd117d1828b9d5dbe0538887478fcb9d84
Gitweb:     http://git.kernel.org/tip/1e378ebd117d1828b9d5dbe0538887478fcb9d84
Author:     Taeung Song <treeze.taeung@gmail.com>
AuthorDate: Tue, 7 Oct 2014 16:13:15 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 15 Oct 2014 15:47:48 -0300

perf top: Add a visual cue for toggle zeroing of samples

When 'perf top' is run, one can't easily find a difference
between -z option and normal output.
So I added a visual cue to know whether it is the zeroing or not.

Output is as below.

Before:
 $ perf top

 Samples: 61K of event 'cycles', Event count (approx.): 3908136933
 Overhead  Shared Object                       Symbol
    1.42%  firefox                             [.] 0x0000000000011e76
    1.32%  libpthread-2.17.so                  [.] pthread_mutex_lock

If you press key 'z' or run with zero option like '$ perf top --zero', it is as below.

After:
 Samples: 61K of event 'cycles', Event count (approx.): 3908136933 [z]
 Overhead  Shared Object                       Symbol
    1.42%  firefox                             [.] 0x0000000000011e76
    1.32%  libpthread-2.17.so                  [.] pthread_mutex_lock

Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1412665995-26359-1-git-send-email-treeze.taeung@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/browsers/hists.c | 32 ++++++++++++++++++++++----------
 1 file changed, 22 insertions(+), 10 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 68eab9e..cfb976b 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -35,7 +35,9 @@ struct hist_browser {
 
 extern void hist_browser__init_hpp(void);
 
-static int hists__browser_title(struct hists *hists, char *bf, size_t size);
+static int hists__browser_title(struct hists *hists,
+				struct hist_browser_timer *hbt,
+				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,
@@ -390,7 +392,7 @@ static int hist_browser__run(struct hist_browser *browser,
 	browser->b.entries = &browser->hists->entries;
 	browser->b.nr_entries = hist_browser__nr_entries(browser);
 
-	hists__browser_title(browser->hists, title, sizeof(title));
+	hists__browser_title(browser->hists, hbt, title, sizeof(title));
 
 	if (ui_browser__show(&browser->b, title,
 			     "Press '?' for help on key bindings") < 0)
@@ -417,7 +419,8 @@ static int hist_browser__run(struct hist_browser *browser,
 				ui_browser__warn_lost_events(&browser->b);
 			}
 
-			hists__browser_title(browser->hists, title, sizeof(title));
+			hists__browser_title(browser->hists,
+					     hbt, title, sizeof(title));
 			ui_browser__show_title(&browser->b, title);
 			continue;
 		}
@@ -1204,7 +1207,15 @@ static struct thread *hist_browser__selected_thread(struct hist_browser *browser
 	return browser->he_selection->thread;
 }
 
-static int hists__browser_title(struct hists *hists, char *bf, size_t size)
+/* Check whether the browser is for 'top' or 'report' */
+static inline bool is_report_browser(void *timer)
+{
+	return timer == NULL;
+}
+
+static int hists__browser_title(struct hists *hists,
+				struct hist_browser_timer *hbt,
+				char *bf, size_t size)
 {
 	char unit;
 	int printed;
@@ -1258,6 +1269,13 @@ static int hists__browser_title(struct hists *hists, char *bf, size_t size)
 	if (dso)
 		printed += scnprintf(bf + printed, size - printed,
 				    ", DSO: %s", dso->short_name);
+	if (!is_report_browser(hbt)) {
+		struct perf_top *top = hbt->arg;
+
+		if (top->zero)
+			printed += scnprintf(bf + printed, size - printed, " [z]");
+	}
+
 	return printed;
 }
 
@@ -1269,12 +1287,6 @@ static inline void free_popup_options(char **options, int n)
 		zfree(&options[i]);
 }
 
-/* Check whether the browser is for 'top' or 'report' */
-static inline bool is_report_browser(void *timer)
-{
-	return timer == NULL;
-}
-
 /*
  * Only runtime switching of perf data file will make "input_name" point
  * to a malloced buffer. So add "is_input_name_malloced" flag to decide

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-10-16  5:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-07  7:13 [PATCH resend] perf top: Add a visual cue for toggle zeroing of samples Taeung Song
2014-10-08  0:48 ` Namhyung Kim
2014-10-15 18:48   ` Arnaldo Carvalho de Melo
2014-10-16  5:21 ` [tip:perf/urgent] " tip-bot for Taeung Song

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).