Skip to content

Commit 4a6d95f

Browse files
authored
Add doc section to explain how to use DebugTimer for custom profiling
1 parent 0b660d2 commit 4a6d95f

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
@@ -323,6 +323,22 @@ Helper Functions
323323
* ``sql()`` Dumps out the SQL from an ORM query.
324324
* ``sqld()`` Dumps out the SQL from an ORM query, and exits.
325325

326+
Using DebugTimer
327+
----------------
328+
329+
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::
330+
331+
use DebugKit\DebugTimer;
332+
333+
public function view($id)
334+
{
335+
DebugTimer::start('load_article', 'Fetching article from database');
336+
...
337+
DebugTimer::stop('load_article');
338+
}
339+
340+
When that request finishes, the Timer panel will include the custom timers.
341+
326342
Tracing query execution
327343
=======================
328344

0 commit comments

Comments
 (0)