Commit 0f5503e9 by Jean-Louis Leroy

Address Dominic's (stylistic) remarks.

parent 5ec78d7d
...@@ -41,7 +41,7 @@ extern "C" uint64_t __rdtsc(); ...@@ -41,7 +41,7 @@ extern "C" uint64_t __rdtsc();
#pragma intrinsic(__rdtsc) #pragma intrinsic(__rdtsc)
#endif #endif
#if !defined(OS_WINDOWS) #ifndef OS_WINDOWS
#include <sys/time.h> #include <sys/time.h>
#endif #endif
......
...@@ -305,7 +305,7 @@ static double MyCPUUsageRUsage() { ...@@ -305,7 +305,7 @@ static double MyCPUUsageRUsage() {
user.HighPart = user_time.dwHighDateTime; user.HighPart = user_time.dwHighDateTime;
user.LowPart = user_time.dwLowDateTime; user.LowPart = user_time.dwLowDateTime;
return (static_cast<double>(kernel.QuadPart) + return (static_cast<double>(kernel.QuadPart) +
static_cast<double>(user.QuadPart)) / 1.0E7; static_cast<double>(user.QuadPart)) * 1e-7;
#endif // OS_WINDOWS #endif // OS_WINDOWS
} }
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include "walltime.h"
#include "benchmark/macros.h" #include "benchmark/macros.h"
#include "internal_macros.h" #include "internal_macros.h"
#include "walltime.h"
#if defined(OS_WINDOWS) #if defined(OS_WINDOWS)
#include <time.h> #include <time.h>
...@@ -110,7 +110,7 @@ private: ...@@ -110,7 +110,7 @@ private:
ularge.LowPart = file_time.dwLowDateTime; ularge.LowPart = file_time.dwLowDateTime;
ularge.HighPart = file_time.dwHighDateTime; ularge.HighPart = file_time.dwHighDateTime;
tv.tv_sec = (long)((ularge.QuadPart - epoch) / 10000000L); tv.tv_sec = (long)((ularge.QuadPart - epoch) / (10L * 1000 * 1000));
tv.tv_usec = (long)(system_time.wMilliseconds * 1000); tv.tv_usec = (long)(system_time.wMilliseconds * 1000);
#else #else
gettimeofday(&tv, nullptr); gettimeofday(&tv, nullptr);
...@@ -167,8 +167,8 @@ WallTimeImp::WallTimeImp() ...@@ -167,8 +167,8 @@ WallTimeImp::WallTimeImp()
cycles_per_second_(0), seconds_per_cycle_(0.0), cycles_per_second_(0), seconds_per_cycle_(0.0),
last_adjust_time_(0), drift_adjust_(0), last_adjust_time_(0), drift_adjust_(0),
max_interval_cycles_(0) { max_interval_cycles_(0) {
const double kMaxErrorInterval = 100e-6; const double kMaxErrorInterval = 100e-6;
cycles_per_second_ = static_cast<int64_t>(CyclesPerSecond()); cycles_per_second_ = static_cast<int64_t>(CyclesPerSecond());
CHECK(cycles_per_second_ != 0); CHECK(cycles_per_second_ != 0);
seconds_per_cycle_ = 1.0 / cycles_per_second_; seconds_per_cycle_ = 1.0 / cycles_per_second_;
max_interval_cycles_ = max_interval_cycles_ =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment