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

Class: Benchmark_Profiler

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

Class Overview

PEAR
   |
   --Benchmark_Profiler

Provides timing and profiling information.


Author(s):

Copyright:

  • 2002-2006 Matthias Englert <Matthias.Englert@gmx.de>

Methods


Inherited Variables

Inherited Methods


Class Details

[line 86]
Provides timing and profiling information.

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

  1.  <?php
  2.  require_once 'Benchmark/Profiler.php';
  3.  
  4.  $profiler = new Benchmark_Profiler(true);
  5.  
  6.  function myFunction({
  7.      global $profiler;
  8.      $profiler->enterSection('myFunction');
  9.      //do something
  10.      $profiler->leaveSection('myFunction');
  11.      return;
  12.  }
  13.  
  14.  //do something
  15.  myFunction();
  16.  //do more
  17.  ?>

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

  1.  <?php
  2.  require_once 'Benchmark/Profiler.php';
  3.  
  4.  $profiler = new Benchmark_Profiler();
  5.  
  6.  function myFunction({
  7.      global $profiler;
  8.      $profiler->enterSection('myFunction');
  9.      //do something
  10.      $profiler->leaveSection('myFunction');
  11.      return;
  12.  }
  13.  
  14.  $profiler->start();
  15.  //do something
  16.  myFunction();
  17.  //do more
  18.  $profiler->stop();
  19.  $profiler->display();
  20.  ?>



[ Top ]


Method Detail

Benchmark_Profiler (Constructor)   [line 160]

Benchmark_Profiler Benchmark_Profiler( [bool $auto = false])

Constructor, starts profiling recording
  • Access: public

Parameters:

bool   $auto     Automatically start benchmarking

[ Top ]

close   [line 177]

void close( )

Close method, stop profiling recording and display output.
  • Access: public

[ Top ]

display   [line 377]

void display( [string $format = 'auto'])

Returns formatted profiling information.
  • Access: public

Parameters:

string   $format     output format (auto, plain or html), default auto

[ Top ]

enterSection   [line 415]

void enterSection( string $name)

Enters code section.

Parameters:

string   $name     The code section

[ Top ]

getAllSectionsInformations   [line 245]

array getAllSectionsInformations( )

Returns profiling informations for all sections.
  • Access: public

[ Top ]

getSectionInformations   [line 193]

array getSectionInformations( [string $section = 'Global'])

Returns profiling informations for a given section.
  • Access: public

Parameters:

string   $section     Section to retrieve

[ Top ]

leaveSection   [line 459]

void leaveSection( string $name)

Leaves code section.

Parameters:

string   $name     The marker to be set

[ Top ]

start   [line 389]

void start( )

Enters "Global" section.

[ Top ]

stop   [line 401]

void stop( )

Leaves "Global" section.

[ Top ]


Documentation generated on Sun, 11 Dec 2011 13:30:02 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.