[PATCH] D20735: [Support] Allow nesting paired calls to {start, stop}Timer

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Fri May 27 10:22:38 PDT 2016

vsk added a comment.

In http://reviews.llvm.org/D20735#442417, @rafael wrote:

> It seems pretty odd to have a timer that can be started multiple times. If
>  we can avoid it I think we should.

You're right that this is odd behavior, and ISTM the original API avoided advertising it on purpose.

Even so, nesting timers does make sense in the context of recursive functions. If we have e.g: `foo() { T.start(); if (...) { foo(); } T.stop(); }`, then it's natural for the timer to measure all the time spent in `foo`, including time spent setting up a timer. Without a change like this, we'd make that more difficult.


More information about the llvm-commits mailing list