diff options
author | Ingo Molnar <mingo@elte.hu> | 2010-05-04 12:31:47 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-05-04 12:31:47 -0400 |
commit | c4f3b5a2d70eae4abb8bcaaf8dc3f067ff1714e8 (patch) | |
tree | 54b857fc96f423ee3fcd4b8752169024ad8ebdb1 /tools | |
parent | 777d0411cd1e384115985dac5ccd42031e3eee2b (diff) | |
parent | 02bf60aad7d5912dfcdbe0154f1bd67ea7a8301e (diff) |
Merge branch 'perf' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 into perf/core
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/Documentation/perf-buildid-cache.txt | 4 | ||||
-rw-r--r-- | tools/perf/Documentation/perf-inject.txt | 35 | ||||
-rw-r--r-- | tools/perf/builtin-inject.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-record.c | 35 | ||||
-rw-r--r-- | tools/perf/command-list.txt | 1 | ||||
-rw-r--r-- | tools/perf/util/event.c | 1 | ||||
-rw-r--r-- | tools/perf/util/header.c | 9 | ||||
-rw-r--r-- | tools/perf/util/parse-events.h | 1 | ||||
-rw-r--r-- | tools/perf/util/trace-event-info.c | 5 |
9 files changed, 75 insertions, 18 deletions
diff --git a/tools/perf/Documentation/perf-buildid-cache.txt b/tools/perf/Documentation/perf-buildid-cache.txt index 88bc3b519746..5d1a9500277f 100644 --- a/tools/perf/Documentation/perf-buildid-cache.txt +++ b/tools/perf/Documentation/perf-buildid-cache.txt | |||
@@ -8,7 +8,7 @@ perf-buildid-cache - Manage build-id cache. | |||
8 | SYNOPSIS | 8 | SYNOPSIS |
9 | -------- | 9 | -------- |
10 | [verse] | 10 | [verse] |
11 | 'perf buildid-list <options>' | 11 | 'perf buildid-cache <options>' |
12 | 12 | ||
13 | DESCRIPTION | 13 | DESCRIPTION |
14 | ----------- | 14 | ----------- |
@@ -30,4 +30,4 @@ OPTIONS | |||
30 | 30 | ||
31 | SEE ALSO | 31 | SEE ALSO |
32 | -------- | 32 | -------- |
33 | linkperf:perf-record[1], linkperf:perf-report[1] | 33 | linkperf:perf-record[1], linkperf:perf-report[1], linkperf:perf-buildid-list[1] |
diff --git a/tools/perf/Documentation/perf-inject.txt b/tools/perf/Documentation/perf-inject.txt new file mode 100644 index 000000000000..025630d43cd2 --- /dev/null +++ b/tools/perf/Documentation/perf-inject.txt | |||
@@ -0,0 +1,35 @@ | |||
1 | perf-inject(1) | ||
2 | ============== | ||
3 | |||
4 | NAME | ||
5 | ---- | ||
6 | perf-inject - Filter to augment the events stream with additional information | ||
7 | |||
8 | SYNOPSIS | ||
9 | -------- | ||
10 | [verse] | ||
11 | 'perf inject <options>' | ||
12 | |||
13 | DESCRIPTION | ||
14 | ----------- | ||
15 | perf-inject reads a perf-record event stream and repipes it to stdout. At any | ||
16 | point the processing code can inject other events into the event stream - in | ||
17 | this case build-ids (-b option) are read and injected as needed into the event | ||
18 | stream. | ||
19 | |||
20 | Build-ids are just the first user of perf-inject - potentially anything that | ||
21 | needs userspace processing to augment the events stream with additional | ||
22 | information could make use of this facility. | ||
23 | |||
24 | OPTIONS | ||
25 | ------- | ||
26 | -b:: | ||
27 | --build-ids=:: | ||
28 | Inject build-ids into the output stream | ||
29 | -v:: | ||
30 | --verbose:: | ||
31 | Be more verbose. | ||
32 | |||
33 | SEE ALSO | ||
34 | -------- | ||
35 | linkperf:perf-record[1], linkperf:perf-report[1], linkperf:perf-archive[1] | ||
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c index 59e981a88908..8e3e47b064ce 100644 --- a/tools/perf/builtin-inject.c +++ b/tools/perf/builtin-inject.c | |||
@@ -204,7 +204,7 @@ static const char * const report_usage[] = { | |||
204 | }; | 204 | }; |
205 | 205 | ||
206 | static const struct option options[] = { | 206 | static const struct option options[] = { |
207 | OPT_BOOLEAN('b', "inject build-ids", &inject_build_ids, | 207 | OPT_BOOLEAN('b', "build-ids", &inject_build_ids, |
208 | "Inject build-ids into the output stream"), | 208 | "Inject build-ids into the output stream"), |
209 | OPT_INCR('v', "verbose", &verbose, | 209 | OPT_INCR('v', "verbose", &verbose, |
210 | "be more verbose (show build ids, etc)"), | 210 | "be more verbose (show build ids, etc)"), |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index ac989e9ba8fe..0ff67d1c4752 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -560,11 +560,12 @@ static int __cmd_record(int argc, const char **argv) | |||
560 | return err; | 560 | return err; |
561 | } | 561 | } |
562 | 562 | ||
563 | if (raw_samples) { | 563 | if (raw_samples && have_tracepoints(attrs, nr_counters)) { |
564 | perf_header__set_feat(&session->header, HEADER_TRACE_INFO); | 564 | perf_header__set_feat(&session->header, HEADER_TRACE_INFO); |
565 | } else { | 565 | } else { |
566 | for (i = 0; i < nr_counters; i++) { | 566 | for (i = 0; i < nr_counters; i++) { |
567 | if (attrs[i].sample_type & PERF_SAMPLE_RAW) { | 567 | if (attrs[i].sample_type & PERF_SAMPLE_RAW && |
568 | attrs[i].type == PERF_TYPE_TRACEPOINT) { | ||
568 | perf_header__set_feat(&session->header, HEADER_TRACE_INFO); | 569 | perf_header__set_feat(&session->header, HEADER_TRACE_INFO); |
569 | break; | 570 | break; |
570 | } | 571 | } |
@@ -662,19 +663,25 @@ static int __cmd_record(int argc, const char **argv) | |||
662 | return err; | 663 | return err; |
663 | } | 664 | } |
664 | 665 | ||
665 | err = event__synthesize_tracing_data(output, attrs, | 666 | if (have_tracepoints(attrs, nr_counters)) { |
666 | nr_counters, | 667 | /* |
667 | process_synthesized_event, | 668 | * FIXME err <= 0 here actually means that |
668 | session); | 669 | * there were no tracepoints so its not really |
669 | /* | 670 | * an error, just that we don't need to |
670 | * FIXME err <= 0 here actually means that there were no tracepoints | 671 | * synthesize anything. We really have to |
671 | * so its not really an error, just that we don't need to synthesize | 672 | * return this more properly and also |
672 | * anything. | 673 | * propagate errors that now are calling die() |
673 | * We really have to return this more properly and also propagate | 674 | */ |
674 | * errors that now are calling die() | 675 | err = event__synthesize_tracing_data(output, attrs, |
675 | */ | 676 | nr_counters, |
676 | if (err > 0) | 677 | process_synthesized_event, |
678 | session); | ||
679 | if (err <= 0) { | ||
680 | pr_err("Couldn't record tracing data.\n"); | ||
681 | return err; | ||
682 | } | ||
677 | advance_output(err); | 683 | advance_output(err); |
684 | } | ||
678 | } | 685 | } |
679 | 686 | ||
680 | machine = perf_session__find_host_machine(session); | 687 | machine = perf_session__find_host_machine(session); |
diff --git a/tools/perf/command-list.txt b/tools/perf/command-list.txt index 80a1a446ce35..949d77fc0b97 100644 --- a/tools/perf/command-list.txt +++ b/tools/perf/command-list.txt | |||
@@ -8,6 +8,7 @@ perf-bench mainporcelain common | |||
8 | perf-buildid-cache mainporcelain common | 8 | perf-buildid-cache mainporcelain common |
9 | perf-buildid-list mainporcelain common | 9 | perf-buildid-list mainporcelain common |
10 | perf-diff mainporcelain common | 10 | perf-diff mainporcelain common |
11 | perf-inject mainporcelain common | ||
11 | perf-list mainporcelain common | 12 | perf-list mainporcelain common |
12 | perf-sched mainporcelain common | 13 | perf-sched mainporcelain common |
13 | perf-record mainporcelain common | 14 | perf-record mainporcelain common |
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 1757b0ffeaa9..2477270c1d3f 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
@@ -713,6 +713,7 @@ int event__parse_sample(event_t *event, u64 type, struct sample_data *data) | |||
713 | array++; | 713 | array++; |
714 | } | 714 | } |
715 | 715 | ||
716 | data->id = -1ULL; | ||
716 | if (type & PERF_SAMPLE_ID) { | 717 | if (type & PERF_SAMPLE_ID) { |
717 | data->id = *array; | 718 | data->id = *array; |
718 | array++; | 719 | array++; |
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 79da0e50ef8f..8847bec64c54 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -436,7 +436,6 @@ static int perf_header__adds_write(struct perf_header *self, int fd) | |||
436 | trace_sec->size = lseek(fd, 0, SEEK_CUR) - trace_sec->offset; | 436 | trace_sec->size = lseek(fd, 0, SEEK_CUR) - trace_sec->offset; |
437 | } | 437 | } |
438 | 438 | ||
439 | |||
440 | if (perf_header__has_feat(self, HEADER_BUILD_ID)) { | 439 | if (perf_header__has_feat(self, HEADER_BUILD_ID)) { |
441 | struct perf_file_section *buildid_sec; | 440 | struct perf_file_section *buildid_sec; |
442 | 441 | ||
@@ -923,6 +922,14 @@ perf_header__find_attr(u64 id, struct perf_header *header) | |||
923 | { | 922 | { |
924 | int i; | 923 | int i; |
925 | 924 | ||
925 | /* | ||
926 | * We set id to -1 if the data file doesn't contain sample | ||
927 | * ids. Check for this and avoid walking through the entire | ||
928 | * list of ids which may be large. | ||
929 | */ | ||
930 | if (id == -1ULL) | ||
931 | return NULL; | ||
932 | |||
926 | for (i = 0; i < header->attrs; i++) { | 933 | for (i = 0; i < header->attrs; i++) { |
927 | struct perf_header_attr *attr = header->attr[i]; | 934 | struct perf_header_attr *attr = header->attr[i]; |
928 | int j; | 935 | int j; |
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index b8c1f64bc935..fc4ab3fe877a 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h | |||
@@ -13,6 +13,7 @@ struct tracepoint_path { | |||
13 | }; | 13 | }; |
14 | 14 | ||
15 | extern struct tracepoint_path *tracepoint_id_to_path(u64 config); | 15 | extern struct tracepoint_path *tracepoint_id_to_path(u64 config); |
16 | extern bool have_tracepoints(struct perf_event_attr *pattrs, int nb_events); | ||
16 | 17 | ||
17 | extern int nr_counters; | 18 | extern int nr_counters; |
18 | 19 | ||
diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c index 30cd9b575953..0a1fb9d4f3b6 100644 --- a/tools/perf/util/trace-event-info.c +++ b/tools/perf/util/trace-event-info.c | |||
@@ -487,6 +487,11 @@ get_tracepoints_path(struct perf_event_attr *pattrs, int nb_events) | |||
487 | return nr_tracepoints > 0 ? path.next : NULL; | 487 | return nr_tracepoints > 0 ? path.next : NULL; |
488 | } | 488 | } |
489 | 489 | ||
490 | bool have_tracepoints(struct perf_event_attr *pattrs, int nb_events) | ||
491 | { | ||
492 | return get_tracepoints_path(pattrs, nb_events) ? true : false; | ||
493 | } | ||
494 | |||
490 | int read_tracing_data(int fd, struct perf_event_attr *pattrs, int nb_events) | 495 | int read_tracing_data(int fd, struct perf_event_attr *pattrs, int nb_events) |
491 | { | 496 | { |
492 | char buf[BUFSIZ]; | 497 | char buf[BUFSIZ]; |