Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding documentation for the Profiler logging and timers.
Simple as that :)
- Loading branch information
1 parent
742eb4e
commit 4d6827c
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Profiler | ||
|
||
## Contents | ||
- [Logging to the Proiler](#logging) | ||
- [Timers and Benchmarking](#timers) | ||
|
||
<a name="logging"></a> | ||
## Logging | ||
|
||
It is possible to use the profiler to the Log viewing portion of the profiler. Throughout your application you can call the logger and have it displayed when the profiler is rendered. | ||
|
||
#### Logging to the profiler: | ||
|
||
Profiler::log('info', 'Log some information to the profiler'); | ||
|
||
<a name="timers"></a> | ||
## Timers | ||
|
||
Timing and benchmarking your app is simple with the ```tick()``` function on the profiler. It allows you to set various different timers in your app and will show you their performance when your app ends execution. | ||
|
||
Each timer can have it's own individual name which gives it a timeline. Every timer with the same name is another 'tick' on that timeline. Each timer can also execute a callback on it to perform other operations. | ||
|
||
#### Using the generic timer timeline | ||
|
||
Profiler::tick(); | ||
Profiler::tick(); | ||
|
||
#### Using multiple named timers with seperate timelines | ||
|
||
Profiler::tick('myTimer'); | ||
Profiler::tick('nextTimer'); | ||
Profiler::tick('myTimer'); | ||
Profiler::tick('nextTimer'); | ||
|
||
#### Using a named timer with a callback | ||
Profiler::tick('myTimer', function($timers) { | ||
echo "I'm inside the timer callback!"; | ||
}); |