diff options
author | Steven Rostedt <srostedt@redhat.com> | 2010-12-14 17:52:33 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2010-12-14 17:52:33 -0500 |
commit | 245dd6a2e4f45b6cd04728a11bedaf3f490537e5 (patch) | |
tree | 6c9b85d31422b6d00198ef2d4f2adff53e13742d | |
parent | 65701dedeffb2a40096d91974b4a8ca8dfce486e (diff) | |
download | trace-cmd-245dd6a2e4f45b6cd04728a11bedaf3f490537e5.tar.gz |
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.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/trace-read.c b/trace-read.c index 4aa8d759..dc79cf12 100644 --- a/trace-read.c +++ b/trace-read.c @@ -366,6 +366,11 @@ static void add_wakeup(unsigned int val, unsigned long long start) wakeup_hash[key] = info; } +static unsigned long long max_lat = 0; +static unsigned long long max_time; +static unsigned long long min_lat = -1; +static unsigned long long min_time; + static void add_sched(unsigned int val, unsigned long long end) { unsigned int key = calc_wakeup_key(val); @@ -379,6 +384,15 @@ static void add_sched(unsigned int val, unsigned long long end) cal = end - info->start; + if (cal > max_lat) { + max_lat = cal; + max_time = end; + } + if (cal < min_lat) { + min_lat = cal; + min_time = end; + } + printf(" Latency: %llu.%03llu usecs", cal / 1000, cal % 1000); total_wakeup_lat += cal; @@ -437,9 +451,15 @@ static void finish_wakeup(void) total_wakeup_lat /= wakeup_lat_count; - printf("\nAverage wakeup latency: %llu.%03llu usecs\n\n", + printf("\nAverage wakeup latency: %llu.%03llu usecs\n", total_wakeup_lat / 1000, total_wakeup_lat % 1000); + printf("Maximum Latency: %llu.%03llu usecs at ", max_lat / 1000, max_lat % 1000); + printf("timestamp: %llu.%06llu\n", + max_time / 1000000000, ((max_time + 500) % 1000000000) / 1000); + printf("Minimum Latency: %llu.%03llu usecs at ", min_lat / 1000, min_lat % 1000); + printf("timestamp: %llu.%06llu\n\n", min_time / 1000000000, + ((min_time + 500) % 1000000000) / 1000); for (i = 0; i < WAKEUP_HASH_SIZE; i++) { while (wakeup_hash[i]) { |