Page MenuHomePhabricator

How do you cancel a TimingMetric->start() call?
Open, Needs TriagePublic

Description

In rare cases, there may be reason to start() a TimingMetric instance but ultimately throw away the measurement due to error handling or developer choice.

We should consider adding a reset() or cancel() method that sets startTime back to null without recording the sample.

Thanks @Tarrow for the suggestion!

Event Timeline

Looking at the code, there is no problem if start() is called multiple times in succession. There is only an issue if stop() is called before start().

@Tarrow what would you think if we improved the docs to indicate that abandoning a start() call has no repercussions rather than implementing a new method?