Index: trunk/phase3/maintenance/stats.php |
— | — | @@ -37,8 +37,8 @@ |
38 | 38 | global $wgMemc; |
39 | 39 | |
40 | 40 | // Can't do stats if |
41 | | - if ( get_class( $wgMemc ) == 'FakeMemCachedClient' ) { |
42 | | - $this->error( "You are running FakeMemCachedClient, I can not provide any statistics.", true ); |
| 41 | + if ( get_class( $wgMemc ) == 'EmptyBagOStuff' ) { |
| 42 | + $this->error( "You are running EmptyBagOStuff, I can not provide any statistics.", true ); |
43 | 43 | } |
44 | 44 | $session = intval( $wgMemc->get( wfMemcKey( 'stats', 'request_with_session' ) ) ); |
45 | 45 | $noSession = intval( $wgMemc->get( wfMemcKey( 'stats', 'request_without_session' ) ) ); |
— | — | @@ -59,30 +59,42 @@ |
60 | 60 | $absent = intval( $wgMemc->get( wfMemcKey( 'stats', 'pcache_miss_absent' ) ) ); |
61 | 61 | $stub = intval( $wgMemc->get( wfMemcKey( 'stats', 'pcache_miss_stub' ) ) ); |
62 | 62 | $total = $hits + $invalid + $expired + $absent + $stub; |
63 | | - $this->output( sprintf( "hits: %-10d %6.2f%%\n", $hits, $hits / $total * 100 ) ); |
64 | | - $this->output( sprintf( "invalid: %-10d %6.2f%%\n", $invalid, $invalid / $total * 100 ) ); |
65 | | - $this->output( sprintf( "expired: %-10d %6.2f%%\n", $expired, $expired / $total * 100 ) ); |
66 | | - $this->output( sprintf( "absent: %-10d %6.2f%%\n", $absent, $absent / $total * 100 ) ); |
67 | | - $this->output( sprintf( "stub threshold: %-10d %6.2f%%\n", $stub, $stub / $total * 100 ) ); |
68 | | - $this->output( sprintf( "total: %-10d %6.2f%%\n", $total, 100 ) ); |
| 63 | + if ( $total ) { |
| 64 | + $this->output( sprintf( "hits: %-10d %6.2f%%\n", $hits, $hits / $total * 100 ) ); |
| 65 | + $this->output( sprintf( "invalid: %-10d %6.2f%%\n", $invalid, $invalid / $total * 100 ) ); |
| 66 | + $this->output( sprintf( "expired: %-10d %6.2f%%\n", $expired, $expired / $total * 100 ) ); |
| 67 | + $this->output( sprintf( "absent: %-10d %6.2f%%\n", $absent, $absent / $total * 100 ) ); |
| 68 | + $this->output( sprintf( "stub threshold: %-10d %6.2f%%\n", $stub, $stub / $total * 100 ) ); |
| 69 | + $this->output( sprintf( "total: %-10d %6.2f%%\n", $total, 100 ) ); |
| 70 | + } else { |
| 71 | + $this->output( "no statistics available\n" ); |
| 72 | + } |
69 | 73 | |
| 74 | + $this->output( "\nImage cache\n" ); |
70 | 75 | $hits = intval( $wgMemc->get( wfMemcKey( 'stats', 'image_cache_hit' ) ) ); |
71 | 76 | $misses = intval( $wgMemc->get( wfMemcKey( 'stats', 'image_cache_miss' ) ) ); |
72 | 77 | $updates = intval( $wgMemc->get( wfMemcKey( 'stats', 'image_cache_update' ) ) ); |
73 | 78 | $total = $hits + $misses; |
74 | | - $this->output( "\nImage cache\n" ); |
75 | | - $this->output( sprintf( "hits: %-10d %6.2f%%\n", $hits, $hits / $total * 100 ) ); |
76 | | - $this->output( sprintf( "misses: %-10d %6.2f%%\n", $misses, $misses / $total * 100 ) ); |
77 | | - $this->output( sprintf( "updates: %-10d\n", $updates ) ); |
| 79 | + if ( $total ) { |
| 80 | + $this->output( sprintf( "hits: %-10d %6.2f%%\n", $hits, $hits / $total * 100 ) ); |
| 81 | + $this->output( sprintf( "misses: %-10d %6.2f%%\n", $misses, $misses / $total * 100 ) ); |
| 82 | + $this->output( sprintf( "updates: %-10d\n", $updates ) ); |
| 83 | + } else { |
| 84 | + $this->output( "no statistics available\n" ); |
| 85 | + } |
78 | 86 | |
| 87 | + $this->output( "\nDiff cache\n" ); |
79 | 88 | $hits = intval( $wgMemc->get( wfMemcKey( 'stats', 'diff_cache_hit' ) ) ); |
80 | 89 | $misses = intval( $wgMemc->get( wfMemcKey( 'stats', 'diff_cache_miss' ) ) ); |
81 | 90 | $uncacheable = intval( $wgMemc->get( wfMemcKey( 'stats', 'diff_uncacheable' ) ) ); |
82 | 91 | $total = $hits + $misses + $uncacheable; |
83 | | - $this->output( "\nDiff cache\n" ); |
84 | | - $this->output( sprintf( "hits: %-10d %6.2f%%\n", $hits, $hits / $total * 100 ) ); |
85 | | - $this->output( sprintf( "misses: %-10d %6.2f%%\n", $misses, $misses / $total * 100 ) ); |
86 | | - $this->output( sprintf( "uncacheable: %-10d %6.2f%%\n", $uncacheable, $uncacheable / $total * 100 ) ); |
| 92 | + if ( $total ) { |
| 93 | + $this->output( sprintf( "hits: %-10d %6.2f%%\n", $hits, $hits / $total * 100 ) ); |
| 94 | + $this->output( sprintf( "misses: %-10d %6.2f%%\n", $misses, $misses / $total * 100 ) ); |
| 95 | + $this->output( sprintf( "uncacheable: %-10d %6.2f%%\n", $uncacheable, $uncacheable / $total * 100 ) ); |
| 96 | + } else { |
| 97 | + $this->output( "no statistics available\n" ); |
| 98 | + } |
87 | 99 | } |
88 | 100 | } |
89 | 101 | |