linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] perf record: Add option to print perf_event_open args and return value
@ 2019-11-08  3:59 Ravi Bangoria
  2019-11-08  8:04 ` Jiri Olsa
  0 siblings, 1 reply; 11+ messages in thread
From: Ravi Bangoria @ 2019-11-08  3:59 UTC (permalink / raw)
  To: acme; +Cc: jolsa, linux-kernel, Ravi Bangoria

Perf record with verbose=2 already prints this information along with
whole lot of other traces which requires lot of scrolling. I thought
to show this information in verbose=1 but I fear that it will be too
much for level 1. So finally created a new option specifically for
printing this.

Sample o/p:
  $ ./perf record --peo-args -- ls > /dev/null
  ------------------------------------------------------------
  perf_event_attr:
    size                             112
    { sample_period, sample_freq }   4000
    sample_type                      IP|TID|TIME|PERIOD
    read_format                      ID
    disabled                         1
    inherit                          1
    exclude_kernel                   1
    mmap                             1
    comm                             1
    freq                             1
    enable_on_exec                   1
    task                             1
    precise_ip                       3
    sample_id_all                    1
    exclude_guest                    1
    mmap2                            1
    comm_exec                        1
    ksymbol                          1
    bpf_event                        1
  ------------------------------------------------------------
  sys_perf_event_open: pid 4308  cpu 0  group_fd -1  flags 0x8 = 4
  sys_perf_event_open: pid 4308  cpu 1  group_fd -1  flags 0x8 = 5
  sys_perf_event_open: pid 4308  cpu 2  group_fd -1  flags 0x8 = 6
  sys_perf_event_open: pid 4308  cpu 3  group_fd -1  flags 0x8 = 8
  sys_perf_event_open: pid 4308  cpu 4  group_fd -1  flags 0x8 = 9
  sys_perf_event_open: pid 4308  cpu 5  group_fd -1  flags 0x8 = 10
  sys_perf_event_open: pid 4308  cpu 6  group_fd -1  flags 0x8 = 11
  sys_perf_event_open: pid 4308  cpu 7  group_fd -1  flags 0x8 = 12
  ------------------------------------------------------------
  perf_event_attr:
    type                             1
    size                             112
    config                           0x9
    watermark                        1
    sample_id_all                    1
    bpf_event                        1
    { wakeup_events, wakeup_watermark } 1
  ------------------------------------------------------------
  sys_perf_event_open: pid -1  cpu 0  group_fd -1  flags 0x8
  sys_perf_event_open failed, error -13
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.002 MB perf.data (9 samples) ]

Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
---
 tools/perf/Documentation/perf-record.txt |  3 ++
 tools/perf/builtin-record.c              |  1 +
 tools/perf/util/debug.c                  |  1 +
 tools/perf/util/debug.h                  |  9 ++++++
 tools/perf/util/evsel.c                  | 36 ++++++++++++------------
 5 files changed, 32 insertions(+), 18 deletions(-)

diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt
index c6f9f31b6039..8257c9b28c13 100644
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -268,6 +268,9 @@ OPTIONS
 --verbose::
 	Be more verbose (show counter open errors, etc).
 
+--peo-args::
+	Print perf_event_open() arguments and return value.
+
 -s::
 --stat::
 	Record per-thread event counts.  Use it with 'perf report -T' to see
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 23332861de6e..ebb09238fcb0 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -2159,6 +2159,7 @@ static struct option __record_options[] = {
 		     &record_parse_callchain_opt),
 	OPT_INCR('v', "verbose", &verbose,
 		    "be more verbose (show counter open errors, etc)"),
+	OPT_BOOLEAN(0, "peo-args", &peo_args, "Print perf_event_open() args and return value"),
 	OPT_BOOLEAN('q', "quiet", &quiet, "don't print any message"),
 	OPT_BOOLEAN('s', "stat", &record.opts.inherit_stat,
 		    "per thread counts"),
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c
index e55114f0336f..692cf6788a55 100644
--- a/tools/perf/util/debug.c
+++ b/tools/perf/util/debug.c
@@ -24,6 +24,7 @@
 #include <linux/ctype.h>
 
 int verbose;
+bool peo_args;
 bool dump_trace = false, quiet = false;
 int debug_ordered_events;
 static int redirect_to_stderr;
diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h
index d25ae1c4cee9..3e54c5d86f3d 100644
--- a/tools/perf/util/debug.h
+++ b/tools/perf/util/debug.h
@@ -8,6 +8,7 @@
 #include <linux/compiler.h>
 
 extern int verbose;
+extern bool peo_args;
 extern bool quiet, dump_trace;
 extern int debug_ordered_events;
 extern int debug_data_convert;
@@ -30,6 +31,14 @@ extern int debug_data_convert;
 #define pr_debug3(fmt, ...) pr_debugN(3, pr_fmt(fmt), ##__VA_ARGS__)
 #define pr_debug4(fmt, ...) pr_debugN(4, pr_fmt(fmt), ##__VA_ARGS__)
 
+/* Special macro to print perf_event_open arguments/return value. */
+#define pr_debug2_peo(fmt, ...) {				\
+	if (peo_args)						\
+		pr_debugN(0, pr_fmt(fmt), ##__VA_ARGS__);	\
+	else							\
+		pr_debugN(2, pr_fmt(fmt), ##__VA_ARGS__);	\
+}
+
 #define pr_time_N(n, var, t, fmt, ...) \
 	eprintf_time(n, var, t, fmt, ##__VA_ARGS__)
 
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index abc7fda4a0fe..f87ab5c4a29b 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1524,7 +1524,7 @@ static int __open_attr__fprintf(FILE *fp, const char *name, const char *val,
 
 static void display_attr(struct perf_event_attr *attr)
 {
-	if (verbose >= 2) {
+	if (verbose >= 2 || peo_args) {
 		fprintf(stderr, "%.60s\n", graph_dotted_line);
 		fprintf(stderr, "perf_event_attr:\n");
 		perf_event_attr__fprintf(stderr, attr, __open_attr__fprintf, NULL);
@@ -1540,7 +1540,7 @@ static int perf_event_open(struct evsel *evsel,
 	int fd;
 
 	while (1) {
-		pr_debug2("sys_perf_event_open: pid %d  cpu %d  group_fd %d  flags %#lx",
+		pr_debug2_peo("sys_perf_event_open: pid %d  cpu %d  group_fd %d  flags %#lx",
 			  pid, cpu, group_fd, flags);
 
 		fd = sys_perf_event_open(&evsel->core.attr, pid, cpu, group_fd, flags);
@@ -1560,9 +1560,9 @@ static int perf_event_open(struct evsel *evsel,
 			break;
 		}
 
-		pr_debug2("\nsys_perf_event_open failed, error %d\n", -ENOTSUP);
+		pr_debug2_peo("\nsys_perf_event_open failed, error %d\n", -ENOTSUP);
 		evsel->core.attr.precise_ip--;
-		pr_debug2("decreasing precise_ip by one (%d)\n", evsel->core.attr.precise_ip);
+		pr_debug2_peo("decreasing precise_ip by one (%d)\n", evsel->core.attr.precise_ip);
 		display_attr(&evsel->core.attr);
 	}
 
@@ -1681,12 +1681,12 @@ int evsel__open(struct evsel *evsel, struct perf_cpu_map *cpus,
 					continue;
 				}
 
-				pr_debug2("\nsys_perf_event_open failed, error %d\n",
+				pr_debug2_peo("\nsys_perf_event_open failed, error %d\n",
 					  err);
 				goto try_fallback;
 			}
 
-			pr_debug2(" = %d\n", fd);
+			pr_debug2_peo(" = %d\n", fd);
 
 			if (evsel->bpf_fd >= 0) {
 				int evt_fd = fd;
@@ -1754,58 +1754,58 @@ int evsel__open(struct evsel *evsel, struct perf_cpu_map *cpus,
 	 */
 	if (!perf_missing_features.aux_output && evsel->core.attr.aux_output) {
 		perf_missing_features.aux_output = true;
-		pr_debug2("Kernel has no attr.aux_output support, bailing out\n");
+		pr_debug2_peo("Kernel has no attr.aux_output support, bailing out\n");
 		goto out_close;
 	} else if (!perf_missing_features.bpf && evsel->core.attr.bpf_event) {
 		perf_missing_features.bpf = true;
-		pr_debug2("switching off bpf_event\n");
+		pr_debug2_peo("switching off bpf_event\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.ksymbol && evsel->core.attr.ksymbol) {
 		perf_missing_features.ksymbol = true;
-		pr_debug2("switching off ksymbol\n");
+		pr_debug2_peo("switching off ksymbol\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.write_backward && evsel->core.attr.write_backward) {
 		perf_missing_features.write_backward = true;
-		pr_debug2("switching off write_backward\n");
+		pr_debug2_peo("switching off write_backward\n");
 		goto out_close;
 	} else if (!perf_missing_features.clockid_wrong && evsel->core.attr.use_clockid) {
 		perf_missing_features.clockid_wrong = true;
-		pr_debug2("switching off clockid\n");
+		pr_debug2_peo("switching off clockid\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.clockid && evsel->core.attr.use_clockid) {
 		perf_missing_features.clockid = true;
-		pr_debug2("switching off use_clockid\n");
+		pr_debug2_peo("switching off use_clockid\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.cloexec && (flags & PERF_FLAG_FD_CLOEXEC)) {
 		perf_missing_features.cloexec = true;
-		pr_debug2("switching off cloexec flag\n");
+		pr_debug2_peo("switching off cloexec flag\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.mmap2 && evsel->core.attr.mmap2) {
 		perf_missing_features.mmap2 = true;
-		pr_debug2("switching off mmap2\n");
+		pr_debug2_peo("switching off mmap2\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.exclude_guest &&
 		   (evsel->core.attr.exclude_guest || evsel->core.attr.exclude_host)) {
 		perf_missing_features.exclude_guest = true;
-		pr_debug2("switching off exclude_guest, exclude_host\n");
+		pr_debug2_peo("switching off exclude_guest, exclude_host\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.sample_id_all) {
 		perf_missing_features.sample_id_all = true;
-		pr_debug2("switching off sample_id_all\n");
+		pr_debug2_peo("switching off sample_id_all\n");
 		goto retry_sample_id;
 	} else if (!perf_missing_features.lbr_flags &&
 			(evsel->core.attr.branch_sample_type &
 			 (PERF_SAMPLE_BRANCH_NO_CYCLES |
 			  PERF_SAMPLE_BRANCH_NO_FLAGS))) {
 		perf_missing_features.lbr_flags = true;
-		pr_debug2("switching off branch sample type no (cycles/flags)\n");
+		pr_debug2_peo("switching off branch sample type no (cycles/flags)\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.group_read &&
 		    evsel->core.attr.inherit &&
 		   (evsel->core.attr.read_format & PERF_FORMAT_GROUP) &&
 		   perf_evsel__is_group_leader(evsel)) {
 		perf_missing_features.group_read = true;
-		pr_debug2("switching off group read\n");
+		pr_debug2_peo("switching off group read\n");
 		goto fallback_missing_features;
 	}
 out_close:
-- 
2.21.0


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

* Re: [RFC] perf record: Add option to print perf_event_open args and return value
  2019-11-08  3:59 [RFC] perf record: Add option to print perf_event_open args and return value Ravi Bangoria
@ 2019-11-08  8:04 ` Jiri Olsa
  2019-11-08  8:35   ` Ravi Bangoria
  0 siblings, 1 reply; 11+ messages in thread
From: Jiri Olsa @ 2019-11-08  8:04 UTC (permalink / raw)
  To: Ravi Bangoria; +Cc: acme, linux-kernel

On Fri, Nov 08, 2019 at 09:29:49AM +0530, Ravi Bangoria wrote:
> Perf record with verbose=2 already prints this information along with
> whole lot of other traces which requires lot of scrolling. I thought
> to show this information in verbose=1 but I fear that it will be too
> much for level 1. So finally created a new option specifically for
> printing this.
> 
> Sample o/p:
>   $ ./perf record --peo-args -- ls > /dev/null
>   ------------------------------------------------------------
>   perf_event_attr:
>     size                             112
>     { sample_period, sample_freq }   4000
>     sample_type                      IP|TID|TIME|PERIOD
>     read_format                      ID
>     disabled                         1
>     inherit                          1
>     exclude_kernel                   1
>     mmap                             1
>     comm                             1
>     freq                             1
>     enable_on_exec                   1
>     task                             1
>     precise_ip                       3
>     sample_id_all                    1
>     exclude_guest                    1
>     mmap2                            1
>     comm_exec                        1
>     ksymbol                          1
>     bpf_event                        1
>   ------------------------------------------------------------
>   sys_perf_event_open: pid 4308  cpu 0  group_fd -1  flags 0x8 = 4
>   sys_perf_event_open: pid 4308  cpu 1  group_fd -1  flags 0x8 = 5
>   sys_perf_event_open: pid 4308  cpu 2  group_fd -1  flags 0x8 = 6
>   sys_perf_event_open: pid 4308  cpu 3  group_fd -1  flags 0x8 = 8
>   sys_perf_event_open: pid 4308  cpu 4  group_fd -1  flags 0x8 = 9
>   sys_perf_event_open: pid 4308  cpu 5  group_fd -1  flags 0x8 = 10
>   sys_perf_event_open: pid 4308  cpu 6  group_fd -1  flags 0x8 = 11
>   sys_perf_event_open: pid 4308  cpu 7  group_fd -1  flags 0x8 = 12
>   ------------------------------------------------------------
>   perf_event_attr:
>     type                             1
>     size                             112
>     config                           0x9
>     watermark                        1
>     sample_id_all                    1
>     bpf_event                        1
>     { wakeup_events, wakeup_watermark } 1
>   ------------------------------------------------------------
>   sys_perf_event_open: pid -1  cpu 0  group_fd -1  flags 0x8
>   sys_perf_event_open failed, error -13
>   [ perf record: Woken up 1 times to write data ]
>   [ perf record: Captured and wrote 0.002 MB perf.data (9 samples) ]
> 
> Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>

right, -vv is already poluted ;-) but we have the perf --debug
option for specific debug:

       --debug
           Setup debug variable (see list below) in value range (0, 10). Use like: --debug verbose # sets verbose = 1 --debug verbose=2 # sets verbose = 2

               List of debug variables allowed to set:
                 verbose          - general debug messages
                 ordered-events   - ordered events object debug messages
                 data-convert     - data convert command debug messages
                 stderr           - write debug output (option -v) to stderr
                                    in browser mode

so I think something like this would fit better:

  perf --debug event-open[=X] record ...  
  perf --debug perf-event-open[=X] record ...  

you can have different levels for specific debug output,
also it should also stay part of -vv output

thanks,
jirka


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

* Re: [RFC] perf record: Add option to print perf_event_open args and return value
  2019-11-08  8:04 ` Jiri Olsa
