[Lldb-commits] [lldb] r285797 - Remove TimeValue from UnwindLLDB.cpp

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 2 03:27:54 PDT 2016


Author: labath
Date: Wed Nov  2 05:27:54 2016
New Revision: 285797

URL: http://llvm.org/viewvc/llvm-project?rev=285797&view=rev
Log:
Remove TimeValue from UnwindLLDB.cpp

Really NFC, as the code is #ifdefed out, but I did make sure it compiles if I enable it.

Modified:
    lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp

Modified: lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp?rev=285797&r1=285796&r2=285797&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp Wed Nov  2 05:27:54 2016
@@ -44,7 +44,8 @@ uint32_t UnwindLLDB::DoGetFrameCount() {
 //#define DEBUG_FRAME_SPEED 1
 #if DEBUG_FRAME_SPEED
 #define FRAME_COUNT 10000
-    TimeValue time_value(TimeValue::Now());
+    using namespace std::chrono;
+    auto time_value = steady_clock::now();
 #endif
     if (!AddFirstFrame())
       return 0;
@@ -55,13 +56,11 @@ uint32_t UnwindLLDB::DoGetFrameCount() {
     while (AddOneMoreFrame(abi)) {
 #if DEBUG_FRAME_SPEED
       if ((m_frames.size() % FRAME_COUNT) == 0) {
-        TimeValue now(TimeValue::Now());
-        uint64_t delta_t = now - time_value;
-        printf("%u frames in %" PRIu64 ".%09llu ms (%g frames/sec)\n",
-               FRAME_COUNT, delta_t / TimeValue::NanoSecPerSec,
-               delta_t % TimeValue::NanoSecPerSec,
-               (float)FRAME_COUNT /
-                   ((float)delta_t / (float)TimeValue::NanoSecPerSec));
+        const auto now = steady_clock::now();
+        const auto delta_t = now - time_value;
+        printf("%u frames in %.9f ms (%g frames/sec)\n", FRAME_COUNT,
+               duration<double, std::milli>(delta_t).count(),
+               (float)FRAME_COUNT / duration<double>(delta_t).count());
         time_value = now;
       }
 #endif




More information about the lldb-commits mailing list