diff --git a/src/command_line.cc b/src/command_line.cc index c48a0819..4665eb97 100644 --- a/src/command_line.cc +++ b/src/command_line.cc @@ -59,18 +59,6 @@ const int kExpectedClientVersion = 2; -#if false -std::string FormatMicroseconds(long long microseconds) { - long long milliseconds = microseconds / 1000; - long long remaining = microseconds - milliseconds; - - // Only show two digits after the dot. - while (remaining >= 100) - remaining /= 10; - - return std::to_string(milliseconds) + "." + std::to_string(remaining) + "ms"; -} -#endif @@ -3426,7 +3414,7 @@ void StdoutMain(std::unordered_map* request_times, MultiQueueWaite case IpcId::Cout: { auto msg = static_cast(message.get()); - if (ShouldDisplayIpcTiming(message->method_id)) { + if (ShouldDisplayIpcTiming(msg->original_ipc_id)) { Timer time = (*request_times)[msg->original_ipc_id]; time.ResetAndPrint("[e2e] Running " + std::string(IpcIdToString(msg->original_ipc_id))); } diff --git a/src/utils.cc b/src/utils.cc index b7807e84..106fb179 100644 --- a/src/utils.cc +++ b/src/utils.cc @@ -322,3 +322,15 @@ float GetProcessMemoryUsedInMb() { return memory_after / kBytesToMb; #endif } + +std::string FormatMicroseconds(long long microseconds) { + long long milliseconds = microseconds / 1000; + long long remaining = microseconds - milliseconds; + + // Only show two digits after the dot. + while (remaining >= 100) + remaining /= 10; + + return std::to_string(milliseconds) + "." + std::to_string(remaining) + "ms"; +} + diff --git a/src/utils.h b/src/utils.h index 7cbc9b70..0375be63 100644 --- a/src/utils.h +++ b/src/utils.h @@ -130,4 +130,6 @@ inline void hash_combine(std::size_t& seed, const T& v, Rest... rest) { };\ } -float GetProcessMemoryUsedInMb(); \ No newline at end of file +float GetProcessMemoryUsedInMb(); + +std::string FormatMicroseconds(long long microseconds); \ No newline at end of file