@ 2019-11-08  8:35   ` Ravi Bangoria
  2019-11-08  9:30     ` [PATCH] perf tool: Provide an " Ravi Bangoria
  0 siblings, 1 reply; 11+ messages in thread
From: Ravi Bangoria @ 2019-11-08  8:35 UTC (permalink / raw)
  To: Jiri Olsa; +Cc: acme, linux-kernel, Ravi Bangoria



On 11/8/19 1:34 PM, Jiri Olsa wrote:
> On Fri, Nov 08, 2019 at 09:29:49AM +0530, Ravi Bangoria wrote:
>> Perf record with verbose=2 already prints this information along with
>> whole lot of other traces which requires lot of scrolling. I thought
>> to show this information in verbose=1 but I fear that it will be too
>> much for level 1. So finally created a new option specifically for
>> printing this.
>>
>> Sample o/p:
>>    $ ./perf record --peo-args -- ls > /dev/null
>>    ------------------------------------------------------------
>>    perf_event_attr:
>>      size                             112
>>      { sample_period, sample_freq }   4000
>>      sample_type                      IP|TID|TIME|PERIOD
>>      read_format                      ID
>>      disabled                         1
>>      inherit                          1
>>      exclude_kernel                   1
>>      mmap                             1
>>      comm                             1
>>      freq                             1
>>      enable_on_exec                   1
>>      task                             1
>>      precise_ip                       3
>>      sample_id_all                    1
>>      exclude_guest                    1
>>      mmap2                            1
>>      comm_exec                        1
>>      ksymbol                          1
>>      bpf_event                        1
>>    ------------------------------------------------------------
>>    sys_perf_event_open: pid 4308  cpu 0  group_fd -1  flags 0x8 = 4
>>    sys_perf_event_open: pid 4308  cpu 1  group_fd -1  flags 0x8 = 5
>>    sys_perf_event_open: pid 4308  cpu 2  group_fd -1  flags 0x8 = 6
>>    sys_perf_event_open: pid 4308  cpu 3  group_fd -1  flags 0x8 = 8
>>    sys_perf_event_open: pid 4308  cpu 4  group_fd -1  flags 0x8 = 9
>>    sys_perf_event_open: pid 4308  cpu 5  group_fd -1  flags 0x8 = 10
>>    sys_perf_event_open: pid 4308  cpu 6  group_fd -1  flags 0x8 = 11
>>    sys_perf_event_open: pid 4308  cpu 7  group_fd -1  flags 0x8 = 12
>>    ------------------------------------------------------------
>>    perf_event_attr:
>>      type                             1
>>      size                             112
>>      config                           0x9
>>      watermark                        1
>>      sample_id_all                    1
>>      bpf_event                        1
>>      { wakeup_events, wakeup_watermark } 1
>>    ------------------------------------------------------------
>>    sys_perf_event_open: pid -1  cpu 0  group_fd -1  flags 0x8
>>    sys_perf_event_open failed, error -13
>>    [ perf record: Woken up 1 times to write data ]
>>    [ perf record: Captured and wrote 0.002 MB perf.data (9 samples) ]
>>
>> Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
> 
> right, -vv is already poluted ;-) but we have the perf --debug
> option for specific debug:
> 
>         --debug
>             Setup debug variable (see list below) in value range (0, 10). Use like: --debug verbose # sets verbose = 1 --debug verbose=2 # sets verbose = 2
> 
>                 List of debug variables allowed to set:
>                   verbose          - general debug messages
>                   ordered-events   - ordered events object debug messages
>                   data-convert     - data convert command debug messages
>                   stderr           - write debug output (option -v) to stderr
>                                      in browser mode
> 
> so I think something like this would fit better:
> 
>    perf --debug event-open[=X] record ...
>    perf --debug perf-event-open[=X] record ...

