Skip to content

Commit b7cee8d

Browse files
authored
Merge pull request #1048 from Neluxx/patch-2
Add doc section to explain how to use DebugTimer for custom profiling
2 parents a45f7b1 + 4d5da51 commit b7cee8d

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
@@ -323,6 +323,23 @@ 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,
330+
such as portions of a controller action, service logic or view rendering::
331+
332+
use DebugKit\DebugTimer;
333+
334+
public function view($id)
335+
{
336+
DebugTimer::start('load_article', 'Fetching article from database');
337+
// Code to measure the execution time for
338+
DebugTimer::stop('load_article');
339+
}
340+
341+
When that request finishes, the Timer panel will include the custom timers.
342+
326343
Tracing query execution
327344
=======================
328345

0 commit comments

Comments
 (0)