From 4a6d95f6d269009754eaa041abee88c71d1afb74 Mon Sep 17 00:00:00 2001 From: Fabian Arndt Date: Thu, 25 Sep 2025 09:26:14 +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 f69b67b8b..4ed326c99 100644 --- a/docs/en/index.rst +++ b/docs/en/index.rst @@ -323,6 +323,22 @@ 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. + Tracing query execution ======================= From 4d5da51d19a29043b52667dec588325a6e96a0e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=BCrth?= Date: Thu, 25 Sep 2025 13:53:04 +0200 Subject: [PATCH 2/2] 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 4ed326c99..ea09efdcb 100644 --- a/docs/en/index.rst +++ b/docs/en/index.rst @@ -326,14 +326,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'); }