You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Tim Armstrong (Jira)" <ji...@apache.org> on 2019/09/24 15:21:00 UTC

[jira] [Commented] (IMPALA-2312) Timing bug in both MonotonicStopWatch and StopWatch

    [ https://issues.apache.org/jira/browse/IMPALA-2312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16936908#comment-16936908 ] 

Tim Armstrong commented on IMPALA-2312:
---------------------------------------

Confusingly, there's a TotalElapsedTime() which has the expected behaviour.

I think there was some cowardice involved - instead of fixing the behaviour of ElapsedTime() a new method was added.

> Timing bug in both MonotonicStopWatch and StopWatch
> ---------------------------------------------------
>
>                 Key: IMPALA-2312
>                 URL: https://issues.apache.org/jira/browse/IMPALA-2312
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Backend
>    Affects Versions: Impala 2.2.4
>            Reporter: Henry Robinson
>            Assignee: Tim Armstrong
>            Priority: Minor
>
> Both {{MonotonicStopWatch}} and {{StopWatch}} underestimate the total time if the stopwatch is running while {{ElapsedTime()}} is called. For example:
> {code}
> uint64_t ElapsedTime() const {
>     if (!running_) return total_time_;
>     timespec end;
>     clock_gettime(CLOCK_MONOTONIC, &end);
>     // Should include total_time_, but does not
>     return (end.tv_sec - start_.tv_sec) * 1000L * 1000L * 1000L +
>         (end.tv_nsec - start_.tv_nsec);
>   }
> {code}
> The effect is that we could have:
> {code}
> MonotonicStopWatch sw;
> sw.Start();
> sw.Stop();
> uint64_t total = sw.ElapsedTime();
> sw.Start();
> // With the bug, this could fail.
> ASSERT_GE(sw.ElapsedTime(), total);
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org