2017 © Pedro Peláez
 

library yolk-profiler

Gamer Network's PHP profiling library

image

gamernetwork/yolk-profiler

Gamer Network's PHP profiling library

  • Wednesday, May 18, 2016
  • by gamer-network
  • Repository
  • 10 Watchers
  • 1 Stars
  • 4,994 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 3 Versions
  • 5 % Grown

The README.md

Yolk Profiler

Scrutinizer Code Quality, (*1)

A simple profiling library for benchmarking code execution speed, memory usage and database queries., (*2)

Requirements

This library requires only PHP 5.4 or later and the Yolk Contracts package (gamernetwork/yolk-contracts)., (*3)

Installation

It is installable and autoloadable via Composer as gamer-network/yolk-profiler., (*4)

Alternatively, download a release or clone this repository, and add the \yolk\profiler namespace to an autoloader., (*5)

License

Yolk Profiler is open-sourced software licensed under the MIT license, (*6)

Quick Start

use yolk\profiler\Profiler;

$profiler = new Profiler();

$profiler->start('Op 1');
lengthyOperation1();
$profiler->stop('Op 1');

$profiler->start('Op 2');
lengthyOperation2();
$profiler->stop('Op 2');

// profile a query
$profiler->start('Query1');
doDatabaseQuery($sql, $params);
$profiler->stop('Query1');

$profiler->query($sql, $params, $profiler->getElapsed('Query1'));

// add some additional info
$profiler->meta('get', $_GET);
$profiler->meta('post', $_POST);

$profiler->stop();

// get a report
print_r(
    $profiler->getData()
);

Profiler Method Reference

reset( $time = null, $memory = null );, (*7)

start( $timer, $reset = false, $time = null );, (*8)

stop( $timer = null );, (*9)

isRunning( $timer = '' );, (*10)

getElapsed( $timer = '' );, (*11)

mark( $name = '' );, (*12)

query( $query, $parameters, $duration );, (*13)

meta( $key, $value );, (*14)

getQueries();, (*15)

getData();, (*16)

The Versions

18/05 2016

dev-develop

dev-develop

Gamer Network's PHP profiling library

  Sources   Download

MIT

The Requires

 

The Development Requires

framework eurogamer gamer network

24/07 2015

dev-master

9999999-dev

Gamer Network's PHP profiling library

  Sources   Download

MIT

The Requires

 

The Development Requires

framework eurogamer gamer network

24/07 2015

v1.0

1.0.0.0

Gamer Network's PHP profiling library

  Sources   Download

MIT

The Requires

 

The Development Requires

framework eurogamer gamer network