チラ裏 PEAR::Benchmark_Timerを使う

多分こう

<?php
require_once 'Benchmark/Timer.php';
$timer = new Benchmark_Timer();
// ------- Timer Start -------
$timer->start();
for ($i = 0; $i < 10000; $i++) md5($i);
$timer->setMaker('md5: 10000本ノック'); // 途中経過
$timer->stop();
// ------- Timer End -------
// 計測結果表示
$timer->display();
$ php -v
PHP 5.3.2-1ubuntu4.2 with Suhosin-Patch (cli) (built: May 13 2010 20:01:00) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

$ pear -V
PEAR Version: 1.9.1
PHP Version: 5.3.2-1ubuntu4.2
Zend Engine Version: 2.3.0
Running on: Linux ubuntu 2.6.32-22-generic #36-Ubuntu SMP Thu Jun 3 22:02:19 UTC 2010 i686

$ pear list
Installed packages, channel pear.php.net:
=========================================
Package            Version State
Archive_Tar        1.3.7   stable
Auth               1.6.2   stable
Benchmark          1.2.7   stable
Calendar           0.5.4   beta
Console_Getopt     1.2.3   stable
HTTP_Client        1.2.1   stable
HTTP_Request       1.4.4   stable
HTTP_Session2      0.7.2   beta
MDB2               2.4.1   stable
MDB2_Driver_mysql  1.4.1   stable
MDB2_Driver_mysqli 1.4.1   stable
Net_Socket         1.0.9   stable
Net_URL            1.0.15  stable
PEAR               1.9.1   stable
PHP_CodeSniffer    1.2.2   stable
Structures_Graph   1.0.3   stable
XML_Parser         1.3.0   stable
XML_RSS            0.9.10  beta
XML_Serializer     0.20.0  beta
XML_Util           1.2.1   stable