diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-18 11:19:03 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-18 11:19:03 -0400 |
| commit | 4d7b4ac22fbec1a03206c6cde353f2fd6942f828 (patch) | |
| tree | 2d96a9e9c28cf6fa628a278decc00ad55a8b043b /tools/perf/util/trace-event-info.c | |
| parent | 3aaf51ace5975050ab43c7d4d7e439e0ae7d13d7 (diff) | |
| parent | 94f3ca95787ada3d64339a4ecb2754236ab563f6 (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: (311 commits)
perf tools: Add mode to build without newt support
perf symbols: symbol inconsistency message should be done only at verbose=1
perf tui: Add explicit -lslang option
perf options: Type check all the remaining OPT_ variants
perf options: Type check OPT_BOOLEAN and fix the offenders
perf options: Check v type in OPT_U?INTEGER
perf options: Introduce OPT_UINTEGER
perf tui: Add workaround for slang < 2.1.4
perf record: Fix bug mismatch with -c option definition
perf options: Introduce OPT_U64
perf tui: Add help window to show key associations
perf tui: Make <- exit menus too
perf newt: Add single key shortcuts for zoom into DSO and threads
perf newt: Exit browser unconditionally when CTRL+C, q or Q is pressed
perf newt: Fix the 'A'/'a' shortcut for annotate
perf newt: Make <- exit the ui_browser
x86, perf: P4 PMU - fix counters management logic
perf newt: Make <- zoom out filters
perf report: Report number of events, not samples
perf hist: Clarify events_stats fields usage
...
Fix up trivial conflicts in kernel/fork.c and tools/perf/builtin-record.c
Diffstat (limited to 'tools/perf/util/trace-event-info.c')
| -rw-r--r-- | tools/perf/util/trace-event-info.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c index 5ea8973ad331..b1572601286c 100644 --- a/tools/perf/util/trace-event-info.c +++ b/tools/perf/util/trace-event-info.c | |||
| @@ -154,10 +154,17 @@ static void put_tracing_file(char *file) | |||
| 154 | free(file); | 154 | free(file); |
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | static ssize_t calc_data_size; | ||
| 158 | |||
| 157 | static ssize_t write_or_die(const void *buf, size_t len) | 159 | static ssize_t write_or_die(const void *buf, size_t len) |
| 158 | { | 160 | { |
| 159 | int ret; | 161 | int ret; |
| 160 | 162 | ||
| 163 | if (calc_data_size) { | ||
| 164 | calc_data_size += len; | ||
| 165 | return len; | ||
| 166 | } | ||
| 167 | |||
| 161 | ret = write(output_fd, buf, len); | 168 | ret = write(output_fd, buf, len); |
| 162 | if (ret < 0) | 169 | if (ret < 0) |
| 163 | die("writing to '%s'", output_file); | 170 | die("writing to '%s'", output_file); |
| @@ -480,6 +487,17 @@ get_tracepoints_path(struct perf_event_attr *pattrs, int nb_events) | |||
| 480 | return nr_tracepoints > 0 ? path.next : NULL; | 487 | return nr_tracepoints > 0 ? path.next : NULL; |
| 481 | } | 488 | } |
| 482 | 489 | ||
| 490 | bool have_tracepoints(struct perf_event_attr *pattrs, int nb_events) | ||
| 491 | { | ||
| 492 | int i; | ||
| 493 | |||
| 494 | for (i = 0; i < nb_events; i++) | ||
| 495 | if (pattrs[i].type == PERF_TYPE_TRACEPOINT) | ||
| 496 | return true; | ||
| 497 | |||
| 498 | return false; | ||
| 499 | } | ||
| 500 | |||
| 483 | int read_tracing_data(int fd, struct perf_event_attr *pattrs, int nb_events) | 501 | int read_tracing_data(int fd, struct perf_event_attr *pattrs, int nb_events) |
| 484 | { | 502 | { |
| 485 | char buf[BUFSIZ]; | 503 | char buf[BUFSIZ]; |
| @@ -526,3 +544,20 @@ int read_tracing_data(int fd, struct perf_event_attr *pattrs, int nb_events) | |||
| 526 | 544 | ||
| 527 | return 0; | 545 | return 0; |
| 528 | } | 546 | } |
| 547 | |||
| 548 | ssize_t read_tracing_data_size(int fd, struct perf_event_attr *pattrs, | ||
| 549 | int nb_events) | ||
| 550 | { | ||
| 551 | ssize_t size; | ||
| 552 | int err = 0; | ||
| 553 | |||
| 554 | calc_data_size = 1; | ||
| 555 | err = read_tracing_data(fd, pattrs, nb_events); | ||
| 556 | size = calc_data_size - 1; | ||
| 557 | calc_data_size = 0; | ||
| 558 | |||
| 559 | if (err < 0) | ||
| 560 | return err; | ||
| 561 | |||
| 562 | return size; | ||
| 563 | } | ||