Thanks Jiri. This looks better. Will respin.


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

* [PATCH] perf tool: Provide an option to print perf_event_open args and return value
  2019-11-08  8:35   ` Ravi Bangoria
@ 2019-11-08  9:30     ` Ravi Bangoria
  2019-11-08  9:41       ` [PATCH v2] " Ravi Bangoria
  0 siblings, 1 reply; 11+ messages in thread
From: Ravi Bangoria @ 2019-11-08  9:30 UTC (permalink / raw)
  To: acme, jolsa; +Cc: linux-kernel, Ravi Bangoria

Perf record with verbose=2 already prints this information along with
whole lot of other traces which requires lot of scrolling. Introduce
an option to print only perf_event_open() arguments and return value.

Sample o/p:
  $ ./perf --debug perf-event-open=1 record -- ls > /dev/null
  ------------------------------------------------------------
  perf_event_attr:
    size                             112
    { sample_period, sample_freq }   4000
    sample_type                      IP|TID|TIME|PERIOD
    read_format                      ID
    disabled                         1
    inherit                          1
    exclude_kernel                   1
    mmap                             1
    comm                             1
    freq                             1
    enable_on_exec                   1
    task                             1
    precise_ip                       3
    sample_id_all                    1
    exclude_guest                    1
    mmap2                            1
    comm_exec                        1
    ksymbol                          1
    bpf_event                        1
  ------------------------------------------------------------
  sys_perf_event_open: pid 4308  cpu 0  group_fd -1  flags 0x8 = 4
  sys_perf_event_open: pid 4308  cpu 1  group_fd -1  flags 0x8 = 5
  sys_perf_event_open: pid 4308  cpu 2  group_fd -1  flags 0x8 = 6
  sys_perf_event_open: pid 4308  cpu 3  group_fd -1  flags 0x8 = 8
  sys_perf_event_open: pid 4308  cpu 4  group_fd -1  flags 0x8 = 9
  sys_perf_event_open: pid 4308  cpu 5  group_fd -1  flags 0x8 = 10
  sys_perf_event_open: pid 4308  cpu 6  group_fd -1  flags 0x8 = 11
  sys_perf_event_open: pid 4308  cpu 7  group_fd -1  flags 0x8 = 12
  ------------------------------------------------------------
  perf_event_attr:
    type                             1
    size                             112
    config                           0x9
    watermark                        1
    sample_id_all                    1
    bpf_event                        1
    { wakeup_events, wakeup_watermark } 1
  ------------------------------------------------------------
  sys_perf_event_open: pid -1  cpu 0  group_fd -1  flags 0x8
  sys_perf_event_open failed, error -13
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.002 MB perf.data (9 samples) ]

Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
---
 tools/perf/util/debug.c |  2 ++
 tools/perf/util/debug.h |  9 +++++++++
 tools/perf/util/evsel.c | 36 ++++++++++++++++++------------------
 3 files changed, 29 insertions(+), 18 deletions(-)

diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c
index e55114f0336f..126938bdf732 100644
--- a/tools/perf/util/debug.c
+++ b/tools/perf/util/debug.c
@@ -24,6 +24,7 @@
 #include <linux/ctype.h>
 
 int verbose;
+int debug_peo_args;
 bool dump_trace = false, quiet = false;
 int debug_ordered_events;
 static int redirect_to_stderr;
@@ -180,6 +181,7 @@ static struct debug_variable {
 	{ .name = "ordered-events",	.ptr = &debug_ordered_events},
 	{ .name = "stderr",		.ptr = &redirect_to_stderr},
 	{ .name = "data-convert",	.ptr = &debug_data_convert },
+	{ .name = "perf-event-open",	.ptr = &debug_peo_args },
 	{ .name = NULL, }
 };
 
diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h
index d25ae1c4cee9..1df9f07f4c1a 100644
--- a/tools/perf/util/debug.h
+++ b/tools/perf/util/debug.h
@@ -8,6 +8,7 @@
 #include <linux/compiler.h>
 
 extern int verbose;
+extern int debug_peo_args;
 extern bool quiet, dump_trace;
 extern int debug_ordered_events;
 extern int debug_data_convert;
@@ -30,6 +31,14 @@ extern int debug_data_convert;
 #define pr_debug3(fmt, ...) pr_debugN(3, pr_fmt(fmt), ##__VA_ARGS__)
 #define pr_debug4(fmt, ...) pr_debugN(4, pr_fmt(fmt), ##__VA_ARGS__)
 
+/* Special macro to print perf_event_open arguments/return value. */
+#define pr_debug2_peo(fmt, ...) {				\
+	if (debug_peo_args)						\
+		pr_debugN(0, pr_fmt(fmt), ##__VA_ARGS__);	\
+	else							\
+		pr_debugN(2, pr_fmt(fmt), ##__VA_ARGS__);	\
+}
+
 #define pr_time_N(n, var, t, fmt, ...) \
 	eprintf_time(n, var, t, fmt, ##__VA_ARGS__)
 
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index d4451846af93..4176341920e5 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1524,7 +1524,7 @@ static int __open_attr__fprintf(FILE *fp, const char *name, const char *val,
 
 static void display_attr(struct perf_event_attr *attr)
 {
-	if (verbose >= 2) {
+	if (verbose >= 2 || debug_peo_args) {
 		fprintf(stderr, "%.60s\n", graph_dotted_line);
 		fprintf(stderr, "perf_event_attr:\n");
 		perf_event_attr__fprintf(stderr, attr, __open_attr__fprintf, NULL);
@@ -1540,7 +1540,7 @@ static int perf_event_open(struct evsel *evsel,
 	int fd;
 
 	while (1) {
-		pr_debug2("sys_perf_event_open: pid %d  cpu %d  group_fd %d  flags %#lx",
+		pr_debug2_peo("sys_perf_event_open: pid %d  cpu %d  group_fd %d  flags %#lx",
 			  pid, cpu, group_fd, flags);
 
 		fd = sys_perf_event_open(&evsel->core.attr, pid, cpu, group_fd, flags);
@@ -1560,9 +1560,9 @@ static int perf_event_open(struct evsel *evsel,
 			break;
 		}
 
-		pr_debug2("\nsys_perf_event_open failed, error %d\n", -ENOTSUP);
+		pr_debug2_peo("\nsys_perf_event_open failed, error %d\n", -ENOTSUP);
 		evsel->core.attr.precise_ip--;
-		pr_debug2("decreasing precise_ip by one (%d)\n", evsel->core.attr.precise_ip);
+		pr_debug2_peo("decreasing precise_ip by one (%d)\n", evsel->core.attr.precise_ip);
 		display_attr(&evsel->core.attr);
 	}
 
@@ -1681,12 +1681,12 @@ int evsel__open(struct evsel *evsel, struct perf_cpu_map *cpus,
 					continue;
 				}
 
-				pr_debug2("\nsys_perf_event_open failed, error %d\n",
+				pr_debug2_peo("\nsys_perf_event_open failed, error %d\n",
 					  err);
 				goto try_fallback;
 			}
 
-			pr_debug2(" = %d\n", fd);
+			pr_debug2_peo(" = %d\n", fd);
 
 			if (evsel->bpf_fd >= 0) {
 				int evt_fd = fd;
@@ -1754,58 +1754,58 @@ int evsel__open(struct evsel *evsel, struct perf_cpu_map *cpus,
 	 */
 	if (!perf_missing_features.aux_output && evsel->core.attr.aux_output) {
 		perf_missing_features.aux_output = true;
-		pr_debug2("Kernel has no attr.aux_output support, bailing out\n");
+		pr_debug2_peo("Kernel has no attr.aux_output support, bailing out\n");
 		goto out_close;
 	} else if (!perf_missing_features.bpf && evsel->core.attr.bpf_event) {
 		perf_missing_features.bpf = true;
-		pr_debug2("switching off bpf_event\n");
+		pr_debug2_peo("switching off bpf_event\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.ksymbol && evsel->core.attr.ksymbol) {
 		perf_missing_features.ksymbol = true;
-		pr_debug2("switching off ksymbol\n");
+		pr_debug2_peo("switching off ksymbol\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.write_backward && evsel->core.attr.write_backward) {
 		perf_missing_features.write_backward = true;
-		pr_debug2("switching off write_backward\n");
+		pr_debug2_peo("switching off write_backward\n");
 		goto out_close;
 	} else if (!perf_missing_features.clockid_wrong && evsel->core.attr.use_clockid) {
 		perf_missing_features.clockid_wrong = true;
-		pr_debug2("switching off clockid\n");
+		pr_debug2_peo("switching off clockid\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.clockid && evsel->core.attr.use_clockid) {
 		perf_missing_features.clockid = true;
-		pr_debug2("switching off use_clockid\n");
+		pr_debug2_peo("switching off use_clockid\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.cloexec && (flags & PERF_FLAG_FD_CLOEXEC)) {
 		perf_missing_features.cloexec = true;
-		pr_debug2("switching off cloexec flag\n");
+		pr_debug2_peo("switching off cloexec flag\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.mmap2 && evsel->core.attr.mmap2) {
 		perf_missing_features.mmap2 = true;
-		pr_debug2("switching off mmap2\n");
+		pr_debug2_peo("switching off mmap2\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.exclude_guest &&
 		   (evsel->core.attr.exclude_guest || evsel->core.attr.exclude_host)) {
 		perf_missing_features.exclude_guest = true;
-		pr_debug2("switching off exclude_guest, exclude_host\n");
+		pr_debug2_peo("switching off exclude_guest, exclude_host\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.sample_id_all) {
 		perf_missing_features.sample_id_all = true;
-		pr_debug2("switching off sample_id_all\n");
+		pr_debug2_peo("switching off sample_id_all\n");
 		goto retry_sample_id;
 	} else if (!perf_missing_features.lbr_flags &&
 			(evsel->core.attr.branch_sample_type &
 			 (PERF_SAMPLE_BRANCH_NO_CYCLES |
 			  PERF_SAMPLE_BRANCH_NO_FLAGS))) {
 		perf_missing_features.lbr_flags = true;
-		pr_debug2("switching off branch sample type no (cycles/flags)\n");
+		pr_debug2_peo("switching off branch sample type no (cycles/flags)\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.group_read &&
 		    evsel->core.attr.inherit &&
 		   (evsel->core.attr.read_format & PERF_FORMAT_GROUP) &&
 		   perf_evsel__is_group_leader(evsel)) {
 		perf_missing_features.group_read = true;
-		pr_debug2("switching off group read\n");
+		pr_debug2_peo("switching off group read\n");
 		goto fallback_missing_features;
 	}
 out_close:
-- 
2.21.0


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

* [PATCH v2] perf tool: Provide an option to print perf_event_open args and return value
  2019-11-08  9:30     ` [PATCH] perf tool: Provide an " Ravi Bangoria
