Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1305207 > unrolled thread

[PATCH 1/4] perf tools: Add more usage tips

Started byNamhyung Kim <namhyung@kernel.org>
First post2016-01-09 11:20 +0100
Last post2016-01-13 10:50 +0100
Articles 13 — 5 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/4] perf tools: Add more usage tips Namhyung Kim <namhyung@kernel.org> - 2016-01-09 11:20 +0100
    [PATCH 4/4] perf tools: Fallback to srcdir/Documentation/tips.txt Namhyung Kim <namhyung@kernel.org> - 2016-01-09 11:20 +0100
      Re: [PATCH 4/4] perf tools: Fallback to srcdir/Documentation/tips.txt Jiri Olsa <jolsa@redhat.com> - 2016-01-11 10:20 +0100
        Re: [PATCH 4/4] perf tools: Fallback to srcdir/Documentation/tips.txt Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-12 16:40 +0100
          Re: [PATCH 4/4] perf tools: Fallback to srcdir/Documentation/tips.txt Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-12 16:40 +0100
      Re: [PATCH 4/4] perf tools: Fallback to srcdir/Documentation/tips.txt Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-12 16:30 +0100
      [tip:perf/urgent] perf tools: Fallback to srcdir/Documentation/  tips.txt tip-bot for Namhyung Kim <tipbot@zytor.com> - 2016-01-13 10:50 +0100
    Re: [PATCH 1/4] perf tools: Add more usage tips Andi Kleen <andi@firstfloor.org> - 2016-01-10 04:40 +0100
      [PATCH v2 1/4] perf tools: Add more usage tips Namhyung Kim <namhyung@kernel.org> - 2016-01-11 11:40 +0100
        [PATCH 5/4] perf ui/tui: Print helpline message as is Namhyung Kim <namhyung@kernel.org> - 2016-01-11 12:00 +0100
          Re: [PATCH 5/4] perf ui/tui: Print helpline message as is Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-01-12 16:30 +0100
          [tip:perf/urgent] perf ui/tui: Print helpline message as is tip-bot for Namhyung Kim <tipbot@zytor.com> - 2016-01-13 10:50 +0100
        [tip:perf/urgent] perf tools: Add more usage tips tip-bot for Namhyung Kim <tipbot@zytor.com> - 2016-01-13 10:50 +0100

#1305207 — [PATCH 1/4] perf tools: Add more usage tips

FromNamhyung Kim <namhyung@kernel.org>
Date2016-01-09 11:20 +0100
Subject[PATCH 1/4] perf tools: Add more usage tips
Message-ID<qOYMO-44U-9@gated-at.bofh.it>
Thanks to Andi Kleen for providing useful tips.

Suggested-by: Andi Kleen <andi@firstfloor.org>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/Documentation/tips.txt | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tools/perf/Documentation/tips.txt b/tools/perf/Documentation/tips.txt
index a1c10e360db5..2319ff7fa53b 100644
--- a/tools/perf/Documentation/tips.txt
+++ b/tools/perf/Documentation/tips.txt
@@ -12,3 +12,18 @@ List events using substring match: perf list <keyword>
 To see list of saved events and attributes: perf evlist -v
 Use --symfs <dir> if your symbol files are in non-standard locations
 To see callchains in a more compact form: perf report -g folded
+Show individual samples with: perf script
+Limit to show entries above 5% only: perf report --percent-limit 5
+Profiling branch (mis)predictions with: perf record -b / perf report
+Treat branches as callchains: perf report --branch-history
+To count events in every 1000 msec: perf stat -I 1000
+Print event counts in CSV format with: perf stat -x
+If you have debuginfo enabled, try: perf report -s sym,srcline
+For memory address profiling, try: perf mem record / perf mem report
+For tracepoint events, try: perf report -s trace_fields
+To record callchains for each sample: perf record -g
+To record every process run by an user: perf record -u <user>
+Skip collecing build-id when recording: perf record -B
+To change sampling frequency to 100 Hz: perf record -F 100
+See assembly instructions with percentage: perf annotate <symbol>
+If you prefer Intel style assembly, try: perf annotate -M intel
-- 
2.6.4

