Re: [PATCH] perf top: Add a visual cue for toggle zeroing of samples

2014-10-07 Thread taeung

Thanks for answering.

I resend a patch according to your advices.

And I also added the stdio output to the patch as below.

If you have time and check the patch I resend,
I'd appreciate it.

Thanks,
Taeung

On 10/07/2014 02:26 PM, Namhyung Kim wrote:

Hi Taeung,

On Sun,  5 Oct 2014 15:49:34 +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.


[SNIP]

+static int hists__browser_title(struct hists *hists,
+   struct hist_browser_timer *hbt,
+   char *bf,
+   size_t size)

You don't need to align arguments like this.



  {
char unit;
int printed;
@@ -1256,6 +1268,14 @@ 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]", "");

It seems the final empty string can go away.  And personally I'd like to
get rid of "," before "[z]" also.

Otherwise looks good to me.  Could you please take a look at the stdio
output too?

Thanks,
Namhyung



+   }
+
return printed;
  }
  
@@ -1267,12 +1287,6 @@ static inline void free_popup_options(char **options, int n)

zfree([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


--
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] perf top: Add a visual cue for toggle zeroing of samples

2014-10-07 Thread taeung

Thanks for answering.

I resend a patch according to your advices.

And I also added the stdio output to the patch as below.

If you have time and check the patch I resend,
I'd appreciate it.

Thanks,
Taeung

On 10/07/2014 02:26 PM, Namhyung Kim wrote:

Hi Taeung,

On Sun,  5 Oct 2014 15:49:34 +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.


[SNIP]

+static int hists__browser_title(struct hists *hists,
+   struct hist_browser_timer *hbt,
+   char *bf,
+   size_t size)

You don't need to align arguments like this.



  {
char unit;
int printed;
@@ -1256,6 +1268,14 @@ 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], );

It seems the final empty string can go away.  And personally I'd like to
get rid of , before [z] also.

Otherwise looks good to me.  Could you please take a look at the stdio
output too?

Thanks,
Namhyung



+   }
+
return printed;
  }
  
@@ -1267,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


--
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] perf top: Add a visual cue for toggle zeroing of samples

2014-10-06 Thread Namhyung Kim
Hi Taeung,

On Sun,  5 Oct 2014 15:49:34 +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.


[SNIP]
> +static int hists__browser_title(struct hists *hists,
> + struct hist_browser_timer *hbt,
> + char *bf,
> + size_t size)

You don't need to align arguments like this.


>  {
>   char unit;
>   int printed;
> @@ -1256,6 +1268,14 @@ 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]", "");

It seems the final empty string can go away.  And personally I'd like to
get rid of "," before "[z]" also.

Otherwise looks good to me.  Could you please take a look at the stdio
output too?

Thanks,
Namhyung


> + }
> +
>   return printed;
>  }
>  
> @@ -1267,12 +1287,6 @@ static inline void free_popup_options(char **options, 
> int n)
>   zfree([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
--
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] perf top: Add a visual cue for toggle zeroing of samples

2014-10-06 Thread Namhyung Kim
Hi Taeung,

On Sun,  5 Oct 2014 15:49:34 +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.


[SNIP]
 +static int hists__browser_title(struct hists *hists,
 + struct hist_browser_timer *hbt,
 + char *bf,
 + size_t size)

You don't need to align arguments like this.


  {
   char unit;
   int printed;
 @@ -1256,6 +1268,14 @@ 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], );

It seems the final empty string can go away.  And personally I'd like to
get rid of , before [z] also.

Otherwise looks good to me.  Could you please take a look at the stdio
output too?

Thanks,
Namhyung


 + }
 +
   return printed;
  }
  
 @@ -1267,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
--
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] perf top: Add a visual cue for toggle zeroing of samples

2014-10-05 Thread 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.

Signed-off-by: Taeung Song 
---
 tools/perf/ui/browsers/hists.c | 34 --
 1 file changed, 24 insertions(+), 10 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 8f60a97..6af157c 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 = >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(>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(>b);
}
 
-   hists__browser_title(browser->hists, title, 
sizeof(title));
+   hists__browser_title(browser->hists,
+hbt, title, sizeof(title));
ui_browser__show_title(>b, title);
continue;
}
@@ -1204,7 +1207,16 @@ 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 +1268,14 @@ 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 +1287,6 @@ static inline void free_popup_options(char **options, 
int n)
zfree([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.9.1

--
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] perf top: Add a visual cue for toggle zeroing of samples

2014-10-05 Thread 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.

Signed-off-by: Taeung Song treeze.tae...@gmail.com
---
 tools/perf/ui/browsers/hists.c | 34 --
 1 file changed, 24 insertions(+), 10 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 8f60a97..6af157c 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,16 @@ 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 +1268,14 @@ 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 +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
-- 
1.9.1

--
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] perf top: Add a visual cue for toggle zeroing of samples

2014-10-04 Thread 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.