@ 2019-11-08  9:41       ` Ravi Bangoria
  2019-11-08 11:00         ` Jiri Olsa
  2019-11-15  7:40         ` [tip: perf/core] " tip-bot2 for Ravi Bangoria
  0 siblings, 2 replies; 11+ messages in thread
From: Ravi Bangoria @ 2019-11-08  9:41 UTC (permalink / raw)
  To: acme, jolsa; +Cc: linux-kernel, Ravi Bangoria

Perf record with verbose=2 already prints this information along with
whole lot of other traces which requires lot of scrolling. Introduce
an option to print only perf_event_open() arguments and return value.

Sample o/p:
  $ ./perf --debug perf-event-open=1 record -- ls > /dev/null
  ------------------------------------------------------------
  perf_event_attr:
    size                             112
    { sample_period, sample_freq }   4000
    sample_type                      IP|TID|TIME|PERIOD
    read_format                      ID
    disabled                         1
    inherit                          1
    exclude_kernel                   1
    mmap                             1
    comm                             1
    freq                             1
    enable_on_exec                   1
    task                             1
    precise_ip                       3
    sample_id_all                    1
    exclude_guest                    1
    mmap2                            1
    comm_exec                        1
    ksymbol                          1
    bpf_event                        1
  ------------------------------------------------------------
  sys_perf_event_open: pid 4308  cpu 0  group_fd -1  flags 0x8 = 4
  sys_perf_event_open: pid 4308  cpu 1  group_fd -1  flags 0x8 = 5
  sys_perf_event_open: pid 4308  cpu 2  group_fd -1  flags 0x8 = 6
  sys_perf_event_open: pid 4308  cpu 3  group_fd -1  flags 0x8 = 8
  sys_perf_event_open: pid 4308  cpu 4  group_fd -1  flags 0x8 = 9
  sys_perf_event_open: pid 4308  cpu 5  group_fd -1  flags 0x8 = 10
  sys_perf_event_open: pid 4308  cpu 6  group_fd -1  flags 0x8 = 11
  sys_perf_event_open: pid 4308  cpu 7  group_fd -1  flags 0x8 = 12
  ------------------------------------------------------------
  perf_event_attr:
    type                             1
    size                             112
    config                           0x9
    watermark                        1
    sample_id_all                    1
    bpf_event                        1
    { wakeup_events, wakeup_watermark } 1
  ------------------------------------------------------------
  sys_perf_event_open: pid -1  cpu 0  group_fd -1  flags 0x8
  sys_perf_event_open failed, error -13
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.002 MB perf.data (9 samples) ]

Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
---
v1->v2:
 - man page updates.

 tools/perf/Documentation/perf.txt |  2 ++
 tools/perf/util/debug.c           |  2 ++
 tools/perf/util/debug.h           |  9 ++++++++
 tools/perf/util/evsel.c           | 36 +++++++++++++++----------------
 4 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/tools/perf/Documentation/perf.txt b/tools/perf/Documentation/perf.txt
index 401f0ed67439..3f37ded13f8c 100644
--- a/tools/perf/Documentation/perf.txt
+++ b/tools/perf/Documentation/perf.txt
@@ -24,6 +24,8 @@ OPTIONS
 	  data-convert     - data convert command debug messages
 	  stderr           - write debug output (option -v) to stderr
 	                     in browser mode
+	  perf-event-open  - Print perf_event_open() arguments and
+			     return value
 
 --buildid-dir::
 	Setup buildid cache directory. It has higher priority than
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c
index e55114f0336f..adb656745ecc 100644
--- a/tools/perf/util/debug.c
+++ b/tools/perf/util/debug.c
@@ -24,6 +24,7 @@
 #include <linux/ctype.h>
 
 int verbose;
+int debug_peo_args;
 bool dump_trace = false, quiet = false;
 int debug_ordered_events;
 static int redirect_to_stderr;
@@ -180,6 +181,7 @@ static struct debug_variable {
 	{ .name = "ordered-events",	.ptr = &debug_ordered_events},
 	{ .name = "stderr",		.ptr = &redirect_to_stderr},
 	{ .name = "data-convert",	.ptr = &debug_data_convert },
+	{ .name = "perf-event-open",	.ptr = &debug_peo_args },
 	{ .name = NULL, }
 };
 
diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h
index d25ae1c4cee9..f1734abd98dd 100644
--- a/tools/perf/util/debug.h
+++ b/tools/perf/util/debug.h
@@ -8,6 +8,7 @@
 #include <linux/compiler.h>
 
 extern int verbose;
+extern int debug_peo_args;
 extern bool quiet, dump_trace;
 extern int debug_ordered_events;
 extern int debug_data_convert;
@@ -30,6 +31,14 @@ extern int debug_data_convert;
 #define pr_debug3(fmt, ...) pr_debugN(3, pr_fmt(fmt), ##__VA_ARGS__)
 #define pr_debug4(fmt, ...) pr_debugN(4, pr_fmt(fmt), ##__VA_ARGS__)
 
+/* Special macro to print perf_event_open arguments/return value. */
+#define pr_debug2_peo(fmt, ...) {				\
+	if (debug_peo_args)						\
+		pr_debugN(0, pr_fmt(fmt), ##__VA_ARGS__);	\
+	else							\
+		pr_debugN(2, pr_fmt(fmt), ##__VA_ARGS__);	\
+}
+
 #define pr_time_N(n, var, t, fmt, ...) \
 	eprintf_time(n, var, t, fmt, ##__VA_ARGS__)
 
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index d4451846af93..1bf60f325608 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1524,7 +1524,7 @@ static int __open_attr__fprintf(FILE *fp, const char *name, const char *val,
 
 static void display_attr(struct perf_event_attr *attr)
 {
-	if (verbose >= 2) {
+	if (verbose >= 2 || debug_peo_args) {
 		fprintf(stderr, "%.60s\n", graph_dotted_line);
 		fprintf(stderr, "perf_event_attr:\n");
 		perf_event_attr__fprintf(stderr, attr, __open_attr__fprintf, NULL);
@@ -1540,7 +1540,7 @@ static int perf_event_open(struct evsel *evsel,
 	int fd;
 
 	while (1) {
-		pr_debug2("sys_perf_event_open: pid %d  cpu %d  group_fd %d  flags %#lx",
+		pr_debug2_peo("sys_perf_event_open: pid %d  cpu %d  group_fd %d  flags %#lx",
 			  pid, cpu, group_fd, flags);
 
 		fd = sys_perf_event_open(&evsel->core.attr, pid, cpu, group_fd, flags);
@@ -1560,9 +1560,9 @@ static int perf_event_open(struct evsel *evsel,
 			break;
 		}
 
-		pr_debug2("\nsys_perf_event_open failed, error %d\n", -ENOTSUP);
+		pr_debug2_peo("\nsys_perf_event_open failed, error %d\n", -ENOTSUP);
 		evsel->core.attr.precise_ip--;
-		pr_debug2("decreasing precise_ip by one (%d)\n", evsel->core.attr.precise_ip);
+		pr_debug2_peo("decreasing precise_ip by one (%d)\n", evsel->core.attr.precise_ip);
 		display_attr(&evsel->core.attr);
 	}
 
@@ -1681,12 +1681,12 @@ int evsel__open(struct evsel *evsel, struct perf_cpu_map *cpus,
 					continue;
 				}
 
-				pr_debug2("\nsys_perf_event_open failed, error %d\n",
+				pr_debug2_peo("\nsys_perf_event_open failed, error %d\n",
 					  err);
 				goto try_fallback;
 			}
 
-			pr_debug2(" = %d\n", fd);
+			pr_debug2_peo(" = %d\n", fd);
 
 			if (evsel->bpf_fd >= 0) {
 				int evt_fd = fd;
@@ -1754,58 +1754,58 @@ int evsel__open(struct evsel *evsel, struct perf_cpu_map *cpus,
 	 */
 	if (!perf_missing_features.aux_output && evsel->core.attr.aux_output) {
 		perf_missing_features.aux_output = true;
-		pr_debug2("Kernel has no attr.aux_output support, bailing out\n");
+		pr_debug2_peo("Kernel has no attr.aux_output support, bailing out\n");
 		goto out_close;
 	} else if (!perf_missing_features.bpf && evsel->core.attr.bpf_event) {
 		perf_missing_features.bpf = true;
-		pr_debug2("switching off bpf_event\n");
+		pr_debug2_peo("switching off bpf_event\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.ksymbol && evsel->core.attr.ksymbol) {
 		perf_missing_features.ksymbol = true;
-		pr_debug2("switching off ksymbol\n");
+		pr_debug2_peo("switching off ksymbol\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.write_backward && evsel->core.attr.write_backward) {
 		perf_missing_features.write_backward = true;
-		pr_debug2("switching off write_backward\n");
+		pr_debug2_peo("switching off write_backward\n");
 		goto out_close;
 	} else if (!perf_missing_features.clockid_wrong && evsel->core.attr.use_clockid) {
 		perf_missing_features.clockid_wrong = true;
-		pr_debug2("switching off clockid\n");
+		pr_debug2_peo("switching off clockid\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.clockid && evsel->core.attr.use_clockid) {
 		perf_missing_features.clockid = true;
-		pr_debug2("switching off use_clockid\n");
+		pr_debug2_peo("switching off use_clockid\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.cloexec && (flags & PERF_FLAG_FD_CLOEXEC)) {
 		perf_missing_features.cloexec = true;
-		pr_debug2("switching off cloexec flag\n");
+		pr_debug2_peo("switching off cloexec flag\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.mmap2 && evsel->core.attr.mmap2) {
 		perf_missing_features.mmap2 = true;
-		pr_debug2("switching off mmap2\n");
+		pr_debug2_peo("switching off mmap2\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.exclude_guest &&
 		   (evsel->core.attr.exclude_guest || evsel->core.attr.exclude_host)) {
 		perf_missing_features.exclude_guest = true;
-		pr_debug2("switching off exclude_guest, exclude_host\n");
+		pr_debug2_peo("switching off exclude_guest, exclude_host\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.sample_id_all) {
 		perf_missing_features.sample_id_all = true;
-		pr_debug2("switching off sample_id_all\n");
+		pr_debug2_peo("switching off sample_id_all\n");
 		goto retry_sample_id;
 	} else if (!perf_missing_features.lbr_flags &&
 			(evsel->core.attr.branch_sample_type &
 			 (PERF_SAMPLE_BRANCH_NO_CYCLES |
 			  PERF_SAMPLE_BRANCH_NO_FLAGS))) {
 		perf_missing_features.lbr_flags = true;
-		pr_debug2("switching off branch sample type no (cycles/flags)\n");
+		pr_debug2_peo("switching off branch sample type no (cycles/flags)\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.group_read &&
 		    evsel->core.attr.inherit &&
 		   (evsel->core.attr.read_format & PERF_FORMAT_GROUP) &&
 		   perf_evsel__is_group_leader(evsel)) {
 		perf_missing_features.group_read = true;
-		pr_debug2("switching off group read\n");
+		pr_debug2_peo("switching off group read\n");
 		goto fallback_missing_features;
 	}
 out_close:
-- 
2.21.0


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

* Re: [PATCH v2] perf tool: Provide an option to print perf_event_open args and return value
  2019-11-08  9:41       ` [PATCH v2] " Ravi Bangoria