[toc] | [next] | [standalone]


#1305208 — [PATCH 4/4] perf tools: Fallback to srcdir/Documentation/tips.txt

FromNamhyung Kim <namhyung@kernel.org>
Date2016-01-09 11:20 +0100
Subject[PATCH 4/4] perf tools: Fallback to srcdir/Documentation/tips.txt
Message-ID<qOYMO-44U-23@gated-at.bofh.it>
In reply to#1305207
Some people don't install perf, but just use compiled version in the
source.  Fallback to lookup the source directory for those poor guys. :)

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/builtin-report.c | 10 +++++++++-
 tools/perf/util/util.c      | 11 ++++++-----
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index d5a42ee12529..2bf537f190a0 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -28,6 +28,7 @@
 #include "util/tool.h"
 
 #include <subcmd/parse-options.h>
+#include <subcmd/exec-cmd.h>
 #include "util/parse-events.h"
 
 #include "util/thread.h"
@@ -433,7 +434,14 @@ static int report__browse_hists(struct report *rep)
 	int ret;
 	struct perf_session *session = rep->session;
 	struct perf_evlist *evlist = session->evlist;
-	const char *help = perf_tip(TIPDIR);
+	const char *help = perf_tip(system_path(TIPDIR));
+
+	if (help == NULL) {
+		/* fallback for people who don't install perf ;-) */
+		help = perf_tip(DOCDIR);
+		if (help == NULL)
+			help = "Cannot load tips.txt file, please install perf!";
+	}
 
 	switch (use_browser) {
 	case 1:
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 88b8f8d21f58..92e8543dadf9 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -17,7 +17,6 @@
 #include <unistd.h>
 #include "callchain.h"
 #include "strlist.h"
-#include <subcmd/exec-cmd.h>
 
 struct callchain_param	callchain_param = {
 	.mode	= CHAIN_GRAPH_ABS,
@@ -672,14 +671,16 @@ const char *perf_tip(const char *dirpath)
 	struct str_node *node;
 	char *tip = NULL;
 	struct strlist_config conf = {
-		.dirname = system_path(dirpath) ,
+		.dirname = dirpath,
+		.file_only = true,
 	};
 
 	tips = strlist__new("tips.txt", &conf);
-	if (tips == NULL || strlist__nr_entries(tips) == 1) {
-		tip = (char *)"Cannot find tips.txt file";
+	if (tips == NULL)
+		return "Tip: get more memory! ;-p";
+
+	if (strlist__nr_entries(tips) == 0)
 		goto out;
-	}
 
 	node = strlist__entry(tips, random() % strlist__nr_entries(tips));
 	if (asprintf(&tip, "Tip: %s", node->s) < 0)
-- 
2.6.4

[toc] | [prev] | [next] | [standalone]


#1305969 — Re: [PATCH 4/4] perf tools: Fallback to srcdir/Documentation/tips.txt

FromJiri Olsa <jolsa@redhat.com>
Date2016-01-11 10:20 +0100
SubjectRe: [PATCH 4/4] perf tools: Fallback to srcdir/Documentation/tips.txt
Message-ID<qPGNQ-iR-3@gated-at.bofh.it>
In reply to#1305208
On Sat, Jan 09, 2016 at 07:16:29PM +0900, Namhyung Kim wrote:
> Some people don't install perf, but just use compiled version in the
> source.  Fallback to lookup the source directory for those poor guys. :)
> 
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  tools/perf/builtin-report.c | 10 +++++++++-
>  tools/perf/util/util.c      | 11 ++++++-----
>  2 files changed, 15 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index d5a42ee12529..2bf537f190a0 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -28,6 +28,7 @@
>  #include "util/tool.h"
>  
>  #include <subcmd/parse-options.h>
> +#include <subcmd/exec-cmd.h>
>  #include "util/parse-events.h"
>  
>  #include "util/thread.h"
> @@ -433,7 +434,14 @@ static int report__browse_hists(struct report *rep)
>  	int ret;
>  	struct perf_session *session = rep->session;
>  	struct perf_evlist *evlist = session->evlist;
> -	const char *help = perf_tip(TIPDIR);
> +	const char *help = perf_tip(system_path(TIPDIR));
> +
> +	if (help == NULL) {
> +		/* fallback for people who don't install perf ;-) */
> +		help = perf_tip(DOCDIR);
> +		if (help == NULL)
> +			help = "Cannot load tips.txt file, please install perf!";
> +	}

hum, I can't get this one.. seems like perf_tip does
not retun NULL if there's no tip.txt file

jirka

[toc] | [prev] | [next] | [standalone]


#1307557 — Re: [PATCH 4/4] perf tools: Fallback to srcdir/Documentation/tips.txt

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2016-01-12 16:40 +0100
SubjectRe: [PATCH 4/4] perf tools: Fallback to srcdir/Documentation/tips.txt
Message-ID<qQ9d8-2Sx-15@gated-at.bofh.it>
In reply to#1305969
Em Mon, Jan 11, 2016 at 10:18:20AM +0100, Jiri Olsa escreveu:
> On Sat, Jan 09, 2016 at 07:16:29PM +0900, Namhyung Kim wrote:
> > Some people don't install perf, but just use compiled version in the
> > source.  Fallback to lookup the source directory for those poor guys. :)
> > 
> > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> > ---
> >  tools/perf/builtin-report.c | 10 +++++++++-
> >  tools/perf/util/util.c      | 11 ++++++-----
> >  2 files changed, 15 insertions(+), 6 deletions(-)
> > 
> > diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> > index d5a42ee12529..2bf537f190a0 100644
> > --- a/tools/perf/builtin-report.c
> > +++ b/tools/perf/builtin-report.c
> > @@ -28,6 +28,7 @@
> >  #include "util/tool.h"
> >  
> >  #include <subcmd/parse-options.h>
> > +#include <subcmd/exec-cmd.h>
> >  #include "util/parse-events.h"
> >  
> >  #include "util/thread.h"
> > @@ -433,7 +434,14 @@ static int report__browse_hists(struct report *rep)
> >  	int ret;
> >  	struct perf_session *session = rep->session;
> >  	struct perf_evlist *evlist = session->evlist;
> > -	const char *help = perf_tip(TIPDIR);
> > +	const char *help = perf_tip(system_path(TIPDIR));
> > +
> > +	if (help == NULL) {
> > +		/* fallback for people who don't install perf ;-) */
> > +		help = perf_tip(DOCDIR);
> > +		if (help == NULL)
> > +			help = "Cannot load tips.txt file, please install perf!";
> > +	}
> 
> hum, I can't get this one.. seems like perf_tip does
> not retun NULL if there's no tip.txt file

