aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-12-14 17:52:33 -0500
committerSteven Rostedt <rostedt@goodmis.org>2010-12-14 17:52:33 -0500
commit245dd6a2e4f45b6cd04728a11bedaf3f490537e5 (patch)
tree6c9b85d31422b6d00198ef2d4f2adff53e13742d
parent65701dedeffb2a40096d91974b4a8ca8dfce486e (diff)
trace-cmd: Add max and min latencies for report with -w
Instead of just showing the average wakeup latency in the -w report, also show the max and min latencies as well as the time stamp that they occurred. Requested-by: Shawn Bohrer <sbohrer@rgmadvisors.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--trace-read.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/trace-read.c b/trace-read.c
index 4aa8d75..dc79cf1 100644
--- a/trace-read.c
+++ b/trace-read.c
@@ -366,6 +366,11 @@ static void add_wakeup(unsigned int val, unsigned long long start)
366 wakeup_hash[key] = info; 366 wakeup_hash[key] = info;
367} 367}
368 368
369static unsigned long long max_lat = 0;
370static unsigned long long max_time;
371static unsigned long long min_lat = -1;
372static unsigned long long min_time;
373
369static void add_sched(unsigned int val, unsigned long long end) 374static void add_sched(unsigned int val, unsigned long long end)
370{ 375{
371 unsigned int key = calc_wakeup_key(val); 376 unsigned int key = calc_wakeup_key(val);
@@ -379,6 +384,15 @@ static void add_sched(unsigned int val, unsigned long long end)
379 384
380 cal = end - info->start; 385 cal = end - info->start;
381 386
387 if (cal > max_lat) {
388 max_lat = cal;
389 max_time = end;
390 }
391 if (cal < min_lat) {
392 min_lat = cal;
393 min_time = end;
394 }
395
382 printf(" Latency: %llu.%03llu usecs", cal / 1000, cal % 1000); 396 printf(" Latency: %llu.%03llu usecs", cal / 1000, cal % 1000);
383 397
384 total_wakeup_lat += cal; 398 total_wakeup_lat += cal;
@@ -437,9 +451,15 @@ static void finish_wakeup(void)
437 451
438 total_wakeup_lat /= wakeup_lat_count; 452 total_wakeup_lat /= wakeup_lat_count;
439 453
440 printf("\nAverage wakeup latency: %llu.%03llu usecs\n\n", 454 printf("\nAverage wakeup latency: %llu.%03llu usecs\n",
441 total_wakeup_lat / 1000, 455 total_wakeup_lat / 1000,
442 total_wakeup_lat % 1000); 456 total_wakeup_lat % 1000);
457 printf("Maximum Latency: %llu.%03llu usecs at ", max_lat / 1000, max_lat % 1000);
458 printf("timestamp: %llu.%06llu\n",
459 max_time / 1000000000, ((max_time + 500) % 1000000000) / 1000);
460 printf("Minimum Latency: %llu.%03llu usecs at ", min_lat / 1000, min_lat % 1000);
461 printf("timestamp: %llu.%06llu\n\n", min_time / 1000000000,
462 ((min_time + 500) % 1000000000) / 1000);
443 463
444 for (i = 0; i < WAKEUP_HASH_SIZE; i++) { 464 for (i = 0; i < WAKEUP_HASH_SIZE; i++) {
445 while (wakeup_hash[i]) { 465 while (wakeup_hash[i]) {