cvs: php4 /pear/Benchmark Benchmark.php
| From: | Sebastian Bergmann | Date: | Fri, 29 Sep 2000 06:54:08 +0000 |
| Subject: | cvs: php4 /pear/Benchmark Benchmark.php | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-1871@lists.php.net to get a copy of this message | ||
sbergmann Thu Sep 28 23:54:08 2000 EDT
Modified files:
/php4/pear/Benchmark Benchmark.php
Log:
Benchmark now extends Benchmark_Timer.
Index: php4/pear/Benchmark/Benchmark.php
diff -u php4/pear/Benchmark/Benchmark.php:1.2 php4/pear/Benchmark/Benchmark.php:1.3
--- php4/pear/Benchmark/Benchmark.php:1.2 Thu Sep 28 09:18:49 2000
+++ php4/pear/Benchmark/Benchmark.php Thu Sep 28 23:54:08 2000
@@ -16,7 +16,7 @@
// | Authors: Sebastian Bergmann <sb@phpOpenTracker.de> |
// +----------------------------------------------------------------------+
//
-// $Id: Benchmark.php,v 1.2 2000/09/28 16:18:49 sbergmann Exp $
+// $Id: Benchmark.php,v 1.3 2000/09/29 06:54:08 sbergmann Exp $
//
require_once "Benchmark/Timer.php";
@@ -41,34 +41,8 @@
* @access public
*/
- class Benchmark
+ class Benchmark extends Benchmark_Timer
{
- // {{{ properties
-
- /**
- * Benchmark::Timer instance.
- *
- * @var object
- * @access private
- */
-
- var $timer;
-
- // }}}
- // {{{ Benchmark()
-
- /**
- * Constructor.
- *
- * @access public
- */
-
- function Benchmark()
- {
- $this->timer = new Benchmark_Timer;
- }
-
- // }}}
// {{{ run()
/**
@@ -83,11 +57,11 @@
{
for( $i = 1; $i <= $iterations; $i++ )
{
- $this->timer->set_marker( "start_" . $i );
+ $this->set_marker( "start_" . $i );
call_user_func( $function );
- $this->timer->set_marker( "end_" . $i );
+ $this->set_marker( "end_" . $i );
}
}
@@ -110,11 +84,11 @@
$result = array();
$total = 0;
- $iterations = count( $this->timer->markers ) / 2;
+ $iterations = count( $this->markers ) / 2;
for( $i = 1; $i <= $iterations; $i++ )
{
- $time = $this->timer->time_elapsed( "start_" . $i , "end_" . $i
);
+ $time = $this->time_elapsed( "start_" . $i , "end_" . $i );
$total = bcadd( $total, $time, 6 );
$result[ $i ] = $time;