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

Side by Side Diff: bench/BenchSysTimer_mach.cpp

Issue 336903005: BenchSysTimer_mach drops all sub-ms precision. Fix that! (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "BenchSysTimer_mach.h" 8 #include "BenchSysTimer_mach.h"
9 9
10 //Time 10 //Time
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 double BenchSysTimer::endWall() { 64 double BenchSysTimer::endWall() {
65 uint64_t end_wall = mach_absolute_time(); 65 uint64_t end_wall = mach_absolute_time();
66 66
67 uint64_t elapsed = end_wall - this->fStartWall; 67 uint64_t elapsed = end_wall - this->fStartWall;
68 mach_timebase_info_data_t sTimebaseInfo; 68 mach_timebase_info_data_t sTimebaseInfo;
69 if (KERN_SUCCESS != mach_timebase_info(&sTimebaseInfo)) { 69 if (KERN_SUCCESS != mach_timebase_info(&sTimebaseInfo)) {
70 return 0; 70 return 0;
71 } else { 71 } else {
72 uint64_t elapsedNano = elapsed * sTimebaseInfo.numer 72 uint64_t elapsedNano = elapsed * sTimebaseInfo.numer
73 / sTimebaseInfo.denom; 73 / sTimebaseInfo.denom;
74 return elapsedNano / 1000000; 74 return elapsedNano / 1000000.0;
75 } 75 }
76 } 76 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698