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

Class: Benchmark_Timer

Source Location: /Benchmark-1.2.9/Benchmark/Timer.php

Class Overview

PEAR
   |
   --Benchmark_Timer

Provides timing and profiling information.


Author(s):

Copyright:

  • 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 66]
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 profiler info as associative array
  12.  ?>



[ Top ]


Method Detail

Benchmark_Timer (Constructor)   [line 99]

Benchmark_Timer Benchmark_Timer( [boolean $auto = false])

Constructor.
  • Access: public

Parameters:

boolean   $auto     Automatically start timer

[ Top ]

close   [line 116]

void close( )

Close method. Stop timer and display output.
  • Access: public

[ Top ]

display   [line 363]

void display( [boolean $showTotal = false], [string $format = 'auto'])

Prints the information returned by getOutput().

Parameters:

boolean   $showTotal     Optionnaly includes total in output, default no
string   $format     output format (auto, plain or html), default auto

[ Top ]

getOutput   [line 254]

string getOutput( [boolean $showTotal = false], [string $format = 'auto'])

Return formatted profiling information.

Parameters:

boolean   $showTotal     Optionnaly includes total in output, default no
string   $format     output format (auto, plain or html), default auto

[ Top ]

getProfiling   [line 197]

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 157]

void setMarker( string $name)

Set marker.

Parameters:

string   $name     Name of the marker to be set.

[ Top ]

start   [line 131]

void start( )

Set "Start" marker.

[ Top ]

stop   [line 143]

void stop( )

Set "Stop" marker.

[ Top ]

timeElapsed   [line 171]

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 Sun, 11 Dec 2011 13:30:03 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.