From 668c686e6d16eaa79b00213216d1d508702ea100 Mon Sep 17 00:00:00 2001 From: Jose Baiocchi <jbaiocchi@google.com> Date: Wed, 14 Oct 2020 09:27:56 -0700 Subject: [PATCH] Use double to represent milliseconds in time_utils.h PiperOrigin-RevId: 337106111 Change-Id: Ia4aebd0e9e92a62e5c88db9825fd6096317a6c59 --- tensorflow/core/profiler/utils/time_utils.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tensorflow/core/profiler/utils/time_utils.h b/tensorflow/core/profiler/utils/time_utils.h index 0a2518b90ff..cef1bda0b76 100644 --- a/tensorflow/core/profiler/utils/time_utils.h +++ b/tensorflow/core/profiler/utils/time_utils.h @@ -22,6 +22,8 @@ namespace tensorflow { namespace profiler { // Converts among different time units. +// NOTE: We use uint64 for picoseconds and nanoseconds, which are used in +// storage, and double for other units that are used in the UI. inline double PicosToNanos(uint64 ps) { return ps / 1E3; } inline double PicosToMicros(uint64 ps) { return ps / 1E6; } inline double PicosToMillis(uint64 ps) { return ps / 1E9; } @@ -29,9 +31,9 @@ inline double PicosToSeconds(uint64 ps) { return ps / 1E12; } inline uint64 NanosToPicos(uint64 ns) { return ns * 1000; } inline double NanosToMicros(uint64 ns) { return ns / 1E3; } inline double MicrosToMillis(double us) { return us / 1E3; } -inline uint64 MillisToPicos(uint64 ms) { return ms * 1000000000; } -inline uint64 MillisToNanos(uint64 ms) { return ms * 1000000; } -inline double MillisToSeconds(uint64 ms) { return ms / 1E3; } +inline uint64 MillisToPicos(double ms) { return ms * 1E9; } +inline uint64 MillisToNanos(double ms) { return ms * 1E6; } +inline double MillisToSeconds(double ms) { return ms / 1E3; } inline uint64 SecondsToNanos(double s) { return s * 1E9; } } // namespace profiler