From 4d6827ca1477cc681f31d296c07bb7229803cede Mon Sep 17 00:00:00 2001 From: Jesse O'Brien Date: Thu, 3 Jan 2013 11:43:01 -0500 Subject: [PATCH] Adding documentation for the Profiler logging and timers. Simple as that :) --- laravel/documentation/contents.md | 1 + laravel/documentation/profiler.md | 38 +++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 laravel/documentation/profiler.md diff --git a/laravel/documentation/contents.md b/laravel/documentation/contents.md index 50c16e9c..909da4c5 100644 --- a/laravel/documentation/contents.md +++ b/laravel/documentation/contents.md @@ -65,6 +65,7 @@ ### General - [Upgrading Bundles](/docs/bundles#upgrading-bundles) - [Class Auto Loading](/docs/loading) - [Errors & Logging](/docs/logging) +- [Profiler](/docs/profiler) - [Runtime Configuration](/docs/config) - [Examining Requests](/docs/requests) - [Generating URLs](/docs/urls) diff --git a/laravel/documentation/profiler.md b/laravel/documentation/profiler.md new file mode 100644 index 00000000..fe003c37 --- /dev/null +++ b/laravel/documentation/profiler.md @@ -0,0 +1,38 @@ +# Profiler + +## Contents +- [Logging to the Proiler](#logging) +- [Timers and Benchmarking](#timers) + + +## 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'); + + +## 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!"; + });