Signed-off-by: Taeung Song 
---
 tools/perf/PERF-FEATURES   |  1 +
 tools/perf/ui/browsers/hists.c | 34 --
 2 files changed, 25 insertions(+), 10 deletions(-)
 create mode 100644 tools/perf/PERF-FEATURES

diff --git a/tools/perf/PERF-FEATURES b/tools/perf/PERF-FEATURES
new file mode 100644
index 000..bf2723d
--- /dev/null
+++ b/tools/perf/PERF-FEATURES
@@ -0,0 +1 @@
+feature-dwarf(1) feature-glibc(1) feature-gtk2(0) feature-libaudit(1) 
feature-libbfd(0) feature-libelf(1) feature-libnuma(1) feature-libperl(1) 
feature-libpython(0) feature-libslang(1) feature-libunwind(1) 
feature-libdw-dwarf-unwind(1) dwarf-post-unwind(libunwind)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 8f60a97..6af157c 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 = >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(>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(>b);
}
 
-   hists__browser_title(browser->hists, title, 
sizeof(title));
+   hists__browser_title(browser->hists,
+hbt, title, sizeof(title));
ui_browser__show_title(>b, title);
continue;
}
@@ -1204,7 +1207,16 @@ 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 +1268,14 @@ 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 +1287,6 @@ static inline void free_popup_options(char **options, 
int n)
zfree([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.9.1

--
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] perf top: Add a visual cue for toggle zeroing of samples

2014-10-04 Thread 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.

Signed-off-by: Taeung Song 
---
 tools/perf/ui/browsers/hists.c | 38 ++
 1 file changed, 26 insertions(+), 12 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 8f60a97..be49363 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 = >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(>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(>b);
}
 
-   hists__browser_title(browser->hists, title, 
sizeof(title));
+   hists__browser_title(browser->hists,
+hbt, title, sizeof(title));
ui_browser__show_title(>b, title);
continue;
}
@@ -1204,7 +1207,16 @@ 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;
@@ -1241,7 +1253,7 @@ static int hists__browser_title(struct hists *hists, char 
*bf, size_t size)
 
nr_samples = convert_unit(nr_samples, );
printed = scnprintf(bf, size,
-  "Samples: %lu%c of event '%s', Event count 
(approx.): %lu",
+  "Samples: %lu%c of event z'%s', Event count 
(approx.): %lu",
   nr_samples, unit, ev_name, nr_events);
 
 
@@ -1255,7 +1267,15 @@ static int hists__browser_title(struct hists *hists, 
char *bf, size_t size)
thread->tid);
if (dso)
printed += scnprintf(bf + printed, size - printed,
-   ", DSO: %s", dso->short_name);
+", 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 +1287,6 @@ static inline void free_popup_options(char **options, 
int n)
zfree([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.9.1

--
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] perf top: Add a visual cue for toggle zeroing of samples

2014-10-04 Thread 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.

Signed-off-by: Taeung Song treeze.tae...@gmail.com
---
 tools/perf/ui/browsers/hists.c | 38 ++
 1 file changed, 26 insertions(+), 12 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 8f60a97..be49363 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,16 @@ 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;
@@ -1241,7 +1253,7 @@ static int hists__browser_title(struct hists *hists, char 
*bf, size_t size)
 
nr_samples = convert_unit(nr_samples, unit);
printed = scnprintf(bf, size,
-  Samples: %lu%c of event '%s', Event count 
(approx.): %lu,
+  Samples: %lu%c of event z'%s', Event count 
(approx.): %lu,
   nr_samples, unit, ev_name, nr_events);
 
 
@@ -1255,7 +1267,15 @@ static int hists__browser_title(struct hists *hists, 
char *bf, size_t size)
thread-tid);
if (dso)
printed += scnprintf(bf + printed, size - printed,
-   , DSO: %s, dso-short_name);
+, 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 +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
-- 
1.9.1

--
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] perf top: Add a visual cue for toggle zeroing of samples

2014-10-04 Thread 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.

Signed-off-by: Taeung Song treeze.tae...@gmail.com
---
 tools/perf/PERF-FEATURES   |  1 +
 tools/perf/ui/browsers/hists.c | 34 --
 2 files changed, 25 insertions(+), 10 deletions(-)
 create mode 100644 tools/perf/PERF-FEATURES

diff --git a/tools/perf/PERF-FEATURES b/tools/perf/PERF-FEATURES
new file mode 100644
index 000..bf2723d
--- /dev/null
+++ b/tools/perf/PERF-FEATURES
@@ -0,0 +1 @@
+feature-dwarf(1) feature-glibc(1) feature-gtk2(0) feature-libaudit(1) 
feature-libbfd(0) feature-libelf(1) feature-libnuma(1) feature-libperl(1) 
feature-libpython(0) feature-libslang(1) feature-libunwind(1) 
feature-libdw-dwarf-unwind(1) dwarf-post-unwind(libunwind)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 8f60a97..6af157c 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,16 @@ 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 +1268,14 @@ 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 +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
-- 
1.9.1

--
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/