Neither me, fixing it up, this fallback will never take place.

- Arnaldo

[toc] | [prev] | [next] | [standalone]


#1307565 — Re: [PATCH 4/4] perf tools: Fallback to srcdir/Documentation/tips.txt

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2016-01-12 16:40 +0100
SubjectRe: [PATCH 4/4] perf tools: Fallback to srcdir/Documentation/tips.txt
Message-ID<qQ9d9-2Sx-35@gated-at.bofh.it>
In reply to#1307557
Em Tue, Jan 12, 2016 at 12:34:35PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Mon, Jan 11, 2016 at 10:18:20AM +0100, Jiri Olsa escreveu:
> > On Sat, Jan 09, 2016 at 07:16:29PM +0900, Namhyung Kim wrote:
> > > +		help = perf_tip(DOCDIR);
> > > +		if (help == NULL)
> > > +			help = "Cannot load tips.txt file, please install perf!";
> > > +	}
> > 
> > hum, I can't get this one.. seems like perf_tip does
> > not retun NULL if there's no tip.txt file
> 
> Neither me, fixing it up, this fallback will never take place.

With this patch on top, it works:

[root@felicio ~]# perf trace --no-inherit -e access perf report --stdio
     0.094 ( 0.017 ms): access(filename: /etc/ld.so.preload, mode: R                          ) = -1 ENOENT No such file or directory
     1.940 ( 0.008 ms): access(filename: /home/acme/etc/perfconfig, mode: R                   ) = -1 ENOENT No such file or directory
     1.979 ( 0.004 ms): access(filename: /home/acme/etc/perfconfig, mode: R                   ) = -1 ENOENT No such file or directory
     2.000 ( 0.004 ms): access(filename: /home/acme/etc/perfconfig, mode: R                   ) = -1 ENOENT No such file or directory
     2.177 ( 0.006 ms): access(filename: /usr/bin/pager, mode: X                              ) = -1 ENOENT No such file or directory
     2.189 ( 0.011 ms): access(filename: /usr/bin/less, mode: X                               ) = 0
    17.250 ( 0.018 ms): access(filename: /home/acme/share/doc/perf-tip/tips.txt               ) = -1 ENOENT No such file or directory
    17.259 ( 0.006 ms): access(filename: /home/acme/git/linux/tools/perf/Documentation/tips.txt) = 0
