owncloud/core — pull request #11416 by icewind1991 (2014-10-03 20:44:14+00:00)
Title: Allow apps to gather performance diagnistics

This adds the EventLogger and QueryLogger interfaces which apps can use to get performance diagnostics.

QueryLogger: Retrieve all queries ran during the request and the time these took.
EventLogger: Get the "events" ran during the request.

"Events" are core/app defined events defined to give performance information about the timeline of an ownCloud request such as "This app is loaded", "The session is started", "The filesystem is setup".

This is intended for use in combination with apps like [clockwork](https://github.com/icewind1991/owncloud-clockwork) to assist with diagnosing performance information.

Example:
![clockwork](https://i.imgur.com/rCFlWHU.png)

Apps/core can log events using `IEventLogger::start($name, $description)` and `IEventLogger::end($name)`

```php
$toaster = new Toaster();
\OC::$server->getEventLogger()->start('toast', 'Toast bread');
$toaser->insertBread();
$toaster->toast();
\OC::$server->getEventLogger()->end('toast');
```

The loggers only collect data when debug mode is enabled to prevent overhead for regular installations.

cc @DeepDiver1975 @PVince81 @th3fallen @LukasReschke @MorrisJobke