class Stopwatch
Stopwatch provides a way to profile code.
__construct(bool $morePrecision = false) | ||
Section[] | getSections() | |
openSection(string|null $id = null) Creates a new section or re-opens an existing section. | ||
stopSection(string $id) Stops the last started section. | ||
StopwatchEvent | start(string $name, string $category = null) Starts an event. | |
bool | isStarted(string $name) Checks if the event was started. | |
StopwatchEvent | stop(string $name) Stops an event. | |
StopwatchEvent | lap(string $name) Stops then restarts an event. | |
StopwatchEvent | getEvent(string $name) Returns a specific event by name. | |
StopwatchEvent[] | getSectionEvents(string $id) Gets all events for a given section. | |
reset() Resets the stopwatch to its original state. |
bool | $morePrecision | If true, time is stored as float to keep the original microsecond precision |
Section[] |
Creates a new section or re-opens an existing section.
string|null | $id | The id of the session to re-open, null to create a new one |
LogicException | When the section to re-open is not reachable |
Stops the last started section.
The id parameter is used to retrieve the events from this section.
string | $id | The identifier of the section |
LogicException | When there's no started section to be stopped |
getSectionEvents() |
Starts an event.
string | $name | The event name |
string | $category | The event category |
StopwatchEvent |
Checks if the event was started.
string | $name | The event name |
bool |
Stops an event.
string | $name | The event name |
StopwatchEvent |
Stops then restarts an event.
string | $name | The event name |
StopwatchEvent |
Returns a specific event by name.
string | $name | The event name |
StopwatchEvent |
Gets all events for a given section.
string | $id | A section identifier |
StopwatchEvent[] |
Resets the stopwatch to its original state.
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/Stopwatch/Stopwatch.html