Fix for r47482: put the RELEASE-NOTES entry in the "bug fixes" section and not the...
[mediawiki.git] / maintenance / stats.php
blob00f79ded817266b82a02af61580c62506746ba4e
1 <?php
2 /**
3 * Show statistics from memcached
5 * @file
6 * @ingroup Maintenance
7 */
9 require_once('commandLine.inc');
11 if( get_class( $wgMemc ) == 'FakeMemCachedClient' ) {
12 die("You are running FakeMemCachedClient, I can not provide any statistics.\n");
14 $session = intval($wgMemc->get(wfMemcKey('stats','request_with_session')));
15 $noSession = intval($wgMemc->get(wfMemcKey('stats','request_without_session')));
16 $total = $session + $noSession;
17 if ( $total == 0 ) {
18 die("You either have no stats or memcached isn't running. Aborting.\n");
20 print "Requests\n";
21 printf( "with session: %-10d %6.2f%%\n", $session, $session/$total*100 );
22 printf( "without session: %-10d %6.2f%%\n", $noSession, $noSession/$total*100 );
23 printf( "total: %-10d %6.2f%%\n", $total, 100 );
26 print "\nParser cache\n";
27 $hits = intval($wgMemc->get(wfMemcKey('stats','pcache_hit')));
28 $invalid = intval($wgMemc->get(wfMemcKey('stats','pcache_miss_invalid')));
29 $expired = intval($wgMemc->get(wfMemcKey('stats','pcache_miss_expired')));
30 $absent = intval($wgMemc->get(wfMemcKey('stats','pcache_miss_absent')));
31 $stub = intval($wgMemc->get(wfMemcKey('stats','pcache_miss_stub')));
32 $total = $hits + $invalid + $expired + $absent + $stub;
33 printf( "hits: %-10d %6.2f%%\n", $hits, $hits/$total*100 );
34 printf( "invalid: %-10d %6.2f%%\n", $invalid, $invalid/$total*100 );
35 printf( "expired: %-10d %6.2f%%\n", $expired, $expired/$total*100 );
36 printf( "absent: %-10d %6.2f%%\n", $absent, $absent/$total*100 );
37 printf( "stub threshold: %-10d %6.2f%%\n", $stub, $stub/$total*100 );
38 printf( "total: %-10d %6.2f%%\n", $total, 100 );
40 $hits = intval($wgMemc->get(wfMemcKey('stats','image_cache_hit')));
41 $misses = intval($wgMemc->get(wfMemcKey('stats','image_cache_miss')));
42 $updates = intval($wgMemc->get(wfMemcKey('stats','image_cache_update')));
43 $total = $hits + $misses;
44 print("\nImage cache\n");
45 printf( "hits: %-10d %6.2f%%\n", $hits, $hits/$total*100 );
46 printf( "misses: %-10d %6.2f%%\n", $misses, $misses/$total*100 );
47 printf( "updates: %-10d\n", $updates );
49 $hits = intval($wgMemc->get(wfMemcKey('stats','diff_cache_hit')));
50 $misses = intval($wgMemc->get(wfMemcKey('stats','diff_cache_miss')));
51 $uncacheable = intval($wgMemc->get(wfMemcKey('stats','diff_uncacheable')));
52 $total = $hits + $misses + $uncacheable;
53 print("\nDiff cache\n");
54 printf( "hits: %-10d %6.2f%%\n", $hits, $hits/$total*100 );
55 printf( "misses: %-10d %6.2f%%\n", $misses, $misses/$total*100 );
56 printf( "uncacheable: %-10d %6.2f%%\n", $uncacheable, $uncacheable/$total*100 );