@ 2019-11-08 11:00         ` Jiri Olsa
  2019-11-11 13:52           ` Arnaldo Carvalho de Melo
  2019-11-12 11:29           ` Arnaldo Carvalho de Melo
  2019-11-15  7:40         ` [tip: perf/core] " tip-bot2 for Ravi Bangoria
  1 sibling, 2 replies; 11+ messages in thread
From: Jiri Olsa @ 2019-11-08 11:00 UTC (permalink / raw)
  To: Ravi Bangoria; +Cc: acme, linux-kernel

On Fri, Nov 08, 2019 at 03:11:28PM +0530, Ravi Bangoria wrote:
> Perf record with verbose=2 already prints this information along with
> whole lot of other traces which requires lot of scrolling. Introduce
> an option to print only perf_event_open() arguments and return value.
> 
> Sample o/p:
>   $ ./perf --debug perf-event-open=1 record -- ls > /dev/null
>   ------------------------------------------------------------
>   perf_event_attr:
>     size                             112
>     { sample_period, sample_freq }   4000
>     sample_type                      IP|TID|TIME|PERIOD
>     read_format                      ID
>     disabled                         1
>     inherit                          1
>     exclude_kernel                   1
>     mmap                             1
>     comm                             1
>     freq                             1
>     enable_on_exec                   1
>     task                             1
>     precise_ip                       3
>     sample_id_all                    1
>     exclude_guest                    1
>     mmap2                            1
>     comm_exec                        1
>     ksymbol                          1
>     bpf_event                        1
>   ------------------------------------------------------------
>   sys_perf_event_open: pid 4308  cpu 0  group_fd -1  flags 0x8 = 4
>   sys_perf_event_open: pid 4308  cpu 1  group_fd -1  flags 0x8 = 5
>   sys_perf_event_open: pid 4308  cpu 2  group_fd -1  flags 0x8 = 6
>   sys_perf_event_open: pid 4308  cpu 3  group_fd -1  flags 0x8 = 8
>   sys_perf_event_open: pid 4308  cpu 4  group_fd -1  flags 0x8 = 9
>   sys_perf_event_open: pid 4308  cpu 5  group_fd -1  flags 0x8 = 10
>   sys_perf_event_open: pid 4308  cpu 6  group_fd -1  flags 0x8 = 11
>   sys_perf_event_open: pid 4308  cpu 7  group_fd -1  flags 0x8 = 12
>   ------------------------------------------------------------
>   perf_event_attr:
>     type                             1
>     size                             112
>     config                           0x9
>     watermark                        1
>     sample_id_all                    1
>     bpf_event                        1
>     { wakeup_events, wakeup_watermark } 1
>   ------------------------------------------------------------
>   sys_perf_event_open: pid -1  cpu 0  group_fd -1  flags 0x8
>   sys_perf_event_open failed, error -13
>   [ perf record: Woken up 1 times to write data ]
>   [ perf record: Captured and wrote 0.002 MB perf.data (9 samples) ]
> 
> Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
> ---
> v1->v2:
>  - man page updates.

Acked-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka


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

