Overview

Namespaces

  • None
  • Rundiz
    • Profiler

Classes

  • Console
  • Profiler
  • ProfilerBase
  • Overview
  • Namespace
  • Class

Class Console

Console logger class.

This class works as logger things for profiling.

Rundiz\Profiler\ProfilerBase
Extended by Rundiz\Profiler\Console
Namespace: Rundiz\Profiler
Package: Rundiz\Profiler
Author: Vee W.
Located at Profiler/Console.php
Methods summary
public
# __construct( Rundiz\Profiler\Profiler $profiler )

class constructor

class constructor

Parameters

$profiler
public
# database( string $data, float $time_start, integer $memory_start = null )

Database profiling log.

Database profiling log.

Parameters

$data
SQL query statement. for example: SELECT id FROM people;.
$time_start
microtime(true) at before start the query.
$memory_start
memory_get_usage() at before start the query. If this was not set then it will be showing current running memory usage not total memory usage for this process.
public
# log( string $logtype, mixed $data, string $file = '', integer $line = '' )

write normal logs.

write normal logs.

Parameters

$logtype
accept debug, info, notice, warning, error, critical, alert, emergency. referrer: http://www.php-fig.org/psr/psr-3/
$data
log data.
$file
path to file where it calls logger. (optional).
$line
number of line in that file that calls logger. (optional).
public
# memoryUsage( mixed $data, string $file = '', integer $line = '', string|null $matchKey = null )

write memory usage logs.

write memory usage logs.

Parameters

$data
log data.
$file
path to file where it calls logger. (optional).
$line
number of line in that file that calls logger. (optional).
$matchKey
The key to be match at the beginning and end for calculate total time or memory only for this key. (optional). The key must be unique in this section.
public
# registerLogSections( array $sections )

register log sections.
it is very important! you have to call this before other methods in this class or all log_sections data will be erased.

register log sections.
it is very important! you have to call this before other methods in this class or all log_sections data will be erased.

Parameters

$sections
register log sections by order. suggest: array('Logs', 'Time Load', 'Memory Usage', 'Database', 'Files', 'Session', 'Get', 'Post')
public
# timeload( mixed $data, string $file = '', integer $line = '', string|null $matchKey = null )

Write time load logs.

Write time load logs.

To calculate total time load only for specification functional, use $matchKey.
Example:

$Profiler->Console->timeload('Before run sleep.', '', '', 'run_sleep');
sleep(3);
$Profiler->Console->timeload('After run sleep.', '', '', 'run_sleep');

The $matchKey must be unique from others.

Parameters

$data
Log data.
$file
Path to file where it calls logger. (optional).
$line
Number of line in that file that calls logger. (optional).
$matchKey
The key to be match at the beginning and end for calculate total time or memory only for this key. (optional). The key must be unique in this section.
public
# writeLogSections( string $section, mixed $data, string $file = '', integer $line = '', string|null $matchKey = null )

Write other sections logs.

Write other sections logs.

Parameters

$section
The section name.
$data
Log data. This can be any type.
$file
Path to file where it calls logger. (optional).
$line
Number of line in that file that calls logger. (optional).
$matchKey
The key to be match at the beginning and end for calculate total time or memory only for this key. (optional). The key must be unique (for start and end) in each section.
Properties summary
protected Rundiz\Profiler\Profiler $Profiler

profiler class for call back to the caller class.

profiler class for call back to the caller class.

#
Properties inherited from Rundiz\Profiler\ProfilerBase
$end_time, $log_sections, $max_memory_usage, $start_time
API documentation generated by ApiGen