perf script: Add support for PERF_TYPE_RAW
authorArun Sharma <[email protected]>
Thu, 14 Apr 2011 17:38:18 +0000 (10:38 -0700)
committerArnaldo Carvalho de Melo <[email protected]>
Tue, 19 Apr 2011 14:08:58 +0000 (11:08 -0300)
Useful for getting stack traces for hardware events not handled by
PERF_TYPE_HARDWARE.

Cc: Frederic Weisbecker <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Stephane Eranian <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Tom Zanussi <[email protected]>
Signed-off-by: Arun Sharma <[email protected]>
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/perf/builtin-script.c

index 6cf811acc41b0313cef295b11e413447a41800e4..b3012c4fff19dfb29849ea681bd7df71c05308f6 100644 (file)
@@ -82,6 +82,16 @@ static struct {
                                  PERF_OUTPUT_CPU | PERF_OUTPUT_TIME |
                                  PERF_OUTPUT_EVNAME | PERF_OUTPUT_TRACE,
        },
+
+       [PERF_TYPE_RAW] = {
+               .user_set = false,
+
+               .fields = PERF_OUTPUT_COMM | PERF_OUTPUT_TID |
+                             PERF_OUTPUT_CPU | PERF_OUTPUT_TIME |
+                             PERF_OUTPUT_EVNAME | PERF_OUTPUT_SYM,
+
+               .invalid_fields = PERF_OUTPUT_TRACE,
+       },
 };
 
 static bool output_set_by_user(void)
@@ -502,6 +512,8 @@ static int parse_output_fields(const struct option *opt __used,
                        type = PERF_TYPE_SOFTWARE;
                else if (!strcmp(str, "trace"))
                        type = PERF_TYPE_TRACEPOINT;
+               else if (!strcmp(str, "raw"))
+                       type = PERF_TYPE_RAW;
                else {
                        fprintf(stderr, "Invalid event type in field string.\n");
                        return -EINVAL;
@@ -902,7 +914,7 @@ static const struct option options[] = {
        OPT_STRING(0, "symfs", &symbol_conf.symfs, "directory",
                    "Look for files with symbols relative to this directory"),
        OPT_CALLBACK('f', "fields", NULL, "str",
-                    "comma separated output fields prepend with 'type:'. Valid types: hw,sw,trace. Fields: comm,tid,pid,time,cpu,event,trace,sym",
+                    "comma separated output fields prepend with 'type:'. Valid types: hw,sw,trace,raw. Fields: comm,tid,pid,time,cpu,event,trace,sym",
                     parse_output_fields),
 
        OPT_END()