Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Issue 1639543005: Use rtc::time for all your timing needs! (Closed)

Created:
4 years, 11 months ago by sprang_webrtc
Modified:
4 years, 8 months ago
Reviewers:
tommi, pbos-webrtc, noahric
CC:
webrtc-reviews_webrtc.org, henrika_webrtc, zhengzhonghou_agora.io, tterriberry_mozilla.com, fengyue_agora.io, peah-webrtc, mflodman, sophiechang-webrtc
Base URL:
https://chromium.googlesource.com/external/webrtc.git@master
Target Ref:
refs/pending/heads/master
Project:
webrtc
Visibility:
Public.

Description

Use rtc::time for all your timing needs! Initial step of unifying so that base/timeutils.h and Clock/TimeTime from system_wrappers use the same implementation. BUG=webrtc:5463 R=pbos@webrtc.org, tommi@webrtc.org Committed: https://crrev.com/1c3909899d2bc1e46b8b40f6660f30a8a280f1f4 Cr-Commit-Position: refs/heads/master@{#11394}

Patch Set 1 #

Patch Set 2 : Format #

Total comments: 5

Patch Set 3 : Error on unsupported platform #

Unified diffs Side-by-side diffs Delta from patch set Stats (+8 lines, -94 lines) Patch
M webrtc/base/timeutils.cc View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M webrtc/system_wrappers/source/tick_util.cc View 1 2 chunks +6 lines, -94 lines 0 comments Download

Messages

Total messages: 17 (8 generated)
sprang_webrtc
4 years, 11 months ago (2016-01-26 14:56:09 UTC) #3
pbos-webrtc
lgtm with one question https://codereview.webrtc.org/1639543005/diff/20001/webrtc/base/timeutils.cc File webrtc/base/timeutils.cc (right): https://codereview.webrtc.org/1639543005/diff/20001/webrtc/base/timeutils.cc#newcode77 webrtc/base/timeutils.cc:77: #else #else #error? Do we ...
4 years, 11 months ago (2016-01-26 15:00:22 UTC) #4
tommi
lgtm with a topic to discuss, but feel free to land. I think it's very ...
4 years, 11 months ago (2016-01-26 23:23:46 UTC) #5
sprang_webrtc
https://codereview.webrtc.org/1639543005/diff/20001/webrtc/base/timeutils.cc File webrtc/base/timeutils.cc (right): https://codereview.webrtc.org/1639543005/diff/20001/webrtc/base/timeutils.cc#newcode49 webrtc/base/timeutils.cc:49: ticks = mach_absolute_time() * timebase.numer / timebase.denom; On 2016/01/26 ...
4 years, 11 months ago (2016-01-27 08:48:47 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1639543005/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1639543005/40001
4 years, 11 months ago (2016-01-27 08:49:12 UTC) #9
commit-bot: I haz the power
Try jobs failed on following builders: linux_libfuzzer_rel on tryserver.webrtc (JOB_FAILED, http://build.chromium.org/p/tryserver.webrtc/builders/linux_libfuzzer_rel/builds/605)
4 years, 11 months ago (2016-01-27 09:37:34 UTC) #11
commit-bot: I haz the power
Patchset 3 (id:??) landed as https://crrev.com/1c3909899d2bc1e46b8b40f6660f30a8a280f1f4 Cr-Commit-Position: refs/heads/master@{#11394}
4 years, 11 months ago (2016-01-27 11:55:49 UTC) #14
sprang_webrtc
Committed patchset #3 (id:40001) manually as 1c3909899d2bc1e46b8b40f6660f30a8a280f1f4 (presubmit successful).
4 years, 11 months ago (2016-01-27 11:55:49 UTC) #15
noahric
4 years, 8 months ago (2016-04-05 04:48:28 UTC) #17
Message was sent while issue was closed.
+sophie, as FYI.

https://codereview.webrtc.org/1639543005/diff/20001/webrtc/base/timeutils.cc
File webrtc/base/timeutils.cc (right):

https://codereview.webrtc.org/1639543005/diff/20001/webrtc/base/timeutils.cc#...
webrtc/base/timeutils.cc:49: ticks = mach_absolute_time() * timebase.numer /
timebase.denom;
On 2016/01/27 08:48:47, språng wrote:
> On 2016/01/26 23:23:46, tommi-webrtc wrote:
> > since we're here - can we do something about this so that it behaves more
like
> > the implementations on other operating systems?  At the moment it always
> returns
> > a very low value on first call, regardless of when it's called.
> > 
> > It also looks like we're using static initialization but could use atomics
> > instead.
> > 
> > No action required in this CL but curious to hear what you think.  I
realized
> > this btw when I saw that we're using the return value from this function as
a
> > seed to Random() (via the Clock class).
> 
> Are your sure "low initial value" applies here? The root cause for doing this
> refactoring is that the mac implementation of TickTime::QueryOsForTicks()
> behaves differently from this one; it used a static variable as offset and
> initialized it so that the first call would always return 0...
> 
> Agreed we should do something about static initialization here.

FYI, the reason it was different was: https://codereview.webrtc.org/1452843003

Which was for a 2% overall cpu usage reduction on iOS.

The other issues are definitely real (it purposefully picked low values so the
double would maintain precision for awhile, but that meant things that used raw
tick values for random seeding were broken, as tommi discovered), so I wouldn't
just put it back in without fixing that. But it'd be sad to lose the 2% cpu
improvement for nothing. Not too many other things are so simple to fix :)

Powered by Google App Engine
This is Rietveld 408576698