diff options
author | Sage Weil <sage@newdream.net> | 2009-01-22 11:04:54 -0800 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2009-01-22 11:04:54 -0800 |
commit | 2564622a32a903cb38d447a2d17512b7521a5788 (patch) | |
tree | 45e894c44365c753904056b9d73b0a7cb4110cce /src/script | |
parent | 4c75e0a8b704c81819582fb1e32671c36990ef3a (diff) | |
download | ceph-2564622a32a903cb38d447a2d17512b7521a5788.tar.gz |
script: find high latency requests in mds log
Diffstat (limited to 'src/script')
-rwxr-xr-x | src/script/check_request_latency.pl | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/script/check_request_latency.pl b/src/script/check_request_latency.pl new file mode 100755 index 00000000000..d88e14c3176 --- /dev/null +++ b/src/script/check_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 ($what,$req) = /\d+ -- \S+ mds\d+ ... client\d+ \S+ \S+ client_(request|reply)\((\S+)/; + + if (defined $req) { + #print "$what $req at $stamp\n"; + if ($what eq 'request') { + $r{$req} = $stamp; + } elsif ($what eq 'reply') { + 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}; + } + } else { + die; + } + } + + +} + + +for my $len (sort {$b <=> $a} keys %lat_req) { + print "$len\t$lat_req{$len}\n"; +} |