* Re: [PATCH v2] perf tool: Provide an option to print perf_event_open args and return value
  2019-11-08 11:00         ` Jiri Olsa
@ 2019-11-11 13:52           ` Arnaldo Carvalho de Melo
  2019-11-12 11:29           ` Arnaldo Carvalho de Melo
  1 sibling, 0 replies; 11+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-11-11 13:52 UTC (permalink / raw)
  To: Jiri Olsa; +Cc: Ravi Bangoria, linux-kernel

Em Fri, Nov 08, 2019 at 12:00:09PM +0100, Jiri Olsa escreveu:
> On Fri, Nov 08, 2019 at 03:11:28PM +0530, Ravi Bangoria wrote:
> > Perf record with verbose=2 already prints this information along with
> > whole lot of other traces which requires lot of scrolling. Introduce
> > an option to print only perf_event_open() arguments and return value.
> > 
> > Sample o/p:
> >   $ ./perf --debug perf-event-open=1 record -- ls > /dev/null
> >   ------------------------------------------------------------
> >   perf_event_attr:
> >     size                             112
> >     { sample_period, sample_freq }   4000
> >     sample_type                      IP|TID|TIME|PERIOD
> >     read_format                      ID
> >     disabled                         1
> >     inherit                          1
> >     exclude_kernel                   1
> >     mmap                             1
> >     comm                             1
> >     freq                             1
> >     enable_on_exec                   1
> >     task                             1
> >     precise_ip                       3
> >     sample_id_all                    1
> >     exclude_guest                    1
> >     mmap2                            1
> >     comm_exec                        1
> >     ksymbol                          1
> >     bpf_event                        1
> >   ------------------------------------------------------------
> >   sys_perf_event_open: pid 4308  cpu 0  group_fd -1  flags 0x8 = 4
> >   sys_perf_event_open: pid 4308  cpu 1  group_fd -1  flags 0x8 = 5
> >   sys_perf_event_open: pid 4308  cpu 2  group_fd -1  flags 0x8 = 6
> >   sys_perf_event_open: pid 4308  cpu 3  group_fd -1  flags 0x8 = 8
> >   sys_perf_event_open: pid 4308  cpu 4  group_fd -1  flags 0x8 = 9
> >   sys_perf_event_open: pid 4308  cpu 5  group_fd -1  flags 0x8 = 10
> >   sys_perf_event_open: pid 4308  cpu 6  group_fd -1  flags 0x8 = 11
> >   sys_perf_event_open: pid 4308  cpu 7  group_fd -1  flags 0x8 = 12
> >   ------------------------------------------------------------
> >   perf_event_attr:
> >     type                             1
> >     size                             112
> >     config                           0x9
> >     watermark                        1
> >     sample_id_all                    1
> >     bpf_event                        1
> >     { wakeup_events, wakeup_watermark } 1
> >   ------------------------------------------------------------
> >   sys_perf_event_open: pid -1  cpu 0  group_fd -1  flags 0x8
> >   sys_perf_event_open failed, error -13
> >   [ perf record: Woken up 1 times to write data ]
> >   [ perf record: Captured and wrote 0.002 MB perf.data (9 samples) ]
> > 
> > Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
> > ---
> > v1->v2:
> >  - man page updates.
> 
> Acked-by: Jiri Olsa <jolsa@kernel.org>

Thanks, tested and applied.

- Arnaldo

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

* Re: [PATCH v2] perf tool: Provide an option to print perf_event_open args and return value
  2019-11-08 11:00         ` Jiri Olsa
  2019-11-11 13:52           ` Arnaldo Carvalho de Melo
@ 2019-11-12 11:29           ` Arnaldo Carvalho de Melo
  2019-11-12 11:37             ` Arnaldo Carvalho de Melo
  1 sibling, 1 reply; 11+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-11-12 11:29 UTC (permalink / raw)
  To: Jiri Olsa; +Cc: Ravi Bangoria, linux-kernel

Em Fri, Nov 08, 2019 at 12:00:09PM +0100, Jiri Olsa escreveu:
> On Fri, Nov 08, 2019 at 03:11:28PM +0530, Ravi Bangoria wrote:
> > Perf record with verbose=2 already prints this information along with
> > whole lot of other traces which requires lot of scrolling. Introduce
> > an option to print only perf_event_open() arguments and return value.
> > 
> > Sample o/p:
> >   $ ./perf --debug perf-event-open=1 record -- ls > /dev/null
> >   ------------------------------------------------------------
> >   perf_event_attr:
> >     size                             112
> >     { sample_period, sample_freq }   4000
> >     sample_type                      IP|TID|TIME|PERIOD
> >     read_format                      ID
> >     disabled                         1
> >     inherit                          1
> >     exclude_kernel                   1
> >     mmap                             1
> >     comm                             1
> >     freq                             1
> >     enable_on_exec                   1
> >     task                             1
> >     precise_ip                       3
> >     sample_id_all                    1
> >     exclude_guest                    1
> >     mmap2                            1
> >     comm_exec                        1
> >     ksymbol                          1
> >     bpf_event                        1
> >   ------------------------------------------------------------
> >   sys_perf_event_open: pid 4308  cpu 0  group_fd -1  flags 0x8 = 4
> >   sys_perf_event_open: pid 4308  cpu 1  group_fd -1  flags 0x8 = 5
> >   sys_perf_event_open: pid 4308  cpu 2  group_fd -1  flags 0x8 = 6
> >   sys_perf_event_open: pid 4308  cpu 3  group_fd -1  flags 0x8 = 8
> >   sys_perf_event_open: pid 4308  cpu 4  group_fd -1  flags 0x8 = 9
> >   sys_perf_event_open: pid 4308  cpu 5  group_fd -1  flags 0x8 = 10
> >   sys_perf_event_open: pid 4308  cpu 6  group_fd -1  flags 0x8 = 11
> >   sys_perf_event_open: pid 4308  cpu 7  group_fd -1  flags 0x8 = 12
> >   ------------------------------------------------------------
> >   perf_event_attr:
> >     type                             1
> >     size                             112
> >     config                           0x9
> >     watermark                        1
> >     sample_id_all                    1
> >     bpf_event                        1
> >     { wakeup_events, wakeup_watermark } 1
> >   ------------------------------------------------------------
> >   sys_perf_event_open: pid -1  cpu 0  group_fd -1  flags 0x8
> >   sys_perf_event_open failed, error -13
> >   [ perf record: Woken up 1 times to write data ]
> >   [ perf record: Captured and wrote 0.002 MB perf.data (9 samples) ]
> > 
> > Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
> > ---
> > v1->v2:
> >  - man page updates.
> 
> Acked-by: Jiri Olsa <jolsa@kernel.org>

[root@quaco ~]# perf test -v python
18: 'import perf' in python                               :
--- start ---
test child forked, pid 19237
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: /tmp/build/perf/python/perf.so: undefined symbol: debug_peo_args
test child finished with -1
---- end ----
'import perf' in python: FAILED!
[root@quaco ~]#

Please always test your changes using 'perf test', before and after, to
see if some regression is being added. I'm trying to fix this one.

Thanks,

- Arnaldo

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

* Re: [PATCH v2] perf tool: Provide an option to print perf_event_open args and return value
  2019-11-12 11:29           ` Arnaldo Carvalho de Melo
@ 2019-11-12 11:37             ` Arnaldo Carvalho de Melo
  2019-11-12 14:00               ` Ravi Bangoria
  0 siblings, 1 reply; 11+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-11-12 11:37 UTC (permalink / raw)
  To: Ravi Bangoria; +Cc: Jiri Olsa, linux-kernel

