Several Tick counter improvements.

Move logic into cc file
Simplify interval calculation
Remove unused QUERY_PERFORMANCE_COUNTER windows implementation
Remove double divide on each ::Now() invocation on mac

Move TickTime and TickInterval funcitons to cc file in prep for refactoring.

BUG=
R=mflodman@webrtc.org, pbos@webrtc.org

Review URL: https://codereview.webrtc.org/1415923010 .

Cr-Commit-Position: refs/heads/master@{#10661}
This commit is contained in:
Tim Haloun
2015-11-16 14:37:41 -08:00
parent eb8b388273
commit 4c27e4b62d
3 changed files with 98 additions and 143 deletions

View File

@ -251,8 +251,9 @@ TEST(ProcessThreadImpl, WakeUp) {
rtc::scoped_ptr<EventWrapper> called(EventWrapper::Create());
MockModule module;
int64_t start_time = 0;
int64_t called_time = 0;
int64_t start_time;
int64_t called_time;
// Ask for a callback after 1000ms.
// TimeUntilNextProcess will be called twice.
// The first time we use it to get the thread into a waiting state.
@ -281,8 +282,6 @@ TEST(ProcessThreadImpl, WakeUp) {
EXPECT_CALL(module, ProcessThreadAttached(nullptr)).Times(1);
thread.Stop();
ASSERT_GT(start_time, 0);
ASSERT_GT(called_time, 0);
EXPECT_GE(called_time, start_time);
uint32_t diff = called_time - start_time;
// We should have been called back much quicker than 1sec.