From 6d0c2391fea4877419a3c1ca20b5e9caaba21966 Mon Sep 17 00:00:00 2001 From: Fabian Arndt Date: Thu, 25 Sep 2025 09:23:39 +0200 Subject: [PATCH 1/2] Add doc section to explain how to use DebugTimer for custom profiling --- docs/en/index.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/en/index.rst b/docs/en/index.rst index 225670655..3a520216e 100644 --- a/docs/en/index.rst +++ b/docs/en/index.rst @@ -316,3 +316,19 @@ Helper Functions * ``sql()`` Dumps out the SQL from an ORM query. * ``sqld()`` Dumps out the SQL from an ORM query, and exits. + +Using DebugTimer +---------------- + +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:: + + use DebugKit\DebugTimer; + + public function view($id) + { + DebugTimer::start('load_article', 'Fetching article from database'); + ... + DebugTimer::stop('load_article'); + } + +When that request finishes, the Timer panel will include the custom timers. From 74c2d1e82b3eab9689fc58986f106bffaa35255f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=BCrth?= Date: Thu, 25 Sep 2025 13:52:47 +0200 Subject: [PATCH 2/2] Apply suggestions from code review Improve wording --- docs/en/index.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/en/index.rst b/docs/en/index.rst index 3a520216e..e2ed9a893 100644 --- a/docs/en/index.rst +++ b/docs/en/index.rst @@ -320,14 +320,15 @@ Helper Functions Using DebugTimer ---------------- -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:: +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:: use DebugKit\DebugTimer; public function view($id) { DebugTimer::start('load_article', 'Fetching article from database'); - ... + // Code to measure the execution time for DebugTimer::stop('load_article'); }