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

ASF subversion and git services commented on IMPALA-2312:
---------------------------------------------------------

Commit 0ff7c8118554258cdc46a3499ef98e1f62d6c533 in impala's branch 
refs/heads/master from Tim Armstrong
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=0ff7c81 ]

IMPALA-2312: simplify stopwatch ElapsedTime()

The stopwatches had two subtly different ElapsedTime()
interfaces, one that included previous running time
and one that didn't. They do not appear to be both
needed. I looked through all the uses and in all
cases using the old TotalElapsedTime() in place of
ElapsedTime() is equivalent, either because the
stopwatch is stopped when ElapsedTime() is called
or because Stop() is never called.

Change-Id: I004833681248de65ce709fc746269686507aba54
Reviewed-on: http://gerrit.cloudera.org:8080/14293
Reviewed-by: Tim Armstrong <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>


> 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to