OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |