Commit 021e9f47 authored by Ingo Molnar's avatar Ingo Molnar

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: default avatarIngo Molnar <mingo@elte.hu>
parent f2521b6e
...@@ -67,6 +67,8 @@ static unsigned int mmap_read_head(struct mmap_data *md) ...@@ -67,6 +67,8 @@ static unsigned int mmap_read_head(struct mmap_data *md)
static long events; static long events;
static struct timeval last_read, this_read; static struct timeval last_read, this_read;
static __u64 bytes_written;
static void mmap_read(struct mmap_data *md) static void mmap_read(struct mmap_data *md)
{ {
unsigned int head = mmap_read_head(md); unsigned int head = mmap_read_head(md);
...@@ -114,28 +116,34 @@ static void mmap_read(struct mmap_data *md) ...@@ -114,28 +116,34 @@ static void mmap_read(struct mmap_data *md)
buf = &data[old & md->mask]; buf = &data[old & md->mask];
size = md->mask + 1 - (old & md->mask); size = md->mask + 1 - (old & md->mask);
old += size; old += size;
while (size) { while (size) {
int ret = write(output, buf, size); int ret = write(output, buf, size);
if (ret < 0) {
perror("failed to write"); if (ret < 0)
exit(-1); die("failed to write");
}
size -= ret; size -= ret;
buf += ret; buf += ret;
bytes_written += ret;
} }
} }
buf = &data[old & md->mask]; buf = &data[old & md->mask];
size = head - old; size = head - old;
old += size; old += size;
while (size) { while (size) {
int ret = write(output, buf, size); int ret = write(output, buf, size);
if (ret < 0) {
perror("failed to write"); if (ret < 0)
exit(-1); die("failed to write");
}
size -= ret; size -= ret;
buf += ret; buf += ret;
bytes_written += ret;
} }
md->prev = old; md->prev = old;
...@@ -467,8 +475,14 @@ static int __cmd_record(int argc, const char **argv) ...@@ -467,8 +475,14 @@ static int __cmd_record(int argc, const char **argv)
ret = poll(event_array, nr_poll, 100); ret = poll(event_array, nr_poll, 100);
} }
/*
fprintf(stderr, "[ perf record: Captured and wrote %ld events. ]\n", events); * Approximate RIP event size: 24 bytes.
*/
fprintf(stderr,
"[ perf record: Captured and wrote %.3f MB %s (~%lld events) ]\n",
(double)bytes_written / 1024.0 / 1024.0,
output_name,
bytes_written / 24);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment