Skip to content

Commit 6d0c239

Browse files
authored
Add doc section to explain how to use DebugTimer for custom profiling
1 parent 49c841e commit 6d0c239

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

docs/en/index.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,3 +316,19 @@ 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, such as portions of a controller action, service logic or view rendering::
324+
325+
use DebugKit\DebugTimer;
326+
327+
public function view($id)
328+
{
329+
DebugTimer::start('load_article', 'Fetching article from database');
330+
...
331+
DebugTimer::stop('load_article');
332+
}
333+
334+
When that request finishes, the Timer panel will include the custom timers.

0 commit comments

Comments
 (0)