# To display the perf.data header info, please use --header/--header-only options.
#
#
# Total Lost Samples: 0
#
# Samples: 5  of event 'cycles:pp'
# Event count (approx.): 24954605
#
# Overhead  Command  Shared Object     Symbol                   
# ........  .......  ................  .........................
#
    99.68%  usleep   [kernel.vmlinux]  [k] vma_rb_erase         
     0.32%  perf     [kernel.vmlinux]  [k] nmi_cpu_backtrace    
     0.00%  perf     [kernel.vmlinux]  [k] native_write_msr_safe


#
# (Tip: To see callchains in a more compact form: perf report -g folded)
#
[root@felicio ~]#

[toc] | [prev] | [next] | [standalone]


#1307541 — Re: [PATCH 4/4] perf tools: Fallback to srcdir/Documentation/tips.txt

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2016-01-12 16:30 +0100
SubjectRe: [PATCH 4/4] perf tools: Fallback to srcdir/Documentation/tips.txt
Message-ID<qQ93s-2Pd-31@gated-at.bofh.it>
In reply to#1305208
Em Sat, Jan 09, 2016 at 07:16:29PM +0900, Namhyung Kim escreveu:
> Some people don't install perf, but just use compiled version in the
> source.  Fallback to lookup the source directory for those poor guys. :)
> 
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>

So, after applying this I tried:

  $ rm -f ~/share/doc/perf-tip/tips.txt

  To make it fallback and:

  $ perf report --stdio | tail -3
  #
  # (Tip: get more memory! ;-p)
  #
  $ 

Doesn't work, looking at what it is trying to find:

  # perf trace --no-inherit -e access perf report --stdio
     0.090 ( 0.010 ms): access(filename: /etc/ld.so.preload, mode: R                          ) = -1 ENOENT No such file or directory
     2.013 ( 0.014 ms): access(filename: /home/acme/etc/perfconfig, mode: R                   ) = -1 ENOENT No such file or directory
     2.045 ( 0.004 ms): access(filename: /home/acme/etc/perfconfig, mode: R                   ) = -1 ENOENT No such file or directory
     2.076 ( 0.005 ms): access(filename: /home/acme/etc/perfconfig, mode: R                   ) = -1 ENOENT No such file or directory
     2.239 ( 0.006 ms): access(filename: /usr/bin/pager, mode: X                              ) = -1 ENOENT No such file or directory
     2.244 ( 0.004 ms): access(filename: /usr/bin/less, mode: X                               ) = 0
    16.969 ( 0.018 ms): access(filename: /home/acme/share/doc/perf-tip/tips.txt               ) = -1 ENOENT No such file or directory
  # To display the perf.data header info, please use --header/--header-only options.
  # 
  #
  # Total Lost Samples: 0
  #
  # Samples: 5  of event 'cycles:pp'
  # Event count (approx.): 24954605
  #
  # Overhead  Command  Shared Object     Symbol                   
  # ........  .......  ................  .........................
  #
    99.68%  usleep   [kernel.vmlinux]  [k] vma_rb_erase         
     0.32%  perf     [kernel.vmlinux]  [k] nmi_cpu_backtrace    
     0.00%  perf     [kernel.vmlinux]  [k] native_write_msr_safe

  #
  # (Tip: get more memory! ;-p)
  #
  #


