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

Class: Benchmark_Profiler

Source Location: /Benchmark-1.2.3/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 77]
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 147]

Benchmark_Profiler Benchmark_Profiler( [ $auto = FALSE])

Constructor, starts profiling recording
  • Access: public

Parameters:

   $auto   — 

[ Top ]

display   [line 316]

void display( )

Returns formatted profiling information.
  • Access: public

[ Top ]

enterSection   [line 347]

void enterSection( string $name)

Enters code section.

Parameters:

string   $name   —  name of the code section

[ Top ]

getAllSectionsInformations   [line 220]

array getAllSectionsInformations( )

Returns profiling informations for all sections.
  • Access: public

[ Top ]

getSectionInformations   [line 176]

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

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

Parameters:

string   $section   — 

[ Top ]

leaveSection   [line 382]

void leaveSection( string $name)

Leaves code section.

Parameters:

string   $name   —  name of the marker to be set

[ Top ]

start   [line 326]

void start( )

Enters "Global" section.

[ Top ]

stop   [line 336]

void stop( )

Leaves "Global" section.

[ Top ]


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