From f7f4f50113e0452d9c6183366d95cf67a4361d63 Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Thu, 4 Nov 2010 23:19:21 +0000 Subject: [PATCH] Added a setting to "log timer" so you can see the incremental timings as well: log timer increment true/false llvm-svn: 118268 --- lldb/include/lldb/Core/Timer.h | 3 +++ lldb/source/Commands/CommandObjectLog.cpp | 14 +++++++++++++- lldb/source/Core/Timer.cpp | 7 ++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/lldb/include/lldb/Core/Timer.h b/lldb/include/lldb/Core/Timer.h index 8a3dc78385f8..0eac993ebd76 100644 --- a/lldb/include/lldb/Core/Timer.h +++ b/lldb/include/lldb/Core/Timer.h @@ -51,6 +51,9 @@ public: static void SetDisplayDepth (uint32_t depth); + + static void + SetQuiet (bool value); static void DumpCategoryTimes (Stream *s); diff --git a/lldb/source/Commands/CommandObjectLog.cpp b/lldb/source/Commands/CommandObjectLog.cpp index 2060b1eba6c8..7bd84b37c02f 100644 --- a/lldb/source/Commands/CommandObjectLog.cpp +++ b/lldb/source/Commands/CommandObjectLog.cpp @@ -413,7 +413,7 @@ public: CommandObject (interpreter, "log timers", "Enable, disable, dump, and reset LLDB internal performance timers.", - "log timers < enable | disable | dump | reset >") + "log timers < enable | disable | dump | increment | reset >") { } @@ -472,6 +472,18 @@ public: 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()) diff --git a/lldb/source/Core/Timer.cpp b/lldb/source/Core/Timer.cpp index a5420c160455..dd37d79e5fd3 100644 --- a/lldb/source/Core/Timer.cpp +++ b/lldb/source/Core/Timer.cpp @@ -28,7 +28,6 @@ typedef std::vector TimerStack; typedef std::map CategoryMap; static pthread_key_t g_key; - static Mutex & GetCategoryMutex() { @@ -62,6 +61,12 @@ ThreadSpecificCleanup (void *p) delete (TimerStack *)p; } +void +Timer::SetQuiet (bool value) +{ + g_quiet = value; +} + void Timer::Initialize () {