robotpony/Presto — pull request #48 by adam-patterson (2013-06-25 19:48:46+00:00)
Title: First pass of profiler for presto

@bruce-alderson and @ngallagher87

Tracked with #47.

I went with explicit start/stop semantic over toggling as suggested. In the future we could consider a `lap` concept and destructors as necessary.

Usage:

* Profiler::track($key, $extra); // initialize and start tracking execution time (with optional extra debugging data)
* Profiler::stop($key); // stop tracking execution time
* Profiler::restart($key, $extra); // restart tracking execution time (optional $extra data is merged with existing optional $extra debugging data)
* Profiler::profile($key); // return current profile data for $key process
* $extra is an optional array that is JSON encoded and added to debug output
* All profile data is automatically added to Presto trace output if Presto trace is enabled (see _config)