2017 © Pedro Peláez
 

library sd-profiler

image

ob-ivan/sd-profiler

  • Thursday, February 15, 2018
  • by ob-ivan
  • Repository
  • 1 Watchers
  • 0 Stars
  • 464 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 10 Versions
  • 58 % Grown

The README.md

Profiler

Allows you to tag your code with profiler frames. It will calculate inclusive and exclusive durations for each tag and output with selected strategies., (*1)

Installation

composer require ob-ivan/sd-profiler

Init

To start profiling and select output strategies:, (*2)

profiler()->init([
    'append' => true,
    // or:
    'firephp' => true,
);
register_shutdown_function(function () {
    profiler()->dispatch();
});

Example from WordPress functions.php:, (*3)

if (isset($_COOKIE['secretcookie']) && $_COOKIE['secretcookie'] === 'secretvalue') {
    profiler()->init([
        'firephp' => true,
    ]);
    // Dispatch profiling result before WP forcefully closes all output buffers.
    add_action(
        'shutdown',
        function () {
            profiler()->dispatch();
        },
        0
    );
}

Usage

To put profiler frame tags:, (*4)

profiler()->in('my_function', $vars);
my_function($vars);
profiler()->out('my_function');

You can add arbitrary debug info with log method:, (*5)

function my_function($vars) {
    profiler()->log('my_function', $vars);
    // useful stuff here...
}

The Versions

15/02 2018

dev-master

9999999-dev

  Sources   Download

The Requires

 

The Development Requires

15/02 2018

v1.3

1.3.0.0

  Sources   Download

The Requires

 

The Development Requires

09/02 2018

v1.2.1

1.2.1.0

  Sources   Download

The Requires

 

The Development Requires

09/02 2018
31/07 2017

v1.1

1.1.0.0

  Sources   Download

The Requires

 

31/07 2017

v1.0.3

1.0.3.0

  Sources   Download

The Requires

 

31/07 2017

v1.0.4

1.0.4.0

  Sources   Download

The Requires

 

30/07 2017

v1.0.2

1.0.2.0

  Sources   Download

The Requires

 

30/07 2017

v1.0.1

1.0.1.0

  Sources   Download

The Requires

 

30/07 2017

v1.0

1.0.0.0

  Sources   Download

The Requires