diff options
author | Sage Weil <sage@newdream.net> | 2009-02-18 11:47:23 -0800 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2009-02-18 11:47:23 -0800 |
commit | cec662cc5f36f298e96272822b405a8973d787a2 (patch) | |
tree | 4a1ed2483f18389735838487979821260b9ee136 | |
parent | ffc756ea682bbd9994f2d56e5b0a00c29437bc8d (diff) | |
download | ceph-cec662cc5f36f298e96272822b405a8973d787a2.tar.gz |
script: check_osd_request_latency
-rwxr-xr-x | src/script/check_osd_request_latency.pl | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/script/check_osd_request_latency.pl b/src/script/check_osd_request_latency.pl new file mode 100755 index 00000000000..63f750fbc3a --- /dev/null +++ b/src/script/check_osd_request_latency.pl @@ -0,0 +1,46 @@ +#!/usr/bin/perl + +use strict; + +my %r; # reqid -> start +my %lat_req; # latency -> request + +sub tosec($) { + my $v = shift; + my ($h, $m, $s) = split(/:/, $v); + my $r = $s + 60 * ($m + (60 * $h)); + #print "$v = $h $m $s = $r\n"; + return $r; +} + +while (<>) { + chomp; + my ($stamp) = /^\S+ (\S+) /; + + my ($who,$tid) = /osd\d+ <.. (\D+\d+) \S+ \S+ osd_op\(\S+:(\d+)/; + if (defined $tid) { + my $req = "$who:$tid"; + $r{$req} = $stamp unless exists $r{$req}; + next; + } + + my ($who,$tid) = /\d+ -- \S+ osd\d+ --> (\D+\d+) \S+ \S+ osd_op_reply\((\d+)/; + if (defined $tid) { + my $req = "$who:$tid"; + if (exists $r{$req}) { + my $len = tosec($stamp) - tosec($r{$req}); + + #print "$req $len ($r{$req} - $stamp)\n"; + $lat_req{$len} = $req; + + delete $r{$req}; + } + next; + } + +} + + +for my $len (sort {$b <=> $a} keys %lat_req) { + print "$len\t$lat_req{$len}\n"; +} |