Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147631
b: refs/heads/master
c: 021e9f4
h: refs/heads/master
i:
  147629: 31031ca
  147627: 7471b15
  147623: 776327b
  147615: dc50df1
v: v3
  • Loading branch information
Ingo Molnar committed Jun 3, 2009
1 parent 2fd4455 commit b4e77ef
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f2521b6e4c365bd0aac61b2c346e6e9f22607e31
refs/heads/master: 021e9f476511ebe23d7f45854a52dfe74c09b6ee
34 changes: 24 additions & 10 deletions trunk/Documentation/perf_counter/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ static unsigned int mmap_read_head(struct mmap_data *md)
static long events;
static struct timeval last_read, this_read;

static __u64 bytes_written;

static void mmap_read(struct mmap_data *md)
{
unsigned int head = mmap_read_head(md);
Expand Down Expand Up @@ -114,28 +116,34 @@ static void mmap_read(struct mmap_data *md)
buf = &data[old & md->mask];
size = md->mask + 1 - (old & md->mask);
old += size;

while (size) {
int ret = write(output, buf, size);
if (ret < 0) {
perror("failed to write");
exit(-1);
}

if (ret < 0)
die("failed to write");

size -= ret;
buf += ret;

bytes_written += ret;
}
}

buf = &data[old & md->mask];
size = head - old;
old += size;

while (size) {
int ret = write(output, buf, size);
if (ret < 0) {
perror("failed to write");
exit(-1);
}

if (ret < 0)
die("failed to write");

size -= ret;
buf += ret;

bytes_written += ret;
}

md->prev = old;
Expand Down Expand Up @@ -467,8 +475,14 @@ static int __cmd_record(int argc, const char **argv)
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;
}
Expand Down

0 comments on commit b4e77ef

Please sign in to comment.