2017 © Pedro Peláez
 

library profile-dux

A profiling utility to use in the absence of XDebug

image

zeroem/profile-dux

A profiling utility to use in the absence of XDebug

  • Sunday, April 22, 2012
  • by zeroem
  • Repository
  • 1 Watchers
  • 2 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Profile - Doesn't Use Xdebug

A simple object oriented profiling tool, (*1)

Usage

Normal Usage

$profiler = new \Dux\Profiler();

for($i=0; $i < $n; $i++) {
    $profiler->start();
    // do something that you want proifled
    $profiler->end();
}

\Dux\Aggregate\Report::generate(
    $profiler, 
    new \Dux\Aggregate\Mean()
)->renderAggregate();

// Outputs:
// Mean execution time: (mean)ms

Special Circumstances

When profiling sub-millisecond execution times, the overhead of the method calls can greatly impact your profiling results. To combat this, simply generate the microtime values and add them to the profiler after execution., (*2)

NOTE: Only use microtime(), not microtime(true). Floating point numbers lose precision as they get larger. To deal with this, profile-dux makes use of the string representation of microtime which separates the millisecond offset from the Unix timestamp., (*3)

$profiler = new \Dux\Profiler();

for($i=0; $i < $n; $i++) {
    $start = microtime();
    // do something that you want proifled
    $end = microtime();
    $profiler->addProfile($start,$end);
}

Installation

Simply add zeroem/profile-dux to your Composer requirements:, (*4)

"require": {
    "zeroem/profile-dux":"*"
}

and install your dependencies:, (*5)

$> php composer.phar install

The Versions

22/04 2012

dev-master

9999999-dev

A profiling utility to use in the absence of XDebug

  Sources   Download

by Darrell Hamilton

profiling benchmarking