diff options
Diffstat (limited to 'tools/perf/builtin-trace.c')
-rw-r--r-- | tools/perf/builtin-trace.c | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 574a215e800b..5db687fc13de 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -44,6 +44,7 @@ static void setup_scripting(void) | |||
44 | perf_set_argv_exec_path(perf_exec_path()); | 44 | perf_set_argv_exec_path(perf_exec_path()); |
45 | 45 | ||
46 | setup_perl_scripting(); | 46 | setup_perl_scripting(); |
47 | setup_python_scripting(); | ||
47 | 48 | ||
48 | scripting_ops = &default_scripting_ops; | 49 | scripting_ops = &default_scripting_ops; |
49 | } | 50 | } |
@@ -75,11 +76,8 @@ static int process_sample_event(event_t *event, struct perf_session *session) | |||
75 | 76 | ||
76 | event__parse_sample(event, session->sample_type, &data); | 77 | event__parse_sample(event, session->sample_type, &data); |
77 | 78 | ||
78 | dump_printf("(IP, %d): %d/%d: %p period: %Ld\n", | 79 | dump_printf("(IP, %d): %d/%d: %#Lx period: %Ld\n", event->header.misc, |
79 | event->header.misc, | 80 | data.pid, data.tid, data.ip, data.period); |
80 | data.pid, data.tid, | ||
81 | (void *)(long)data.ip, | ||
82 | (long long)data.period); | ||
83 | 81 | ||
84 | thread = perf_session__findnew(session, event->ip.pid); | 82 | thread = perf_session__findnew(session, event->ip.pid); |
85 | if (thread == NULL) { | 83 | if (thread == NULL) { |
@@ -103,22 +101,9 @@ static int process_sample_event(event_t *event, struct perf_session *session) | |||
103 | return 0; | 101 | return 0; |
104 | } | 102 | } |
105 | 103 | ||
106 | static int sample_type_check(struct perf_session *session) | ||
107 | { | ||
108 | if (!(session->sample_type & PERF_SAMPLE_RAW)) { | ||
109 | fprintf(stderr, | ||
110 | "No trace sample to read. Did you call perf record " | ||
111 | "without -R?"); | ||
112 | return -1; | ||
113 | } | ||
114 | |||
115 | return 0; | ||
116 | } | ||
117 | |||
118 | static struct perf_event_ops event_ops = { | 104 | static struct perf_event_ops event_ops = { |
119 | .process_sample_event = process_sample_event, | 105 | .sample = process_sample_event, |
120 | .process_comm_event = event__process_comm, | 106 | .comm = event__process_comm, |
121 | .sample_type_check = sample_type_check, | ||
122 | }; | 107 | }; |
123 | 108 | ||
124 | static int __cmd_trace(struct perf_session *session) | 109 | static int __cmd_trace(struct perf_session *session) |
@@ -235,9 +220,9 @@ static int parse_scriptname(const struct option *opt __used, | |||
235 | const char *script, *ext; | 220 | const char *script, *ext; |
236 | int len; | 221 | int len; |
237 | 222 | ||
238 | if (strcmp(str, "list") == 0) { | 223 | if (strcmp(str, "lang") == 0) { |
239 | list_available_languages(); | 224 | list_available_languages(); |
240 | return 0; | 225 | exit(0); |
241 | } | 226 | } |
242 | 227 | ||
243 | script = strchr(str, ':'); | 228 | script = strchr(str, ':'); |
@@ -531,6 +516,8 @@ static const struct option options[] = { | |||
531 | parse_scriptname), | 516 | parse_scriptname), |
532 | OPT_STRING('g', "gen-script", &generate_script_lang, "lang", | 517 | OPT_STRING('g', "gen-script", &generate_script_lang, "lang", |
533 | "generate perf-trace.xx script in specified language"), | 518 | "generate perf-trace.xx script in specified language"), |
519 | OPT_STRING('i', "input", &input_name, "file", | ||
520 | "input file name"), | ||
534 | 521 | ||
535 | OPT_END() | 522 | OPT_END() |
536 | }; | 523 | }; |
@@ -592,6 +579,9 @@ int cmd_trace(int argc, const char **argv, const char *prefix __used) | |||
592 | if (session == NULL) | 579 | if (session == NULL) |
593 | return -ENOMEM; | 580 | return -ENOMEM; |
594 | 581 | ||
582 | if (!perf_session__has_traces(session, "record -R")) | ||
583 | return -EINVAL; | ||
584 | |||
595 | if (generate_script_lang) { | 585 | if (generate_script_lang) { |
596 | struct stat perf_stat; | 586 | struct stat perf_stat; |
597 | 587 | ||