Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 146160
b: refs/heads/master
c: 5a772b2
h: refs/heads/master
v: v3
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed May 11, 2009
1 parent 481e1bf commit 0441990
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 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: 79c5d3ce614d8fe706545c7bca2158b63db6bb5e
refs/heads/master: 5a772b2b3c68e7e0b503c5a48469113bb0634314
12 changes: 7 additions & 5 deletions trunk/kernel/trace/ring_buffer_benchmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ static void ring_buffer_producer(void)
}

time = end_tv.tv_sec - start_tv.tv_sec;
time *= 1000000;
time *= USEC_PER_SEC;
time += (long long)((long)end_tv.tv_usec - (long)start_tv.tv_usec);

entries = ring_buffer_entries(buffer);
Expand All @@ -273,7 +273,8 @@ static void ring_buffer_producer(void)
pr_info("Missed: %ld\n", missed);
pr_info("Hit: %ld\n", hit);

do_div(time, 1000);
/* Convert time from usecs to millisecs */
do_div(time, USEC_PER_MSEC);
if (time)
hit /= (long)time;
else
Expand All @@ -282,18 +283,19 @@ static void ring_buffer_producer(void)
pr_info("Entries per millisec: %ld\n", hit);

if (hit) {
avg = 1000000 / hit;
/* Calculate the average time in nanosecs */
avg = NSEC_PER_MSEC / hit;
pr_info("%ld ns per entry\n", avg);
}


if (missed) {
if (time)
missed /= (long)time;

pr_info("Total iterations per millisec: %ld\n", hit + missed);

avg = 1000000 / (hit + missed);
/* Caculate the average time in nanosecs */
avg = NSEC_PER_MSEC / (hit + missed);
pr_info("%ld ns per entry\n", avg);
}
}
Expand Down

0 comments on commit 0441990

Please sign in to comment.