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

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Fri May 27 10:55:52 PDT 2016


On 27 May 2016 at 13:22, Vedant Kumar <vsk at apple.com> wrote:
> 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.

Fair enough. Lets just wait to see what change Davide had to do to
clang to avoid the problem. If that is too complicated, this LGTM.

Cheers,
Rafael


More information about the llvm-commits mailing list