* @ingroup Benchmark
*/
class BenchmarkPurge extends Benchmarker {
-
public function __construct() {
parent::__construct();
- $this->mDescription = "Benchmark the Squid purge functions.";
+ $this->addDescription( 'Benchmark the Squid purge functions.' );
}
public function execute() {
private function benchSquid( $urls, $trials = 1 ) {
$start = microtime( true );
for ( $i = 0; $i < $trials; $i++ ) {
- SquidUpdate::purge( $urls );
+ CdnCacheUpdate::purge( $urls );
}
$delta = microtime( true ) - $start;
$pertrial = $delta / $trials;
$pertitle = $pertrial / count( $urls );
+
return sprintf( "%4d titles in %6.2fms (%6.2fms each)",
count( $urls ), $pertrial * 1000.0, $pertitle * 1000.0 );
}
for ( $i = 0; $i < $length; $i++ ) {
$list[] = $this->randomUrl();
}
+
return $list;
}
*/
private function randomUrl() {
global $wgServer, $wgArticlePath;
+
return $wgServer . str_replace( '$1', $this->randomTitle(), $wgArticlePath );
}
for ( $i = 0; $i < $length; $i++ ) {
$str .= chr( mt_rand( ord( 'a' ), ord( 'z' ) ) );
}
+
return ucfirst( $str );
}
}