perf auxtrace: Add optional log flags to the itrace 'd' option
authorAdrian Hunter <adrian.hunter@intel.com>
Fri, 10 Jul 2020 15:10:59 +0000 (18:10 +0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 6 Aug 2020 11:22:38 +0000 (08:22 -0300)
Allow the 'd' option to be followed by flags which will affect what debug
messages will or will not be reported. Each flag must be preceded by either
'+' or '-'. The flags are:
a all perf events

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lore.kernel.org/lkml/20200710151104.15137-8-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/Documentation/itrace.txt
tools/perf/util/auxtrace.c
tools/perf/util/auxtrace.h

index 114d0544d7c7cfb5e9dd01cf80c5a74ea926d4e7..9c0e8586ed4741d44ff4cf1a60538a64cc8b3fbd 100644 (file)
@@ -53,3 +53,8 @@
        The flags are:
                o       overflow
                l       trace data lost
+
+       If supported, the 'd' option may be followed by flags which affect what
+       debug messages will or will not be logged. Each flag must be preceded
+       by either '+' or '-'. The flags are:
+               a       all perf events
index f0b0758830ee2860e61edef32735847613d388fd..e028187c51fe8b51f2cb684771a279154818e87b 100644 (file)
@@ -1483,6 +1483,9 @@ int itrace_parse_synth_opts(const struct option *opt, const char *str,
                        break;
                case 'd':
                        synth_opts->log = true;
+                       if (get_flags(&p, &synth_opts->log_plus_flags,
+                                     &synth_opts->log_minus_flags))
+                               goto out_err;
                        break;
                case 'c':
                        synth_opts->branches = true;
index cfe6d00d8624e2a71cd6adb50e64e8b5608df25e..821ef5446a13585090cb8823dad9d1c92fd7436a 100644 (file)
@@ -58,6 +58,8 @@ enum itrace_period_type {
 #define AUXTRACE_ERR_FLG_OVERFLOW      (1 << ('o' - 'a'))
 #define AUXTRACE_ERR_FLG_DATA_LOST     (1 << ('l' - 'a'))
 
+#define AUXTRACE_LOG_FLG_ALL_PERF_EVTS (1 << ('a' - 'a'))
+
 /**
  * struct itrace_synth_opts - AUX area tracing synthesis options.
  * @set: indicates whether or not options have been set
@@ -96,6 +98,8 @@ enum itrace_period_type {
  * @range_num: number of time intervals to trace
  * @error_plus_flags: flags to affect what errors are reported
  * @error_minus_flags: flags to affect what errors are reported
+ * @log_plus_flags: flags to affect what is logged
+ * @log_minus_flags: flags to affect what is logged
  */
 struct itrace_synth_opts {
        bool                    set;
@@ -131,6 +135,8 @@ struct itrace_synth_opts {
        int                     range_num;
        unsigned int            error_plus_flags;
        unsigned int            error_minus_flags;
+       unsigned int            log_plus_flags;
+       unsigned int            log_minus_flags;
 };
 
 /**
@@ -624,7 +630,9 @@ bool auxtrace__evsel_is_auxtrace(struct perf_session *session,
 "                                                      each flag must be preceded by + or -\n" \
 "                                                      error flags are: o (overflow)\n" \
 "                                                                       l (data lost)\n" \
-"                              d:                      create a debug log\n"                   \
+"                              d[flags]:               create a debug log\n" \
+"                                                      each flag must be preceded by + or -\n" \
+"                                                      log flags are: a (all perf events)\n" \
 "                              f:                      synthesize first level cache events\n" \
 "                              m:                      synthesize last level cache events\n" \
 "                              t:                      synthesize TLB events\n" \