diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-06-03 13:27:19 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-06-03 13:27:19 -0400 |
commit | 021e9f476511ebe23d7f45854a52dfe74c09b6ee (patch) | |
tree | eb31959c6751b7ea4efd60563353a669c647effb /Documentation | |
parent | f2521b6e4c365bd0aac61b2c346e6e9f22607e31 (diff) |
perf record: Refine capture printout
Print out the number of bytes captured, and the (estimated) number of
events the output file contains.
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/perf_counter/builtin-record.c | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c index fa625258315e..efa2eb498e9c 100644 --- a/Documentation/perf_counter/builtin-record.c +++ b/Documentation/perf_counter/builtin-record.c | |||
@@ -67,6 +67,8 @@ static unsigned int mmap_read_head(struct mmap_data *md) | |||
67 | static long events; | 67 | static long events; |
68 | static struct timeval last_read, this_read; | 68 | static struct timeval last_read, this_read; |
69 | 69 | ||
70 | static __u64 bytes_written; | ||
71 | |||
70 | static void mmap_read(struct mmap_data *md) | 72 | static void mmap_read(struct mmap_data *md) |
71 | { | 73 | { |
72 | unsigned int head = mmap_read_head(md); | 74 | unsigned int head = mmap_read_head(md); |
@@ -114,28 +116,34 @@ static void mmap_read(struct mmap_data *md) | |||
114 | buf = &data[old & md->mask]; | 116 | buf = &data[old & md->mask]; |
115 | size = md->mask + 1 - (old & md->mask); | 117 | size = md->mask + 1 - (old & md->mask); |
116 | old += size; | 118 | old += size; |
119 | |||
117 | while (size) { | 120 | while (size) { |
118 | int ret = write(output, buf, size); | 121 | int ret = write(output, buf, size); |
119 | if (ret < 0) { | 122 | |
120 | perror("failed to write"); | 123 | if (ret < 0) |
121 | exit(-1); | 124 | die("failed to write"); |
122 | } | 125 | |
123 | size -= ret; | 126 | size -= ret; |
124 | buf += ret; | 127 | buf += ret; |
128 | |||
129 | bytes_written += ret; | ||
125 | } | 130 | } |
126 | } | 131 | } |
127 | 132 | ||
128 | buf = &data[old & md->mask]; | 133 | buf = &data[old & md->mask]; |
129 | size = head - old; | 134 | size = head - old; |
130 | old += size; | 135 | old += size; |
136 | |||
131 | while (size) { | 137 | while (size) { |
132 | int ret = write(output, buf, size); | 138 | int ret = write(output, buf, size); |
133 | if (ret < 0) { | 139 | |
134 | perror("failed to write"); | 140 | if (ret < 0) |
135 | exit(-1); | 141 | die("failed to write"); |
136 | } | 142 | |
137 | size -= ret; | 143 | size -= ret; |
138 | buf += ret; | 144 | buf += ret; |
145 | |||
146 | bytes_written += ret; | ||
139 | } | 147 | } |
140 | 148 | ||
141 | md->prev = old; | 149 | md->prev = old; |
@@ -467,8 +475,14 @@ static int __cmd_record(int argc, const char **argv) | |||
467 | ret = poll(event_array, nr_poll, 100); | 475 | ret = poll(event_array, nr_poll, 100); |
468 | } | 476 | } |
469 | 477 | ||
470 | 478 | /* | |
471 | fprintf(stderr, "[ perf record: Captured and wrote %ld events. ]\n", events); | 479 | * Approximate RIP event size: 24 bytes. |
480 | */ | ||
481 | fprintf(stderr, | ||
482 | "[ perf record: Captured and wrote %.3f MB %s (~%lld events) ]\n", | ||
483 | (double)bytes_written / 1024.0 / 1024.0, | ||
484 | output_name, | ||
485 | bytes_written / 24); | ||
472 | 486 | ||
473 | return 0; | 487 | return 0; |
474 | } | 488 | } |