Benchmark
[ class tree: Benchmark ] [ index: Benchmark ] [ all elements ]

Class: Benchmark_Timer

Source Location: /Benchmark-1.2.3/Timer.php

Class Overview

PEAR
   |
   --Benchmark_Timer

Provides timing and profiling information.


Author(s):

Copyright:

  • Copyright &copy; 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>

Methods


Child classes:

Benchmark_Iterate
Provides timing and profiling information.

Inherited Variables

Inherited Methods


Class Details

[line 58]
Provides timing and profiling information.

Example 1: Automatic profiling start, stop, and output.


1 <?php
2 require_once 'Benchmark/Timer.php';
3
4 $timer = new Benchmark_Timer(TRUE);
5 $timer->setMarker('Marker 1');
6 ?>

Example 2: Manual profiling start, stop, and output.


1 <?php
2 require_once 'Benchmark/Timer.php';
3
4 $timer = new Benchmark_Timer();
5 $timer->start();
6 $timer->setMarker('Marker 1');
7 $timer->stop();
8
9 $timer->display(); // to output html formated
10 // AND/OR :
11 $profiling = $timer->getProfiling(); // get the profiler info as an associative array
12 ?>



[ Top ]


Method Detail

Benchmark_Timer (Constructor)   [line 89]

Benchmark_Timer Benchmark_Timer( [boolean $auto = FALSE])

Constructor.
  • Access: public

Parameters:

boolean   $auto     

[ Top ]

display   [line 299]

void display( [boolean $showTotal = FALSE])

Prints the information returned by getOutput().

Parameters:

boolean   $showTotal     Optionnaly includes total in output, default no

[ Top ]

getOutput   [line 215]

string getOutput( [boolean $showTotal = FALSE])

Return formatted profiling information.

Parameters:

boolean   $showTotal     Optionnaly includes total in output, default no

[ Top ]

getProfiling   [line 173]

array getProfiling( )

Returns profiling information.

$profiling[x]['name'] = name of marker x $profiling[x]['time'] = time index of marker x $profiling[x]['diff'] = execution time from marker x-1 to this marker x $profiling[x]['total'] = total execution time up to marker x

  • Access: public

[ Top ]

setMarker   [line 138]

void setMarker( string $name)

Set marker.

Parameters:

string   $name     Name of the marker to be set.

[ Top ]

start   [line 117]

void start( )

Set "Start" marker.

[ Top ]

stop   [line 127]

void stop( )

Set "Stop" marker.

[ Top ]

timeElapsed   [line 150]

double timeElapsed( [string $start = 'Start'], [string $end = 'Stop'])

Returns the time elapsed betweens two markers.
  • Return: time elapsed between $start and $end
  • Access: public

Parameters:

string   $start     start marker, defaults to "Start"
string   $end     end marker, defaults to "Stop"

[ Top ]


Documentation generated on Sat, 11 Jun 2005 08:20:06 -0400 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.