Em Tue, Nov 12, 2019 at 08:29:10AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Fri, Nov 08, 2019 at 12:00:09PM +0100, Jiri Olsa escreveu:
> > On Fri, Nov 08, 2019 at 03:11:28PM +0530, Ravi Bangoria wrote:
> > > Perf record with verbose=2 already prints this information along with
> > > whole lot of other traces which requires lot of scrolling. Introduce
> > > an option to print only perf_event_open() arguments and return value.
> > > 
> > > Sample o/p:
> > >   $ ./perf --debug perf-event-open=1 record -- ls > /dev/null
> > >   ------------------------------------------------------------
> > >   perf_event_attr:
> > >     size                             112
> > >     { sample_period, sample_freq }   4000
> > >     sample_type                      IP|TID|TIME|PERIOD
> > >     read_format                      ID
> > >     disabled                         1
> > >     inherit                          1
> > >     exclude_kernel                   1
> > >     mmap                             1
> > >     comm                             1
> > >     freq                             1
> > >     enable_on_exec                   1
> > >     task                             1
> > >     precise_ip                       3
> > >     sample_id_all                    1
> > >     exclude_guest                    1
> > >     mmap2                            1
> > >     comm_exec                        1
> > >     ksymbol                          1
> > >     bpf_event                        1
> > >   ------------------------------------------------------------
> > >   sys_perf_event_open: pid 4308  cpu 0  group_fd -1  flags 0x8 = 4
> > >   sys_perf_event_open: pid 4308  cpu 1  group_fd -1  flags 0x8 = 5
> > >   sys_perf_event_open: pid 4308  cpu 2  group_fd -1  flags 0x8 = 6
> > >   sys_perf_event_open: pid 4308  cpu 3  group_fd -1  flags 0x8 = 8
> > >   sys_perf_event_open: pid 4308  cpu 4  group_fd -1  flags 0x8 = 9
> > >   sys_perf_event_open: pid 4308  cpu 5  group_fd -1  flags 0x8 = 10
> > >   sys_perf_event_open: pid 4308  cpu 6  group_fd -1  flags 0x8 = 11
> > >   sys_perf_event_open: pid 4308  cpu 7  group_fd -1  flags 0x8 = 12
> > >   ------------------------------------------------------------
> > >   perf_event_attr:
> > >     type                             1
> > >     size                             112
> > >     config                           0x9
> > >     watermark                        1
> > >     sample_id_all                    1
> > >     bpf_event                        1
> > >     { wakeup_events, wakeup_watermark } 1
> > >   ------------------------------------------------------------
> > >   sys_perf_event_open: pid -1  cpu 0  group_fd -1  flags 0x8
> > >   sys_perf_event_open failed, error -13
> > >   [ perf record: Woken up 1 times to write data ]
> > >   [ perf record: Captured and wrote 0.002 MB perf.data (9 samples) ]
> > > 
> > > Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
> > > ---
> > > v1->v2:
> > >  - man page updates.
> > 
> > Acked-by: Jiri Olsa <jolsa@kernel.org>
> 
> [root@quaco ~]# perf test -v python
> 18: 'import perf' in python                               :
> --- start ---
> test child forked, pid 19237
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: /tmp/build/perf/python/perf.so: undefined symbol: debug_peo_args
> test child finished with -1
> ---- end ----
> 'import perf' in python: FAILED!
> [root@quaco ~]#
> 
> Please always test your changes using 'perf test', before and after, to
> see if some regression is being added. I'm trying to fix this one.

I added this to fix this issue,

- Thanks,

- Arnaldo

[acme@quaco perf]$ git diff -U5
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
index 25118605f3f8..83212c65848b 100644
--- a/tools/perf/util/python.c
+++ b/tools/perf/util/python.c
@@ -63,10 +63,11 @@ struct perf_env perf_env;
 /*
  * Support debug printing even though util/debug.c is not linked.  That means
  * implementing 'verbose' and 'eprintf'.
  */
 int verbose;
