aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-trace.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-02-28 13:20:25 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-02-28 13:20:25 -0500
commit6556a6743549defc32e5f90ee2cb1ecd833a44c3 (patch)
tree622306583d4a3c13235a8bfc012854c125c597f1 /tools/perf/builtin-trace.c
parente0d272429a34ff143bfa04ee8e29dd4eed2964c7 (diff)
parent1dd2980d990068e20045b90c424518cc7f3657ff (diff)
Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (172 commits) perf_event, amd: Fix spinlock initialization perf_event: Fix preempt warning in perf_clock() perf tools: Flush maps on COMM events perf_events, x86: Split PMU definitions into separate files perf annotate: Handle samples not at objdump output addr boundaries perf_events, x86: Remove superflous MSR writes perf_events: Simplify code by removing cpu argument to hw_perf_group_sched_in() perf_events, x86: AMD event scheduling perf_events: Add new start/stop PMU callbacks perf_events: Report the MMAP pgoff value in bytes perf annotate: Defer allocating sym_priv->hist array perf symbols: Improve debugging information about symtab origins perf top: Use a macro instead of a constant variable perf symbols: Check the right return variable perf/scripts: Tag syscall_name helper as not yet available perf/scripts: Add perf-trace-python Documentation perf/scripts: Remove unnecessary PyTuple resizes perf/scripts: Add syscall tracing scripts perf/scripts: Add Python scripting engine perf/scripts: Remove check-perf-trace from listed scripts ... Fix trivial conflict in tools/perf/util/probe-event.c
Diffstat (limited to 'tools/perf/builtin-trace.c')
-rw-r--r--tools/perf/builtin-trace.c34
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
106static 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
118static struct perf_event_ops event_ops = { 104static 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
124static int __cmd_trace(struct perf_session *session) 109static 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