[Lldb-commits] [lldb] r118268 - in /lldb/trunk: include/lldb/Core/Timer.h source/Commands/CommandObjectLog.cpp source/Core/Timer.cpp

Jim Ingham jingham at apple.com
Thu Nov 4 16:19:21 PDT 2010


Author: jingham
Date: Thu Nov  4 18:19:21 2010
New Revision: 118268

URL: http://llvm.org/viewvc/llvm-project?rev=118268&view=rev
Log:
Added a setting to "log timer" so you can see the incremental timings as well:

log timer increment true/false

Modified:
    lldb/trunk/include/lldb/Core/Timer.h
    lldb/trunk/source/Commands/CommandObjectLog.cpp
    lldb/trunk/source/Core/Timer.cpp

Modified: lldb/trunk/include/lldb/Core/Timer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Timer.h?rev=118268&r1=118267&r2=118268&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Timer.h (original)
+++ lldb/trunk/include/lldb/Core/Timer.h Thu Nov  4 18:19:21 2010
@@ -51,6 +51,9 @@
 
     static void
     SetDisplayDepth (uint32_t depth);
+    
+    static void
+    SetQuiet (bool value);
 
     static void
     DumpCategoryTimes (Stream *s);

Modified: lldb/trunk/source/Commands/CommandObjectLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectLog.cpp?rev=118268&r1=118267&r2=118268&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectLog.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectLog.cpp Thu Nov  4 18:19:21 2010
@@ -413,7 +413,7 @@
         CommandObject (interpreter, 
                        "log timers",
                        "Enable, disable, dump, and reset LLDB internal performance timers.",
-                       "log timers < enable <depth> | disable | dump | reset >")
+                       "log timers < enable <depth> | disable | dump | increment <bool> | reset >")
     {
     }
 
@@ -472,6 +472,18 @@
                 else
                     result.AppendError("Could not convert enable depth to an unsigned integer.");
             }
+            if (strcasecmp(sub_command, "increment") == 0)
+            {
+                bool success;
+                bool increment = Args::StringToBoolean(args.GetArgumentAtIndex(1), false, &success);
+                if (success)
+                {
+                    Timer::SetQuiet (!increment);
+                    result.SetStatus(eReturnStatusSuccessFinishNoResult);
+                }
+                else
+                    result.AppendError("Could not convert increment value to boolean.");
+            }
         }
         
         if (!result.Succeeded())

Modified: lldb/trunk/source/Core/Timer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Timer.cpp?rev=118268&r1=118267&r2=118268&view=diff
==============================================================================
--- lldb/trunk/source/Core/Timer.cpp (original)
+++ lldb/trunk/source/Core/Timer.cpp Thu Nov  4 18:19:21 2010
@@ -28,7 +28,6 @@
 typedef std::map<const char *, uint64_t> CategoryMap;
 static pthread_key_t g_key;
 
-
 static Mutex &
 GetCategoryMutex()
 {
@@ -63,6 +62,12 @@
 }
 
 void
+Timer::SetQuiet (bool value)
+{
+    g_quiet = value;
+}
+
+void
 Timer::Initialize ()
 {
     Timer::g_file = stdout;





More information about the lldb-commits mailing list