Skip to content

[Stopwatch] Add name property to StopwatchEvent #37627

Closed
@ThomasLandauer

Description

@ThomasLandauer

Description
Currently, when you do:

$stopwatch->start('foo');
$event = $stopwatch->stop('foo');
echo (string) $event;

... you're not getting the event's name "foo" in the output:

default: 16.00 MiB - 0 ms

"default" is the category of the event, and since we didn't provide one, it defaults to "default". This is a little weird.

So I'm suggesting:

  1. Add the $name property to StopwatchEvent and display the (string) output in the form "category: name", with category defaulting to ''. So in our example the output would be:

    foo: 16.00 MiB - 0 ms

OR

  1. Rename $category to $label (to signify that this is not meant to "categorize" anything, but merely the string you will see again in the output), and $name to $id (to signify that this is just an internal ID you won't see again)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions