Skip to content

Commit 41d175c

Browse files
authored
Merge pull request #1047 from Neluxx/patch-1
Add doc section to explain how to use DebugTimer for custom profiling
2 parents 49c841e + 74c2d1e commit 41d175c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

docs/en/index.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,3 +316,20 @@ Helper Functions
316316

317317
* ``sql()`` Dumps out the SQL from an ORM query.
318318
* ``sqld()`` Dumps out the SQL from an ORM query, and exits.
319+
320+
Using DebugTimer
321+
----------------
322+
323+
Use the `DebugTimer` to measure parts of the code that are not captured by the default timers,
324+
such as portions of a controller action, service logic or view rendering::
325+
326+
use DebugKit\DebugTimer;
327+
328+
public function view($id)
329+
{
330+
DebugTimer::start('load_article', 'Fetching article from database');
331+
// Code to measure the execution time for
332+
DebugTimer::stop('load_article');
333+
}
334+
335+
When that request finishes, the Timer panel will include the custom timers.

0 commit comments

Comments
 (0)