+int debug_peo_args;

 int eprintf(int level, int var, const char *fmt, ...);

 int eprintf(int level, int var, const char *fmt, ...)
 {
[acme@quaco perf]$

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

* Re: [PATCH v2] perf tool: Provide an option to print perf_event_open args and return value
  2019-11-12 11:37             ` Arnaldo Carvalho de Melo
@ 2019-11-12 14:00               ` Ravi Bangoria
  0 siblings, 0 replies; 11+ messages in thread
From: Ravi Bangoria @ 2019-11-12 14:00 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: Jiri Olsa, linux-kernel, Ravi Bangoria



On 11/12/19 5:07 PM, Arnaldo Carvalho de Melo wrote:
>> [root@quaco ~]# perf test -v python
>> 18: 'import perf' in python                               :
>> --- start ---
>> test child forked, pid 19237
>> Traceback (most recent call last):
>>    File "<stdin>", line 1, in <module>
>> ImportError: /tmp/build/perf/python/perf.so: undefined symbol: debug_peo_args
>> test child finished with -1
>> ---- end ----
>> 'import perf' in python: FAILED!
>> [root@quaco ~]#
>>
>> Please always test your changes using 'perf test', before and after, to
>> see if some regression is being added. I'm trying to fix this one.
> 
> I added this to fix this issue,

Sorry about that. Missed to run it. Will take care next time onwards.
Thanks for the fix.

-Ravi


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

* [tip: perf/core] perf tool: Provide an option to print perf_event_open args and return value
  2019-11-08  9:41       ` [PATCH v2] " Ravi Bangoria
  2019-11-08 11:00         ` Jiri Olsa
@ 2019-11-15  7:40         ` tip-bot2 for Ravi Bangoria
  1 sibling, 0 replies; 11+ messages in thread
From: tip-bot2 for Ravi Bangoria @ 2019-11-15  7:40 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Ravi Bangoria, Arnaldo Carvalho de Melo, Jiri Olsa, Ingo Molnar,
	Borislav Petkov, linux-kernel

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     ccd26741f5e6bdf2c18ea38b32e6a347c5648a97
Gitweb:        https://git.kernel.org/tip/ccd26741f5e6bdf2c18ea38b32e6a347c5648a97
Author:        Ravi Bangoria <ravi.bangoria@linux.ibm.com>
AuthorDate:    Fri, 08 Nov 2019 15:11:28 +05:30
Committer:     Arnaldo Carvalho de Melo <acme@redhat.com>
CommitterDate: Tue, 12 Nov 2019 08:32:27 -03:00

perf tool: Provide an option to print perf_event_open args and return value

Perf record with verbose=2 already prints this information along with
whole lot of other traces which requires lot of scrolling. Introduce
an option to print only perf_event_open() arguments and return value.

Sample o/p:

  $ perf --debug perf-event-open=1 record -- ls > /dev/null
  ------------------------------------------------------------
  perf_event_attr:
    size                             112
    { sample_period, sample_freq }   4000
    sample_type                      IP|TID|TIME|PERIOD
    read_format                      ID
    disabled                         1
    inherit                          1
    exclude_kernel                   1
    mmap                             1
    comm                             1
    freq                             1
    enable_on_exec                   1
    task                             1
    precise_ip                       3
    sample_id_all                    1
    exclude_guest                    1
    mmap2                            1
    comm_exec                        1
    ksymbol                          1
    bpf_event                        1
  ------------------------------------------------------------
  sys_perf_event_open: pid 4308  cpu 0  group_fd -1  flags 0x8 = 4
  sys_perf_event_open: pid 4308  cpu 1  group_fd -1  flags 0x8 = 5
  sys_perf_event_open: pid 4308  cpu 2  group_fd -1  flags 0x8 = 6
  sys_perf_event_open: pid 4308  cpu 3  group_fd -1  flags 0x8 = 8
  sys_perf_event_open: pid 4308  cpu 4  group_fd -1  flags 0x8 = 9
  sys_perf_event_open: pid 4308  cpu 5  group_fd -1  flags 0x8 = 10
  sys_perf_event_open: pid 4308  cpu 6  group_fd -1  flags 0x8 = 11
  sys_perf_event_open: pid 4308  cpu 7  group_fd -1  flags 0x8 = 12
  ------------------------------------------------------------
  perf_event_attr:
    type                             1
    size                             112
    config                           0x9
    watermark                        1
    sample_id_all                    1
    bpf_event                        1
    { wakeup_events, wakeup_watermark } 1
  ------------------------------------------------------------
  sys_perf_event_open: pid -1  cpu 0  group_fd -1  flags 0x8
  sys_perf_event_open failed, error -13
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.002 MB perf.data (9 samples) ]

Committer notes:

Just like the 'verbose' variable this new 'debug_peo_args' needs to be
added to util/python.c, since we don't link the debug.o file in the
python binding, which ended up making 'perf test python' fail with:

  # perf test -v python
  18: 'import perf' in python                               :
  --- start ---
  test child forked, pid 19237
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  ImportError: /tmp/build/perf/python/perf.so: undefined symbol: debug_peo_args
  test child finished with -1
  ---- end ----
  'import perf' in python: FAILED!
  #

After adding that new variable to util/python.c:

  # perf test -v python
  18: 'import perf' in python                               :
  --- start ---
  test child forked, pid 22364
  test child finished with 0
  ---- end ----
  'import perf' in python: Ok
  #

Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: http://lore.kernel.org/lkml/20191108094128.28769-1-ravi.bangoria@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf.txt |  2 ++-
 tools/perf/util/debug.c           |  2 ++-
 tools/perf/util/debug.h           |  9 ++++++++-
 tools/perf/util/evsel.c           | 36 +++++++++++++++---------------
 tools/perf/util/python.c          |  1 +-
 5 files changed, 32 insertions(+), 18 deletions(-)

diff --git a/tools/perf/Documentation/perf.txt b/tools/perf/Documentation/perf.txt
index 401f0ed..3f37ded 100644
--- a/tools/perf/Documentation/perf.txt
+++ b/tools/perf/Documentation/perf.txt
@@ -24,6 +24,8 @@ OPTIONS
 	  data-convert     - data convert command debug messages
 	  stderr           - write debug output (option -v) to stderr
 	                     in browser mode
+	  perf-event-open  - Print perf_event_open() arguments and
+			     return value
 
 --buildid-dir::
 	Setup buildid cache directory. It has higher priority than
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c
index e55114f..adb6567 100644
--- a/tools/perf/util/debug.c
+++ b/tools/perf/util/debug.c
@@ -24,6 +24,7 @@
 #include <linux/ctype.h>
 
 int verbose;
+int debug_peo_args;
 bool dump_trace = false, quiet = false;
 int debug_ordered_events;
 static int redirect_to_stderr;
@@ -180,6 +181,7 @@ static struct debug_variable {
 	{ .name = "ordered-events",	.ptr = &debug_ordered_events},
 	{ .name = "stderr",		.ptr = &redirect_to_stderr},
 	{ .name = "data-convert",	.ptr = &debug_data_convert },
+	{ .name = "perf-event-open",	.ptr = &debug_peo_args },
 	{ .name = NULL, }
 };
 
diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h
index d25ae1c..f1734ab 100644
--- a/tools/perf/util/debug.h
+++ b/tools/perf/util/debug.h
@@ -8,6 +8,7 @@
 #include <linux/compiler.h>
 
 extern int verbose;
+extern int debug_peo_args;
 extern bool quiet, dump_trace;
 extern int debug_ordered_events;
 extern int debug_data_convert;
@@ -30,6 +31,14 @@ extern int debug_data_convert;
 #define pr_debug3(fmt, ...) pr_debugN(3, pr_fmt(fmt), ##__VA_ARGS__)
 #define pr_debug4(fmt, ...) pr_debugN(4, pr_fmt(fmt), ##__VA_ARGS__)
 
+/* Special macro to print perf_event_open arguments/return value. */
+#define pr_debug2_peo(fmt, ...) {				\
+	if (debug_peo_args)						\
+		pr_debugN(0, pr_fmt(fmt), ##__VA_ARGS__);	\
+	else							\
+		pr_debugN(2, pr_fmt(fmt), ##__VA_ARGS__);	\
+}
+
 #define pr_time_N(n, var, t, fmt, ...) \
 	eprintf_time(n, var, t, fmt, ##__VA_ARGS__)
 
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index d445184..1bf60f3 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1524,7 +1524,7 @@ static int __open_attr__fprintf(FILE *fp, const char *name, const char *val,
 
 static void display_attr(struct perf_event_attr *attr)
 {
-	if (verbose >= 2) {
+	if (verbose >= 2 || debug_peo_args) {
 		fprintf(stderr, "%.60s\n", graph_dotted_line);
 		fprintf(stderr, "perf_event_attr:\n");
 		perf_event_attr__fprintf(stderr, attr, __open_attr__fprintf, NULL);
@@ -1540,7 +1540,7 @@ static int perf_event_open(struct evsel *evsel,
 	int fd;
 
 	while (1) {
-		pr_debug2("sys_perf_event_open: pid %d  cpu %d  group_fd %d  flags %#lx",
+		pr_debug2_peo("sys_perf_event_open: pid %d  cpu %d  group_fd %d  flags %#lx",
 			  pid, cpu, group_fd, flags);
 
 		fd = sys_perf_event_open(&evsel->core.attr, pid, cpu, group_fd, flags);
@@ -1560,9 +1560,9 @@ static int perf_event_open(struct evsel *evsel,
 			break;
 		}
 
-		pr_debug2("\nsys_perf_event_open failed, error %d\n", -ENOTSUP);
+		pr_debug2_peo("\nsys_perf_event_open failed, error %d\n", -ENOTSUP);
 		evsel->core.attr.precise_ip--;
-		pr_debug2("decreasing precise_ip by one (%d)\n", evsel->core.attr.precise_ip);
+		pr_debug2_peo("decreasing precise_ip by one (%d)\n", evsel->core.attr.precise_ip);
 		display_attr(&evsel->core.attr);
 	}
 
@@ -1681,12 +1681,12 @@ retry_open:
 					continue;
 				}
 
-				pr_debug2("\nsys_perf_event_open failed, error %d\n",
+				pr_debug2_peo("\nsys_perf_event_open failed, error %d\n",
 					  err);
 				goto try_fallback;
 			}
 
-			pr_debug2(" = %d\n", fd);
+			pr_debug2_peo(" = %d\n", fd);
 
 			if (evsel->bpf_fd >= 0) {
 				int evt_fd = fd;
@@ -1754,58 +1754,58 @@ try_fallback:
 	 */
 	if (!perf_missing_features.aux_output && evsel->core.attr.aux_output) {
 		perf_missing_features.aux_output = true;
-		pr_debug2("Kernel has no attr.aux_output support, bailing out\n");
+		pr_debug2_peo("Kernel has no attr.aux_output support, bailing out\n");
 		goto out_close;
 	} else if (!perf_missing_features.bpf && evsel->core.attr.bpf_event) {
 		perf_missing_features.bpf = true;
-		pr_debug2("switching off bpf_event\n");
+		pr_debug2_peo("switching off bpf_event\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.ksymbol && evsel->core.attr.ksymbol) {
 		perf_missing_features.ksymbol = true;
-		pr_debug2("switching off ksymbol\n");
+		pr_debug2_peo("switching off ksymbol\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.write_backward && evsel->core.attr.write_backward) {
 		perf_missing_features.write_backward = true;
-		pr_debug2("switching off write_backward\n");
+		pr_debug2_peo("switching off write_backward\n");
 		goto out_close;
 	} else if (!perf_missing_features.clockid_wrong && evsel->core.attr.use_clockid) {
 		perf_missing_features.clockid_wrong = true;
-		pr_debug2("switching off clockid\n");
+		pr_debug2_peo("switching off clockid\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.clockid && evsel->core.attr.use_clockid) {
 		perf_missing_features.clockid = true;
-		pr_debug2("switching off use_clockid\n");
+		pr_debug2_peo("switching off use_clockid\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.cloexec && (flags & PERF_FLAG_FD_CLOEXEC)) {
 		perf_missing_features.cloexec = true;
-		pr_debug2("switching off cloexec flag\n");
+		pr_debug2_peo("switching off cloexec flag\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.mmap2 && evsel->core.attr.mmap2) {
 		perf_missing_features.mmap2 = true;
-		pr_debug2("switching off mmap2\n");
+		pr_debug2_peo("switching off mmap2\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.exclude_guest &&
 		   (evsel->core.attr.exclude_guest || evsel->core.attr.exclude_host)) {
 		perf_missing_features.exclude_guest = true;
-		pr_debug2("switching off exclude_guest, exclude_host\n");
+		pr_debug2_peo("switching off exclude_guest, exclude_host\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.sample_id_all) {
 		perf_missing_features.sample_id_all = true;
-		pr_debug2("switching off sample_id_all\n");
+		pr_debug2_peo("switching off sample_id_all\n");
 		goto retry_sample_id;
 	} else if (!perf_missing_features.lbr_flags &&
 			(evsel->core.attr.branch_sample_type &
 			 (PERF_SAMPLE_BRANCH_NO_CYCLES |
 			  PERF_SAMPLE_BRANCH_NO_FLAGS))) {
 		perf_missing_features.lbr_flags = true;
-		pr_debug2("switching off branch sample type no (cycles/flags)\n");
+		pr_debug2_peo("switching off branch sample type no (cycles/flags)\n");
 		goto fallback_missing_features;
 	} else if (!perf_missing_features.group_read &&
 		    evsel->core.attr.inherit &&
 		   (evsel->core.attr.read_format & PERF_FORMAT_GROUP) &&
 		   perf_evsel__is_group_leader(evsel)) {
 		perf_missing_features.group_read = true;
-		pr_debug2("switching off group read\n");
+		pr_debug2_peo("switching off group read\n");
 		goto fallback_missing_features;
 	}
 out_close:
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
index 2511860..83212c6 100644
--- a/tools/perf/util/python.c
+++ b/tools/perf/util/python.c
@@ -65,6 +65,7 @@ struct perf_env perf_env;
  * implementing 'verbose' and 'eprintf'.
  */
 int verbose;
+int debug_peo_args;
 
 int eprintf(int level, int var, const char *fmt, ...);
 

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

end of thread, other threads:[~2019-11-15  7:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-08  3:59 [RFC] perf record: Add option to print perf_event_open args and return value Ravi Bangoria
2019-11-08  8:04 ` Jiri Olsa
2019-11-08  8:35   ` Ravi Bangoria
2019-11-08  9:30     ` [PATCH] perf tool: Provide an " Ravi Bangoria
2019-11-08  9:41       ` [PATCH v2] " Ravi Bangoria
2019-11-08 11:00         ` Jiri Olsa
2019-11-11 13:52           ` Arnaldo Carvalho de Melo
2019-11-12 11:29           ` Arnaldo Carvalho de Melo
2019-11-12 11:37             ` Arnaldo Carvalho de Melo
2019-11-12 14:00               ` Ravi Bangoria
2019-11-15  7:40         ` [tip: perf/core] " tip-bot2 for Ravi Bangoria

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