summaryrefslogtreecommitdiff
path: root/maintenance/language/langmemusage.php
blob: 9bfb3cdc963393afecd8809094da89523ee12c6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
/**
 * Dumb program that tries to get the memory usage
 * for each language file.
 *
 * @file
 * @ingroup MaintenanceLanguage
 */

/** This is a command line script */
require_once(dirname(__FILE__).'/../commandLine.inc');
require_once(dirname(__FILE__).'/languages.inc');

$langtool = new languages();

if ( ! function_exists( 'memory_get_usage' ) )
	wfDie( "You must compile PHP with --enable-memory-limit\n" );

$memlast = $memstart = memory_get_usage();

print 'Base memory usage: '.$memstart."\n";

foreach ( $langtool->getLanguages() as $langcode ) {
	Language::factory( $langcode );
	$memstep = memory_get_usage();
	printf( "%12s: %d\n", $langcode, ($memstep- $memlast) );
	$memlast = $memstep;
}

$memend = memory_get_usage();

echo ' Total Usage: '.($memend - $memstart)."\n";