Profiler Class
The profiler class allows you to add your own profiling information to the profiler. It implements a customized version of PHPQuickProfiler (PQP).
Configure runtime behaviour
The profiler contains a collection of javascript global variables through which you can control the initial state of the profiler.
-
PQP_SHOWONLOAD: boolean, if true, the profiler is opened on page load, if false. The default is false.
-
PQP_HEIGHT: string, "tall" shows double the info from "short". The default is "tall".
-
PQP_DETAILS: boolean, if false, no details will be shown, only the tab information. The default is true.
-
PQP_BOTTOM: boolean, if true, the profiler is attached to the bottom of the viewport. If false, it is displayed below the output. The default is true.
Example:
<script type="text/javascript">
var PQP_SHOWONLOAD = true;
var PQP_HEIGHT = 'short';
var PQP_DETAILS = true;
var PQP_BOTTOM = true;
</script>
Class methods
mark($label)
The mark method will add a speed marker to the profiler.
This marker will show in the "Load Time" section of the profiler.
Static |
Yes |
Parameters |
Param |
Default |
Description |
$label |
required |
A text label to describe the marker to be set. |
|
Returns |
void |
Example |
Profiler::mark('start of this piece of code');
|
mark_memory($var, $name)
The mark_memory method will add a memory marker to the profiler.
If you pass a variable, the memory usage of that variable will be logged.
If not, the memory usage at the time of marking will be logged.
Static |
Yes |
Parameters |
Param |
Default |
Description |
$var |
false |
The variable whose size has to be logged. If false or not specified, PHP memory usage will be logged. |
$name |
'Memory Usage' |
A text label to describe the marker to be set. |
|
Returns |
void |
Example |
Profiler::mark_memory($this, 'Controller_Welcome object');
|
console($text)
The console method will add a log entry to the profiler.
Static |
Yes |
Parameters |
Param |
Default |
Description |
$text |
required |
A text to describe the log entry to be set. |
|
Returns |
void |
Example |
Profiler::console('start of this piece of code');
|