Also you're not just fallbacking, you did this other unrelated change, no?

-     const char *help = perf_tip(TIPDIR);
+     const char *help = perf_tip(system_path(TIPDIR));


Investigating...

> ---
>  tools/perf/builtin-report.c | 10 +++++++++-
>  tools/perf/util/util.c      | 11 ++++++-----
>  2 files changed, 15 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index d5a42ee12529..2bf537f190a0 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -28,6 +28,7 @@
>  #include "util/tool.h"
>  
>  #include <subcmd/parse-options.h>
> +#include <subcmd/exec-cmd.h>
>  #include "util/parse-events.h"
>  
>  #include "util/thread.h"
> @@ -433,7 +434,14 @@ static int report__browse_hists(struct report *rep)
>  	int ret;
>  	struct perf_session *session = rep->session;
>  	struct perf_evlist *evlist = session->evlist;
> -	const char *help = perf_tip(TIPDIR);
> +	const char *help = perf_tip(system_path(TIPDIR));
> +
> +	if (help == NULL) {
> +		/* fallback for people who don't install perf ;-) */
> +		help = perf_tip(DOCDIR);
> +		if (help == NULL)
> +			help = "Cannot load tips.txt file, please install perf!";
> +	}
>  
>  	switch (use_browser) {
>  	case 1:
> diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
> index 88b8f8d21f58..92e8543dadf9 100644
> --- a/tools/perf/util/util.c
> +++ b/tools/perf/util/util.c
> @@ -17,7 +17,6 @@
>  #include <unistd.h>
>  #include "callchain.h"
>  #include "strlist.h"
> -#include <subcmd/exec-cmd.h>
>  
>  struct callchain_param	callchain_param = {
>  	.mode	= CHAIN_GRAPH_ABS,
> @@ -672,14 +671,16 @@ const char *perf_tip(const char *dirpath)
>  	struct str_node *node;
>  	char *tip = NULL;
>  	struct strlist_config conf = {
> -		.dirname = system_path(dirpath) ,
> +		.dirname = dirpath,
> +		.file_only = true,
>  	};
>  
>  	tips = strlist__new("tips.txt", &conf);
> -	if (tips == NULL || strlist__nr_entries(tips) == 1) {
> -		tip = (char *)"Cannot find tips.txt file";
> +	if (tips == NULL)
> +		return "Tip: get more memory! ;-p";
> +
> +	if (strlist__nr_entries(tips) == 0)
>  		goto out;
> -	}
>  
>  	node = strlist__entry(tips, random() % strlist__nr_entries(tips));
>  	if (asprintf(&tip, "Tip: %s", node->s) < 0)
> -- 
> 2.6.4

[toc] | [prev] | [next] | [standalone]


#1308234 — [tip:perf/urgent] perf tools: Fallback to srcdir/Documentation/ tips.txt

Fromtip-bot for Namhyung Kim <tipbot@zytor.com>
Date2016-01-13 10:50 +0100
Subject[tip:perf/urgent] perf tools: Fallback to srcdir/Documentation/ tips.txt
Message-ID<qQqe1-6f4-69@gated-at.bofh.it>
In reply to#1305208
Commit-ID:  34b7b0f95d41d2351a080e774d71085171db90e6
Gitweb:     http://git.kernel.org/tip/34b7b0f95d41d2351a080e774d71085171db90e6
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Sat, 9 Jan 2016 19:16:29 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 12 Jan 2016 12:42:08 -0300

perf tools: Fallback to srcdir/Documentation/tips.txt

Some people don't install perf, but just use compiled version in the
source.  Fallback to lookup the source directory for those poor guys. :)

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1452334589-8782-4-git-send-email-namhyung@kernel.org
[ Make perf_tip() return NULL for ENOENT, making the fallback to really take place ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-report.c | 10 +++++++++-
 tools/perf/util/util.c      | 11 ++++++-----
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index d5a42ee..2bf537f 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -28,6 +28,7 @@
 #include "util/tool.h"
 
 #include <subcmd/parse-options.h>
+#include <subcmd/exec-cmd.h>
 #include "util/parse-events.h"
 
 #include "util/thread.h"
@@ -433,7 +434,14 @@ static int report__browse_hists(struct report *rep)
 	int ret;
 	struct perf_session *session = rep->session;
 	struct perf_evlist *evlist = session->evlist;
-	const char *help = perf_tip(TIPDIR);
+	const char *help = perf_tip(system_path(TIPDIR));
+
+	if (help == NULL) {
+		/* fallback for people who don't install perf ;-) */
+		help = perf_tip(DOCDIR);
+		if (help == NULL)
+			help = "Cannot load tips.txt file, please install perf!";
+	}
 
 	switch (use_browser) {
 	case 1:
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 88b8f8d..ead9509 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -17,7 +17,6 @@
 #include <unistd.h>
 #include "callchain.h"
 #include "strlist.h"
-#include <subcmd/exec-cmd.h>
 
 struct callchain_param	callchain_param = {
 	.mode	= CHAIN_GRAPH_ABS,
@@ -672,14 +671,16 @@ const char *perf_tip(const char *dirpath)
 	struct str_node *node;
 	char *tip = NULL;
 	struct strlist_config conf = {
-		.dirname = system_path(dirpath) ,
+		.dirname = dirpath,
+		.file_only = true,
 	};
 
 	tips = strlist__new("tips.txt", &conf);
-	if (tips == NULL || strlist__nr_entries(tips) == 1) {
-		tip = (char *)"Cannot find tips.txt file";
+	if (tips == NULL)
+		return errno == ENOENT ? NULL : "Tip: get more memory! ;-p";
+
+	if (strlist__nr_entries(tips) == 0)
 		goto out;
-	}
 
 	node = strlist__entry(tips, random() % strlist__nr_entries(tips));
 	if (asprintf(&tip, "Tip: %s", node->s) < 0)

[toc] | [prev] | [next] | [standalone]


#1305411

FromAndi Kleen <andi@firstfloor.org>
Date2016-01-10 04:40 +0100
Message-ID<qPf1g-6S5-3@gated-at.bofh.it>
In reply to#1305207
> +Show individual samples with: perf script
> +Limit to show entries above 5% only: perf report --percent-limit 5
> +Profiling branch (mis)predictions with: perf record -b / perf report
> +Treat branches as callchains: perf report --branch-history
> +To count events in every 1000 msec: perf stat -I 1000
> +Print event counts in CSV format with: perf stat -x

Should be -x, 

-Andi

[toc] | [prev] | [next] | [standalone]


#1306027 — [PATCH v2 1/4] perf tools: Add more usage tips

FromNamhyung Kim <namhyung@kernel.org>
Date2016-01-11 11:40 +0100
Subject[PATCH v2 1/4] perf tools: Add more usage tips
Message-ID<qPI3f-13k-3@gated-at.bofh.it>
In reply to#1305411
Thanks to Andi Kleen for providing useful tips.

Suggested-by: Andi Kleen <andi@firstfloor.org>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/Documentation/tips.txt | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tools/perf/Documentation/tips.txt b/tools/perf/Documentation/tips.txt
index a1c10e360db5..e0ce9573b79b 100644
--- a/tools/perf/Documentation/tips.txt
+++ b/tools/perf/Documentation/tips.txt
@@ -12,3 +12,18 @@ List events using substring match: perf list <keyword>
 To see list of saved events and attributes: perf evlist -v
 Use --symfs <dir> if your symbol files are in non-standard locations
 To see callchains in a more compact form: perf report -g folded
+Show individual samples with: perf script
+Limit to show entries above 5% only: perf report --percent-limit 5
+Profiling branch (mis)predictions with: perf record -b / perf report
+Treat branches as callchains: perf report --branch-history
+To count events in every 1000 msec: perf stat -I 1000
+Print event counts in CSV format with: perf stat -x,
+If you have debuginfo enabled, try: perf report -s sym,srcline
+For memory address profiling, try: perf mem record / perf mem report
+For tracepoint events, try: perf report -s trace_fields
+To record callchains for each sample: perf record -g
+To record every process run by an user: perf record -u <user>
+Skip collecing build-id when recording: perf record -B
+To change sampling frequency to 100 Hz: perf record -F 100
+See assembly instructions with percentage: perf annotate <symbol>
+If you prefer Intel style assembly, try: perf annotate -M intel
-- 
2.6.4

[toc] | [prev] | [next] | [standalone]


#1306054 — [PATCH 5/4] perf ui/tui: Print helpline message as is

FromNamhyung Kim <namhyung@kernel.org>
Date2016-01-11 12:00 +0100
Subject[PATCH 5/4] perf ui/tui: Print helpline message as is
Message-ID<qPImC-1cN-5@gated-at.bofh.it>
In reply to#1306027
When a tip message contains a percent sign, it was treated printf format
specifier so broken string was printed like below.

  Tip: Limit to show entries above 577nly: perf report --percent-limit 5
                                   ^^^

As ui_browser__show receives format string, pass additional "%s" so that
the help (tip) message can be printed as is.

  Tip: Limit to show entries above 5% only: perf report --percent-limit 5

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/ui/browsers/hists.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 901d481e6cea..08c09ad755d2 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -480,7 +480,7 @@ static int hist_browser__run(struct hist_browser *browser, const char *help)
 
 	hists__browser_title(browser->hists, hbt, title, sizeof(title));
 
-	if (ui_browser__show(&browser->b, title, help) < 0)
+	if (ui_browser__show(&browser->b, title, "%s", help) < 0)
 		return -1;
 
 	while (1) {
-- 
2.6.4

[toc] | [prev] | [next] | [standalone]


#1307543 — Re: [PATCH 5/4] perf ui/tui: Print helpline message as is

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2016-01-12 16:30 +0100
SubjectRe: [PATCH 5/4] perf ui/tui: Print helpline message as is
Message-ID<qQ93t-2Pd-39@gated-at.bofh.it>
In reply to#1306054
Em Mon, Jan 11, 2016 at 07:53:14PM +0900, Namhyung Kim escreveu:
> When a tip message contains a percent sign, it was treated printf format
> specifier so broken string was printed like below.
> 
>   Tip: Limit to show entries above 577nly: perf report --percent-limit 5
>                                    ^^^
> 
> As ui_browser__show receives format string, pass additional "%s" so that
> the help (tip) message can be printed as is.
> 
>   Tip: Limit to show entries above 5% only: perf report --percent-limit 5

Applied.
 
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  tools/perf/ui/browsers/hists.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
> index 901d481e6cea..08c09ad755d2 100644
> --- a/tools/perf/ui/browsers/hists.c
> +++ b/tools/perf/ui/browsers/hists.c
> @@ -480,7 +480,7 @@ static int hist_browser__run(struct hist_browser *browser, const char *help)
>  
>  	hists__browser_title(browser->hists, hbt, title, sizeof(title));
>  
> -	if (ui_browser__show(&browser->b, title, help) < 0)
> +	if (ui_browser__show(&browser->b, title, "%s", help) < 0)
>  		return -1;
>  
>  	while (1) {
> -- 
> 2.6.4

[toc] | [prev] | [next] | [standalone]


#1308226 — [tip:perf/urgent] perf ui/tui: Print helpline message as is

Fromtip-bot for Namhyung Kim <tipbot@zytor.com>
Date2016-01-13 10:50 +0100
Subject[tip:perf/urgent] perf ui/tui: Print helpline message as is
Message-ID<qQqdZ-6f4-31@gated-at.bofh.it>
In reply to#1306054
Commit-ID:  090cff3eae8f02395009972d01b5dfdb95bcc327
Gitweb:     http://git.kernel.org/tip/090cff3eae8f02395009972d01b5dfdb95bcc327
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Mon, 11 Jan 2016 19:53:14 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 12 Jan 2016 12:42:08 -0300

perf ui/tui: Print helpline message as is

When a tip message contains a percent sign, it was treated printf format
specifier so broken string was printed like below.

  Tip: Limit to show entries above 577nly: perf report --percent-limit 5
                                   ^^^

As ui_browser__show receives format string, pass additional "%s" so that
the help (tip) message can be printed as is.

  Tip: Limit to show entries above 5% only: perf report --percent-limit 5

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1452509594-13616-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/browsers/hists.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 901d481..08c09ad 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -480,7 +480,7 @@ static int hist_browser__run(struct hist_browser *browser, const char *help)
 
 	hists__browser_title(browser->hists, hbt, title, sizeof(title));
 
-	if (ui_browser__show(&browser->b, title, help) < 0)
+	if (ui_browser__show(&browser->b, title, "%s", help) < 0)
 		return -1;
 
 	while (1) {

[toc] | [prev] | [next] | [standalone]


#1308218 — [tip:perf/urgent] perf tools: Add more usage tips

Fromtip-bot for Namhyung Kim <tipbot@zytor.com>
Date2016-01-13 10:50 +0100
Subject[tip:perf/urgent] perf tools: Add more usage tips
Message-ID<qQqdY-6f4-1@gated-at.bofh.it>
In reply to#1306027
Commit-ID:  09f1985404aa99b9d1ad435fcb0dabd20d4ed498
Gitweb:     http://git.kernel.org/tip/09f1985404aa99b9d1ad435fcb0dabd20d4ed498
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Mon, 11 Jan 2016 19:35:10 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 12 Jan 2016 12:42:07 -0300

perf tools: Add more usage tips

Thanks to Andi Kleen for providing useful tips.

Suggested-by: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1452508510-28316-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/tips.txt | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tools/perf/Documentation/tips.txt b/tools/perf/Documentation/tips.txt
index a1c10e3..e0ce957 100644
--- a/tools/perf/Documentation/tips.txt
+++ b/tools/perf/Documentation/tips.txt
@@ -12,3 +12,18 @@ List events using substring match: perf list <keyword>
 To see list of saved events and attributes: perf evlist -v
 Use --symfs <dir> if your symbol files are in non-standard locations
 To see callchains in a more compact form: perf report -g folded
+Show individual samples with: perf script
+Limit to show entries above 5% only: perf report --percent-limit 5
+Profiling branch (mis)predictions with: perf record -b / perf report
+Treat branches as callchains: perf report --branch-history
+To count events in every 1000 msec: perf stat -I 1000
+Print event counts in CSV format with: perf stat -x,
+If you have debuginfo enabled, try: perf report -s sym,srcline
+For memory address profiling, try: perf mem record / perf mem report
+For tracepoint events, try: perf report -s trace_fields
+To record callchains for each sample: perf record -g
+To record every process run by an user: perf record -u <user>
+Skip collecing build-id when recording: perf record -B
+To change sampling frequency to 100 Hz: perf record -F 100
+See assembly instructions with percentage: perf annotate <symbol>
+If you prefer Intel style assembly, try: perf annotate -M intel

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web