Parent Directory
|
Revision Log
Revision 6828 - (view) (download) (as text)
| 1 : | apizer | 6828 | #!/usr/bin/perl |
| 2 : | |||
| 3 : | # This script reads the timing log and outputs timing information including | ||
| 4 : | # the number and per cent of accesses taking various amount of time. | ||
| 5 : | # It can give you a rough idea of how well your server id performing. | ||
| 6 : | # If you have a large timing log, it can tale awhile for the script to complete processing. | ||
| 7 : | |||
| 8 : | # To run the script, cd to the WeBWorK logs directory (usually /opt/webwork/webwork2/logs) | ||
| 9 : | # and enter the command: timing_log_check.pl | ||
| 10 : | |||
| 11 : | # Note that this assumes perl is locates in /usr/bin/perl (check with the command "which perl") | ||
| 12 : | # and /opt/webwork/webwork2/bin/ is in your path. | ||
| 13 : | |||
| 14 : | open(PGFILE,'timing.log') || warn "Can't read timing.log: $!"; | ||
| 15 : | my @lines = <PGFILE>; close(PGFILE); | ||
| 16 : | |||
| 17 : | my $under0point1sec = 0; | ||
| 18 : | my $under0point2sec = 0; | ||
| 19 : | my $under0point5sec = 0; | ||
| 20 : | my $under1sec = 0; | ||
| 21 : | my $under2sec = 0; | ||
| 22 : | my $under3sec = 0; | ||
| 23 : | my $under4sec = 0; | ||
| 24 : | my $under5sec = 0; | ||
| 25 : | my $under10sec = 0; | ||
| 26 : | my $over10sec = 0; | ||
| 27 : | my $nonvalid = 0; | ||
| 28 : | my $line; | ||
| 29 : | my $count = 0; | ||
| 30 : | my $time = 0; | ||
| 31 : | |||
| 32 : | foreach $line (@lines) { | ||
| 33 : | $count++; | ||
| 34 : | $line =~ /runTime = (\d+\.\d+) sec/; | ||
| 35 : | $time = $1; | ||
| 36 : | if ($time < 0.1){ | ||
| 37 : | $under0point1sec++; | ||
| 38 : | } | ||
| 39 : | elsif ($time < 0.2){ | ||
| 40 : | $under0point2sec++; | ||
| 41 : | } | ||
| 42 : | elsif ($time < 0.5){ | ||
| 43 : | $under0point5sec++; | ||
| 44 : | } | ||
| 45 : | elsif ($time < 1.0){ | ||
| 46 : | $under1sec++; | ||
| 47 : | } | ||
| 48 : | elsif ($time < 2.0){ | ||
| 49 : | $under2sec++; | ||
| 50 : | } | ||
| 51 : | elsif ($time < 3.0){ | ||
| 52 : | $under3sec++; | ||
| 53 : | } | ||
| 54 : | elsif ($time < 4.0){ | ||
| 55 : | $under4sec++; | ||
| 56 : | } | ||
| 57 : | elsif ($time < 5.0){ | ||
| 58 : | $under5sec++; | ||
| 59 : | } | ||
| 60 : | elsif ($time < 10.0){ | ||
| 61 : | $under10sec++; | ||
| 62 : | } | ||
| 63 : | elsif ($time >= 10.0){ | ||
| 64 : | $over10sec++; | ||
| 65 : | } | ||
| 66 : | else { | ||
| 67 : | $nonvalid++; | ||
| 68 : | } | ||
| 69 : | } | ||
| 70 : | my $percent_under0point1sec = 0; | ||
| 71 : | my $percent_under0point2sec = 0; | ||
| 72 : | my $percent_under0point5sec = 0; | ||
| 73 : | my $percent_under1sec = 0; | ||
| 74 : | my $percent_under2sec = 0; | ||
| 75 : | my $percent_under3sec = 0; | ||
| 76 : | my $percent_under4sec = 0; | ||
| 77 : | my $percent_under5sec = 0; | ||
| 78 : | my $percent_under10sec = 0; | ||
| 79 : | my $percent_over10sec = 0; | ||
| 80 : | my $percent_nonvalid = 0; | ||
| 81 : | |||
| 82 : | $percent_under0point1sec = (int($under0point1sec/$count*1000 +.5))/10; | ||
| 83 : | $percent_under0point2sec = (int($under0point2sec/$count*1000 +.5))/10; | ||
| 84 : | $percent_under0point5sec = (int($under0point5sec/$count*1000 +.5))/10; | ||
| 85 : | $percent_under1sec = (int($under1sec/$count*1000 +.5))/10; | ||
| 86 : | $percent_under2sec = (int($under2sec/$count*1000 +.5))/10; | ||
| 87 : | $percent_under3sec = (int($under3sec/$count*1000 +.5))/10; | ||
| 88 : | $percent_under4sec = (int($under4sec/$count*1000 +.5))/10; | ||
| 89 : | $percent_under5sec = (int($under5sec/$count*1000 +.5))/10; | ||
| 90 : | $percent_under10sec = (int($under10sec/$count*1000 +.5))/10; | ||
| 91 : | $percent_over10sec = (int($over10sec/$count*1000 +.5))/10; | ||
| 92 : | $percent_nonvalid = (int($nonvalid/$count*1000 +.5))/10; | ||
| 93 : | |||
| 94 : | |||
| 95 : | print "count = $count\n"; | ||
| 96 : | print "under 0.1 seconds = $under0point1sec: ${percent_under0point1sec}%\n"; | ||
| 97 : | print "between 0.1 and 0.2 seconds = $under0point2sec: ${percent_under0point2sec}%\n"; | ||
| 98 : | print "between 0.2 and 0.5 seconds = $under0point5sec: ${percent_under0point5sec}%\n"; | ||
| 99 : | print "between 0.5 and 1.0 seconds = $under1sec: ${percent_under1sec}%\n"; | ||
| 100 : | print "between 1.0 and 2.0 seconds = $under2sec: ${percent_under2sec}%\n"; | ||
| 101 : | print "between 2.0 and 3.0 seconds = $under3sec: ${percent_under3sec}%\n"; | ||
| 102 : | print "between 3.0 and 4.0 seconds = $under4sec: ${percent_under4sec}%\n"; | ||
| 103 : | print "between 4.0 and 5.0 seconds = $under5sec: ${percent_under5sec}%\n"; | ||
| 104 : | print "between 5.0 and 10.0 seconds = $under10sec: ${percent_under10sec}%\n"; | ||
| 105 : | print "over 10.0 seconds = $over10sec: ${percent_over10sec}%\n"; | ||
| 106 : | print "non valid response = $nonvalid: ${percent_nonvalid}%\n"; | ||
| 107 : | |||
| 108 : | exit(0); |
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |