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

Class: Benchmark_Profiler

Source Location: /Benchmark-1.2.6/Profiler.php

Class Overview

PEAR
   |
   --Benchmark_Profiler

Provides timing and profiling information.


Author(s):

Copyright:

  • Copyright &copy; 2002-2005 Matthias Englert <Matthias.Englert@gmx.de>

Methods


Inherited Variables

Inherited Methods


Class Details

[line 79]
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 149]

Benchmark_Profiler Benchmark_Profiler( [ $auto = FALSE])

Constructor, starts profiling recording
  • Access: public

Parameters:

   $auto   — 

[ Top ]

display   [line 338]

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

void enterSection( string $name)

Enters code section.

Parameters:

string   $name   —  name of the code section

[ Top ]

getAllSectionsInformations   [line 222]

array getAllSectionsInformations( )

Returns profiling informations for all sections.
  • Access: public

[ Top ]

getSectionInformations   [line 178]

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

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

Parameters:

string   $section   — 

[ Top ]

leaveSection   [line 404]

void leaveSection( string $name)

Leaves code section.

Parameters:

string   $name   —  name of the marker to be set

[ Top ]

start   [line 348]

void start( )

Enters "Global" section.

[ Top ]

stop   [line 358]

void stop( )

Leaves "Global" section.

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:37:18 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.