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

Class: Benchmark_Timer

Source Location: /Benchmark-1.2.2beta1/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 57]
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.  $profiling $timer->getProfiling();
  10.  print $profiling->getOutput();
  11.  ?>



[ Top ]


Method Detail

Benchmark_Timer (Constructor)   [line 88]

Benchmark_Timer Benchmark_Timer( [boolean $auto = FALSE])

Constructor.
  • Access: public

Parameters:

boolean   $auto   — 

[ Top ]

display   [line 272]

void display( )

Prints the information returned by getOutput().

[ Top ]

getOutput   [line 210]

string getOutput( )

Return formatted profiling information.

[ Top ]

getProfiling   [line 172]

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

void setMarker( string $name)

Set marker.

Parameters:

string   $name   —  Name of the marker to be set.

[ Top ]

start   [line 116]

void start( )

Set "Start" marker.

[ Top ]

stop   [line 126]

void stop( )

Set "Stop" marker.

[ Top ]

timeElapsed   [line 149]

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 Mon, 11 Mar 2019 14:00:15 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.