2017 © Pedro Peláez
 

library phpsimpleprofiler

Lightweight php profiler library

image

sigjlr/phpsimpleprofiler

Lightweight php profiler library

  • Thursday, November 7, 2013
  • by sigjlr
  • Repository
  • 1 Watchers
  • 0 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

PhpSimpleProfiler

Lightweight php profiler library, (*1)

Install

You may install the PhpSimpleProfiler with Composer (recommended) or manually., (*2)

Usage

This example assumes you are autoloading dependencies using Composer or any other PSR-0 compliant autoloader., (*3)

PhpSimpleProfiler available method:, (*4)

  • setOption($name , $value) Set the option (if $name is a valid option name) value with the desidered one. Available option : 'active' (bool) (default = true) If setted to false no profile will recorded 'handler' (PhpSimpleProfiler\Handler\IHandler) (default = PhpSimpleProfiler\HandlerStreamHandler) The object that manipulate and return the data 'realUsage' (bool) (default = false) Set it to TRUE to get the real size of memory allocated from system (all the memory used by the engine php), set it to FALSE to get only the memory used by emalloc() (only script), (*5)

  • add($message) Add an entry to the statistical profile., (*6)

  • stop() Ends the profiler., (*7)

  • printData() Gets the data., (*8)

Handlers

  • StreamHandler This handler is intended to print profile data in a log file, (*9)

  • HTMLHandler This handler is intended to show data into a web page, (*10)

Example

```php // Create a new PhpSimpleProfiler $psp = new PhpSimpleProfiler\PhpSimpleProfiler(array('realUsage' =>true));, (*11)

// Add profiled entry $psp->add('Before loop');, (*12)

$y = 0; for($i = 0; $i<1000; ++$i){ $y++;
}, (*13)

// Add profiled entry $psp->add('After loop');, (*14)

// Stop the profiler $psp->stop();, (*15)

// Print the result echo $psp->printData();, (*16)

// You shold see something like this: /* Time: 1380207924 | Memory Usage: 0.75 MB | execution_time: 1.4066696166992E-5 | Info: Initial state Time: 1380207924 | Memory Usage: 0.75 MB | execution_time: 0.00024199485778809 | Info: Before loop Time: 1380207924 | Memory Usage: 0.75 MB | execution_time: 0.00027799606323242 | Info: After loop Time: 1380207924 | Memory Usage: 0.75 MB | execution_time: 1.6927719116211E-5 | Info: Final state, (*17)

Peak of memory usage: 0.75 MB, (*18)

CPU elaboration time: 0.00055694580078125 */, (*19)

````, (*20)

License

The PhpSimpleProfiler is released under the MIT public license, (*21)

The Versions

07/11 2013

dev-master

9999999-dev https://github.com/sigjlr/PhpSimpleProfiler

Lightweight php profiler library

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

ini profiler memory usage