MediaWiki
REL1_19
|
00001 <?php 00025 require_once( dirname( __FILE__ ) . '/../Maintenance.php' ); 00026 require_once( dirname( __FILE__ ) . '/languages.inc' ); 00027 00028 class LangMemUsage extends Maintenance { 00029 00030 public function __construct() { 00031 parent::__construct(); 00032 $this->mDescription = "Dumb program that tries to get the memory usage\n" . 00033 "for each language file"; 00034 } 00035 00036 public function execute() { 00037 if ( !function_exists( 'memory_get_usage' ) ) 00038 $this->error( "You must compile PHP with --enable-memory-limit", true ); 00039 00040 $langtool = new languages(); 00041 $memlast = $memstart = memory_get_usage(); 00042 00043 $this->output( "Base memory usage: $memstart\n" ); 00044 00045 foreach ( $langtool->getLanguages() as $langcode ) { 00046 Language::factory( $langcode ); 00047 $memstep = memory_get_usage(); 00048 $this->output( sprintf( "%12s: %d\n", $langcode, ( $memstep - $memlast ) ) ); 00049 $memlast = $memstep; 00050 } 00051 00052 $memend = memory_get_usage(); 00053 00054 $this->output( ' Total Usage: ' . ( $memend - $memstart ) . "\n" ); 00055 } 00056 } 00057 00058 $maintClass = "LangMemUsage"; 00059 require_once( RUN_MAINTENANCE_IF_MAIN );