Index: trunk/phase3/maintenance/benchmarkPurge.php |
— | — | @@ -9,7 +9,12 @@ |
10 | 10 | /** */ |
11 | 11 | require_once( "commandLine.inc" ); |
12 | 12 | |
13 | | -/** @todo document */ |
| 13 | +/** |
| 14 | + * Run a bunch of URLs through SquidUpdate::purge() |
| 15 | + * to benchmark Squid response times. |
| 16 | + * @param $urls array A bunch of URLs to purge |
| 17 | + * @param $trials int How many times to run the test? |
| 18 | + */ |
14 | 19 | function benchSquid( $urls, $trials = 1 ) { |
15 | 20 | $start = wfTime(); |
16 | 21 | for( $i = 0; $i < $trials; $i++) { |
— | — | @@ -22,7 +27,10 @@ |
23 | 28 | count( $urls ), $pertrial * 1000.0, $pertitle * 1000.0 ); |
24 | 29 | } |
25 | 30 | |
26 | | -/** @todo document */ |
| 31 | +/** |
| 32 | + * Get an array of randomUrl()'s. |
| 33 | + * @param $length int How many urls to add to the array |
| 34 | + */ |
27 | 35 | function randomUrlList( $length ) { |
28 | 36 | $list = array(); |
29 | 37 | for( $i = 0; $i < $length; $i++ ) { |
— | — | @@ -31,13 +39,19 @@ |
32 | 40 | return $list; |
33 | 41 | } |
34 | 42 | |
35 | | -/** @todo document */ |
| 43 | +/** |
| 44 | + * Return a random URL of the wiki. Not necessarily an actual title in the |
| 45 | + * database, but at least a URL that looks like one. |
| 46 | + */ |
36 | 47 | function randomUrl() { |
37 | 48 | global $wgServer, $wgArticlePath; |
38 | 49 | return $wgServer . str_replace( '$1', randomTitle(), $wgArticlePath ); |
39 | 50 | } |
40 | 51 | |
41 | | -/** @todo document */ |
| 52 | +/** |
| 53 | + * Create a random title string (not necessarily a Title object). |
| 54 | + * For use with randomUrl(). |
| 55 | + */ |
42 | 56 | function randomTitle() { |
43 | 57 | $str = ''; |
44 | 58 | $length = mt_rand( 1, 20 ); |