[Lldb-commits] [lldb] r306682 - Move Timer and TraceOptions from Core to Utility
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Thu Jun 29 07:32:17 PDT 2017
Author: labath
Date: Thu Jun 29 07:32:17 2017
New Revision: 306682
URL: http://llvm.org/viewvc/llvm-project?rev=306682&view=rev
Log:
Move Timer and TraceOptions from Core to Utility
Summary:
The classes have no dependencies, and they are used both by lldb and
lldb-server, so it makes sense for them to live in the lowest layers.
Reviewers: zturner, jingham
Subscribers: emaste, mgorny, lldb-commits
Differential Revision: https://reviews.llvm.org/D34746
Added:
lldb/trunk/include/lldb/Utility/Timer.h
- copied, changed from r306669, lldb/trunk/include/lldb/Core/Timer.h
lldb/trunk/include/lldb/Utility/TraceOptions.h
- copied, changed from r306669, lldb/trunk/include/lldb/Core/TraceOptions.h
lldb/trunk/source/Utility/Timer.cpp
- copied, changed from r306669, lldb/trunk/source/Core/Timer.cpp
lldb/trunk/unittests/Utility/TimerTest.cpp
- copied, changed from r306669, lldb/trunk/unittests/Core/TimerTest.cpp
Removed:
lldb/trunk/include/lldb/Core/Timer.h
lldb/trunk/include/lldb/Core/TraceOptions.h
lldb/trunk/source/Core/Timer.cpp
lldb/trunk/unittests/Core/TimerTest.cpp
Modified:
lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/source/API/SBTraceOptions.cpp
lldb/trunk/source/API/SystemInitializerFull.cpp
lldb/trunk/source/Commands/CommandObjectFrame.cpp
lldb/trunk/source/Commands/CommandObjectLog.cpp
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Core/CMakeLists.txt
lldb/trunk/source/Core/Disassembler.cpp
lldb/trunk/source/Core/Mangled.cpp
lldb/trunk/source/Core/Module.cpp
lldb/trunk/source/Host/common/Symbols.cpp
lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp
lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
lldb/trunk/source/Interpreter/CommandInterpreter.cpp
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/trunk/source/Plugins/Process/Linux/ProcessorTrace.h
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp
lldb/trunk/source/Symbol/ObjectFile.cpp
lldb/trunk/source/Symbol/Symtab.cpp
lldb/trunk/source/Target/ObjCLanguageRuntime.cpp
lldb/trunk/source/Target/Target.cpp
lldb/trunk/source/Target/TargetList.cpp
lldb/trunk/source/Utility/CMakeLists.txt
lldb/trunk/unittests/Core/CMakeLists.txt
lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
lldb/trunk/unittests/Utility/CMakeLists.txt
Removed: lldb/trunk/include/lldb/Core/Timer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Timer.h?rev=306681&view=auto
==============================================================================
--- lldb/trunk/include/lldb/Core/Timer.h (original)
+++ lldb/trunk/include/lldb/Core/Timer.h (removed)
@@ -1,91 +0,0 @@
-//===-- Timer.h -------------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_Timer_h_
-#define liblldb_Timer_h_
-
-#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN
-#include "llvm/Support/Chrono.h"
-
-#include <atomic>
-
-#include <stdint.h> // for uint32_t
-
-namespace lldb_private {
-class Stream;
-}
-
-namespace lldb_private {
-
-//----------------------------------------------------------------------
-/// @class Timer Timer.h "lldb/Core/Timer.h"
-/// @brief A timer class that simplifies common timing metrics.
-///
-/// A scoped timer class that allows a variety of pthread mutex
-/// objects to have a mutex locked when a Timer::Locker
-/// object is created, and unlocked when it goes out of scope or
-/// when the Timer::Locker::Reset(pthread_mutex_t *)
-/// is called. This provides an exception safe way to lock a mutex
-/// in a scope.
-//----------------------------------------------------------------------
-
-class Timer {
-public:
- class Category {
- public:
- explicit Category(const char *category_name);
-
- private:
- friend class Timer;
- const char *m_name;
- std::atomic<uint64_t> m_nanos;
- std::atomic<Category *> m_next;
-
- DISALLOW_COPY_AND_ASSIGN(Category);
- };
-
- //--------------------------------------------------------------
- /// Default constructor.
- //--------------------------------------------------------------
- Timer(Category &category, const char *format, ...)
- __attribute__((format(printf, 3, 4)));
-
- //--------------------------------------------------------------
- /// Destructor
- //--------------------------------------------------------------
- ~Timer();
-
- void Dump();
-
- static void SetDisplayDepth(uint32_t depth);
-
- static void SetQuiet(bool value);
-
- static void DumpCategoryTimes(Stream *s);
-
- static void ResetCategoryTimes();
-
-protected:
- using TimePoint = std::chrono::steady_clock::time_point;
- void ChildDuration(TimePoint::duration dur) { m_child_duration += dur; }
-
- Category &m_category;
- TimePoint m_total_start;
- TimePoint::duration m_child_duration{0};
-
- static std::atomic<bool> g_quiet;
- static std::atomic<unsigned> g_display_depth;
-
-private:
- DISALLOW_COPY_AND_ASSIGN(Timer);
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_Timer_h_
Removed: lldb/trunk/include/lldb/Core/TraceOptions.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/TraceOptions.h?rev=306681&view=auto
==============================================================================
--- lldb/trunk/include/lldb/Core/TraceOptions.h (original)
+++ lldb/trunk/include/lldb/Core/TraceOptions.h (removed)
@@ -1,61 +0,0 @@
-//===-- TraceOptions.h ------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_TraceOptions_h_
-#define liblldb_TraceOptions_h_
-
-#include "lldb/lldb-defines.h"
-#include "lldb/lldb-enumerations.h"
-
-#include "lldb/Utility/StructuredData.h"
-
-namespace lldb_private {
-class TraceOptions {
-public:
- TraceOptions() : m_trace_params(new StructuredData::Dictionary()) {}
-
- const StructuredData::DictionarySP &getTraceParams() const {
- return m_trace_params;
- }
-
- lldb::TraceType getType() const { return m_type; }
-
- uint64_t getTraceBufferSize() const { return m_trace_buffer_size; }
-
- uint64_t getMetaDataBufferSize() const { return m_meta_data_buffer_size; }
-
- void setTraceParams(const StructuredData::DictionarySP &dict_obj) {
- m_trace_params = dict_obj;
- }
-
- void setType(lldb::TraceType type) { m_type = type; }
-
- void setTraceBufferSize(uint64_t size) { m_trace_buffer_size = size; }
-
- void setMetaDataBufferSize(uint64_t size) { m_meta_data_buffer_size = size; }
-
- void setThreadID(lldb::tid_t thread_id) { m_thread_id = thread_id; }
-
- lldb::tid_t getThreadID() const { return m_thread_id; }
-
-private:
- lldb::TraceType m_type;
- uint64_t m_trace_buffer_size;
- uint64_t m_meta_data_buffer_size;
- lldb::tid_t m_thread_id;
-
- /// m_trace_params is meant to hold any custom parameters
- /// apart from meta buffer size and trace size.
- /// The interpretation of such parameters is left to
- /// the lldb-server.
- StructuredData::DictionarySP m_trace_params;
-};
-}
-
-#endif // liblldb_TraceOptions_h_
Modified: lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h (original)
+++ lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h Thu Jun 29 07:32:17 2017
@@ -10,10 +10,10 @@
#ifndef liblldb_NativeProcessProtocol_h_
#define liblldb_NativeProcessProtocol_h_
-#include "lldb/Core/TraceOptions.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/MainLoop.h"
#include "lldb/Utility/Status.h"
+#include "lldb/Utility/TraceOptions.h"
#include "lldb/lldb-private-forward.h"
#include "lldb/lldb-types.h"
#include "llvm/ADT/ArrayRef.h"
Modified: lldb/trunk/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Thu Jun 29 07:32:17 2017
@@ -35,7 +35,6 @@
#include "lldb/Core/LoadedModuleInfoList.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Core/ThreadSafeValue.h"
-#include "lldb/Core/TraceOptions.h"
#include "lldb/Core/UserSettingsController.h"
#include "lldb/Host/HostThread.h"
#include "lldb/Host/ProcessRunLock.h"
@@ -50,6 +49,7 @@
#include "lldb/Utility/NameMatches.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/StructuredData.h"
+#include "lldb/Utility/TraceOptions.h"
#include "lldb/lldb-private.h"
#include "llvm/ADT/ArrayRef.h"
Copied: lldb/trunk/include/lldb/Utility/Timer.h (from r306669, lldb/trunk/include/lldb/Core/Timer.h)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Timer.h?p2=lldb/trunk/include/lldb/Utility/Timer.h&p1=lldb/trunk/include/lldb/Core/Timer.h&r1=306669&r2=306682&rev=306682&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Timer.h (original)
+++ lldb/trunk/include/lldb/Utility/Timer.h Thu Jun 29 07:32:17 2017
@@ -12,27 +12,15 @@
#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN
#include "llvm/Support/Chrono.h"
-
#include <atomic>
-
#include <stdint.h> // for uint32_t
namespace lldb_private {
class Stream;
-}
-
-namespace lldb_private {
//----------------------------------------------------------------------
-/// @class Timer Timer.h "lldb/Core/Timer.h"
+/// @class Timer Timer.h "lldb/Utility/Timer.h"
/// @brief A timer class that simplifies common timing metrics.
-///
-/// A scoped timer class that allows a variety of pthread mutex
-/// objects to have a mutex locked when a Timer::Locker
-/// object is created, and unlocked when it goes out of scope or
-/// when the Timer::Locker::Reset(pthread_mutex_t *)
-/// is called. This provides an exception safe way to lock a mutex
-/// in a scope.
//----------------------------------------------------------------------
class Timer {
Copied: lldb/trunk/include/lldb/Utility/TraceOptions.h (from r306669, lldb/trunk/include/lldb/Core/TraceOptions.h)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/TraceOptions.h?p2=lldb/trunk/include/lldb/Utility/TraceOptions.h&p1=lldb/trunk/include/lldb/Core/TraceOptions.h&r1=306669&r2=306682&rev=306682&view=diff
==============================================================================
(empty)
Modified: lldb/trunk/source/API/SBTraceOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTraceOptions.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTraceOptions.cpp (original)
+++ lldb/trunk/source/API/SBTraceOptions.cpp Thu Jun 29 07:32:17 2017
@@ -10,9 +10,9 @@
#include "lldb/API/SBTraceOptions.h"
#include "lldb/API/SBError.h"
#include "lldb/API/SBStructuredData.h"
-#include "lldb/Utility/Log.h"
#include "lldb/Core/StructuredDataImpl.h"
-#include "lldb/Core/TraceOptions.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/TraceOptions.h"
using namespace lldb;
using namespace lldb_private;
Modified: lldb/trunk/source/API/SystemInitializerFull.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SystemInitializerFull.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/API/SystemInitializerFull.cpp (original)
+++ lldb/trunk/source/API/SystemInitializerFull.cpp Thu Jun 29 07:32:17 2017
@@ -20,7 +20,6 @@
#endif
#include "lldb/Core/Debugger.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Host/Host.h"
#include "lldb/Initialization/SystemInitializerCommon.h"
#include "lldb/Interpreter/CommandInterpreter.h"
@@ -28,6 +27,7 @@
#include "lldb/Symbol/GoASTContext.h"
#include "lldb/Symbol/JavaASTContext.h"
#include "lldb/Symbol/OCamlASTContext.h"
+#include "lldb/Utility/Timer.h"
#include "Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h"
#include "Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h"
Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Thu Jun 29 07:32:17 2017
@@ -17,7 +17,6 @@
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/StreamFile.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Core/Value.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectVariable.h"
@@ -47,6 +46,7 @@
#include "lldb/Target/Thread.h"
#include "lldb/Utility/LLDBAssert.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
using namespace lldb;
using namespace lldb_private;
Modified: lldb/trunk/source/Commands/CommandObjectLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectLog.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectLog.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectLog.cpp Thu Jun 29 07:32:17 2017
@@ -15,7 +15,6 @@
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/StreamFile.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Host/OptionParser.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandInterpreter.h"
@@ -31,6 +30,7 @@
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/Timer.h"
using namespace lldb;
using namespace lldb_private;
Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Thu Jun 29 07:32:17 2017
@@ -16,7 +16,6 @@
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/Section.h"
#include "lldb/Core/State.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Core/ValueObjectVariable.h"
#include "lldb/DataFormatters/ValueObjectPrinter.h"
#include "lldb/Host/OptionParser.h"
@@ -50,6 +49,7 @@
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadSpec.h"
+#include "lldb/Utility/Timer.h"
#include "llvm/Support/FileSystem.h"
Modified: lldb/trunk/source/Core/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/CMakeLists.txt?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Core/CMakeLists.txt (original)
+++ lldb/trunk/source/Core/CMakeLists.txt Thu Jun 29 07:32:17 2017
@@ -32,7 +32,6 @@ add_lldb_library(lldbCore
State.cpp
StreamAsynchronousIO.cpp
StreamFile.cpp
- Timer.cpp
UserSettingsController.cpp
Value.cpp
ValueObject.cpp
Modified: lldb/trunk/source/Core/Disassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Disassembler.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Core/Disassembler.cpp (original)
+++ lldb/trunk/source/Core/Disassembler.cpp Thu Jun 29 07:32:17 2017
@@ -17,7 +17,6 @@
#include "lldb/Core/ModuleList.h" // for ModuleList
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/SourceManager.h" // for SourceManager
-#include "lldb/Core/Timer.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Interpreter/OptionValue.h"
#include "lldb/Interpreter/OptionValueArray.h"
@@ -37,8 +36,9 @@
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/Status.h"
-#include "lldb/Utility/Stream.h" // for Stream
-#include "lldb/Utility/StreamString.h" // for StreamString
+#include "lldb/Utility/Stream.h" // for Stream
+#include "lldb/Utility/StreamString.h" // for StreamString
+#include "lldb/Utility/Timer.h"
#include "lldb/lldb-private-enumerations.h" // for InstructionType:...
#include "lldb/lldb-private-interfaces.h" // for DisassemblerCrea...
#include "lldb/lldb-private-types.h" // for RegisterInfo
Modified: lldb/trunk/source/Core/Mangled.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Mangled.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Core/Mangled.cpp (original)
+++ lldb/trunk/source/Core/Mangled.cpp Thu Jun 29 07:32:17 2017
@@ -27,12 +27,12 @@
#include <cxxabi.h>
#endif
-#include "lldb/Core/Timer.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Logging.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/Timer.h"
#include "lldb/lldb-enumerations.h" // for LanguageType
#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Thu Jun 29 07:32:17 2017
@@ -17,7 +17,6 @@
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/SearchFilter.h" // for SearchFilt...
#include "lldb/Core/Section.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/Host.h"
#include "lldb/Interpreter/CommandInterpreter.h"
@@ -45,6 +44,7 @@
#include "lldb/Utility/Status.h"
#include "lldb/Utility/Stream.h" // for Stream
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
#if defined(LLVM_ON_WIN32)
#include "lldb/Host/windows/PosixApi.h" // for PATH_MAX
Removed: lldb/trunk/source/Core/Timer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Timer.cpp?rev=306681&view=auto
==============================================================================
--- lldb/trunk/source/Core/Timer.cpp (original)
+++ lldb/trunk/source/Core/Timer.cpp (removed)
@@ -1,135 +0,0 @@
-//===-- Timer.cpp -----------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-#include "lldb/Core/Timer.h"
-
-#include "lldb/Host/Host.h"
-#include "lldb/Utility/Stream.h"
-#include "lldb/lldb-types.h" // for thread_key_t
-
-#include <algorithm>
-#include <map>
-#include <mutex>
-#include <utility> // for pair
-#include <vector>
-
-#include <assert.h> // for assert
-#include <stdarg.h> // for va_end, va_list, va_start
-#include <stdio.h>
-
-using namespace lldb_private;
-
-#define TIMER_INDENT_AMOUNT 2
-
-namespace {
-typedef std::vector<Timer *> TimerStack;
-static std::atomic<Timer::Category *> g_categories;
-} // end of anonymous namespace
-
-std::atomic<bool> Timer::g_quiet(true);
-std::atomic<unsigned> Timer::g_display_depth(0);
-static std::mutex &GetFileMutex() {
- static std::mutex *g_file_mutex_ptr = new std::mutex();
- return *g_file_mutex_ptr;
-}
-
-static TimerStack &GetTimerStackForCurrentThread() {
- static thread_local TimerStack g_stack;
- return g_stack;
-}
-
-Timer::Category::Category(const char *cat) : m_name(cat) {
- m_nanos.store(0, std::memory_order_release);
- Category *expected = g_categories;
- do {
- m_next = expected;
- } while (!g_categories.compare_exchange_weak(expected, this));
-}
-
-void Timer::SetQuiet(bool value) { g_quiet = value; }
-
-Timer::Timer(Timer::Category &category, const char *format, ...)
- : m_category(category), m_total_start(std::chrono::steady_clock::now()) {
- TimerStack &stack = GetTimerStackForCurrentThread();
-
- stack.push_back(this);
- if (g_quiet && stack.size() <= g_display_depth) {
- std::lock_guard<std::mutex> lock(GetFileMutex());
-
- // Indent
- ::fprintf(stdout, "%*s", int(stack.size() - 1) * TIMER_INDENT_AMOUNT, "");
- // Print formatted string
- va_list args;
- va_start(args, format);
- ::vfprintf(stdout, format, args);
- va_end(args);
-
- // Newline
- ::fprintf(stdout, "\n");
- }
-}
-
-Timer::~Timer() {
- using namespace std::chrono;
-
- auto stop_time = steady_clock::now();
- auto total_dur = stop_time - m_total_start;
- auto timer_dur = total_dur - m_child_duration;
-
- TimerStack &stack = GetTimerStackForCurrentThread();
- if (g_quiet && stack.size() <= g_display_depth) {
- std::lock_guard<std::mutex> lock(GetFileMutex());
- ::fprintf(stdout, "%*s%.9f sec (%.9f sec)\n",
- int(stack.size() - 1) * TIMER_INDENT_AMOUNT, "",
- duration<double>(total_dur).count(),
- duration<double>(timer_dur).count());
- }
-
- assert(stack.back() == this);
- stack.pop_back();
- if (!stack.empty())
- stack.back()->ChildDuration(total_dur);
-
- // Keep total results for each category so we can dump results.
- m_category.m_nanos += std::chrono::nanoseconds(timer_dur).count();
-}
-
-void Timer::SetDisplayDepth(uint32_t depth) { g_display_depth = depth; }
-
-/* binary function predicate:
- * - returns whether a person is less than another person
- */
-
-typedef std::pair<const char *, uint64_t> TimerEntry;
-
-static bool CategoryMapIteratorSortCriterion(const TimerEntry &lhs,
- const TimerEntry &rhs) {
- return lhs.second > rhs.second;
-}
-
-void Timer::ResetCategoryTimes() {
- for (Category *i = g_categories; i; i = i->m_next)
- i->m_nanos.store(0, std::memory_order_release);
-}
-
-void Timer::DumpCategoryTimes(Stream *s) {
- std::vector<TimerEntry> sorted;
- for (Category *i = g_categories; i; i = i->m_next) {
- uint64_t nanos = i->m_nanos.load(std::memory_order_acquire);
- if (nanos)
- sorted.push_back(std::make_pair(i->m_name, nanos));
- }
- if (sorted.empty())
- return; // Later code will break without any elements.
-
- // Sort by time
- std::sort(sorted.begin(), sorted.end(), CategoryMapIteratorSortCriterion);
-
- for (const auto &timer : sorted)
- s->Printf("%.9f sec for %s\n", timer.second / 1000000000., timer.first);
-}
Modified: lldb/trunk/source/Host/common/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Symbols.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Symbols.cpp (original)
+++ lldb/trunk/source/Host/common/Symbols.cpp Thu Jun 29 07:32:17 2017
@@ -11,7 +11,6 @@
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/DataBuffer.h"
@@ -19,6 +18,7 @@
#include "lldb/Utility/Log.h"
#include "lldb/Utility/SafeMachO.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
#include "lldb/Utility/UUID.h"
#include "llvm/Support/FileSystem.h"
Modified: lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp (original)
+++ lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp Thu Jun 29 07:32:17 2017
@@ -42,12 +42,12 @@
#include "llvm/ADT/SmallVector.h"
#endif
// Project includes
-#include "lldb/Core/Timer.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/Socket.h"
#include "lldb/Host/common/TCPSocket.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
using namespace lldb;
using namespace lldb_private;
Modified: lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Initialization/SystemInitializerCommon.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Initialization/SystemInitializerCommon.cpp (original)
+++ lldb/trunk/source/Initialization/SystemInitializerCommon.cpp Thu Jun 29 07:32:17 2017
@@ -17,10 +17,10 @@
#include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
#include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h"
#include "Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Timer.h"
#if defined(__APPLE__)
#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h"
Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Thu Jun 29 07:32:17 2017
@@ -45,9 +45,9 @@
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/State.h"
#include "lldb/Core/StreamFile.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/Timer.h"
#ifndef LLDB_DISABLE_LIBEDIT
#include "lldb/Host/Editline.h"
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Thu Jun 29 07:32:17 2017
@@ -30,7 +30,6 @@
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Scalar.h"
#include "lldb/Core/Section.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Core/ValueObjectVariable.h"
#include "lldb/Expression/DiagnosticManager.h"
#include "lldb/Expression/FunctionCaller.h"
@@ -55,6 +54,7 @@
#include "lldb/Utility/Status.h"
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
#include "AppleObjCClassDescriptorV2.h"
#include "AppleObjCDeclVendor.h"
Modified: lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp Thu Jun 29 07:32:17 2017
@@ -31,11 +31,11 @@ typedef struct ar_hdr {
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Utility/DataBufferLLVM.h"
#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/Timer.h"
#include "llvm/Support/MemoryBuffer.h"
Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Thu Jun 29 07:32:17 2017
@@ -19,7 +19,6 @@
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Section.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Symbol/DWARFCallFrameInfo.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Target/SectionLoadList.h"
@@ -28,6 +27,7 @@
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/Timer.h"
#include "llvm/ADT/PointerUnion.h"
#include "llvm/ADT/StringRef.h"
Modified: lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp Thu Jun 29 07:32:17 2017
@@ -20,7 +20,6 @@
#include "lldb/Core/RangeMap.h"
#include "lldb/Core/Section.h"
#include "lldb/Core/StreamFile.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Host/Host.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/Platform.h"
@@ -32,6 +31,7 @@
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
#include "lldb/Utility/UUID.h"
#ifndef __APPLE__
Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Thu Jun 29 07:32:17 2017
@@ -27,7 +27,6 @@
#include "lldb/Core/RegisterValue.h"
#include "lldb/Core/Section.h"
#include "lldb/Core/StreamFile.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Host/Host.h"
#include "lldb/Symbol/DWARFCallFrameInfo.h"
#include "lldb/Symbol/ObjectFile.h"
@@ -44,6 +43,7 @@
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
#include "lldb/Utility/UUID.h"
#include "lldb/Utility/SafeMachO.h"
Modified: lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp Thu Jun 29 07:32:17 2017
@@ -19,7 +19,6 @@
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Section.h"
#include "lldb/Core/StreamFile.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/SectionLoadList.h"
@@ -28,6 +27,7 @@
#include "lldb/Utility/DataBufferLLVM.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
#include "lldb/Utility/UUID.h"
#include "llvm/Support/MemoryBuffer.h"
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Thu Jun 29 07:32:17 2017
@@ -24,7 +24,6 @@
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Host/Symbols.h"
@@ -39,6 +38,7 @@
#include "lldb/Utility/DataBufferLLVM.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Status.h"
+#include "lldb/Utility/Timer.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Threading.h"
Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessorTrace.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessorTrace.h?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/ProcessorTrace.h (original)
+++ lldb/trunk/source/Plugins/Process/Linux/ProcessorTrace.h Thu Jun 29 07:32:17 2017
@@ -10,12 +10,11 @@
#ifndef liblldb_ProcessorTrace_H_
#define liblldb_ProcessorTrace_H_
-#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/DenseSet.h"
-
-#include "lldb/Core/TraceOptions.h"
#include "lldb/Utility/Status.h"
+#include "lldb/Utility/TraceOptions.h"
#include "lldb/lldb-types.h"
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/DenseSet.h"
#include <linux/perf_event.h>
#include <sys/mman.h>
@@ -138,4 +137,4 @@ public:
};
} // namespace process_linux
} // namespace lldb_private
-#endif
\ No newline at end of file
+#endif
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Thu Jun 29 07:32:17 2017
@@ -35,7 +35,6 @@
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/State.h"
#include "lldb/Core/StreamFile.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Core/Value.h"
#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/Host/ConnectionFileDescriptor.h"
@@ -66,6 +65,7 @@
#include "lldb/Utility/CleanUp.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
// Project includes
#include "GDBRemoteRegisterContext.h"
Modified: lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp Thu Jun 29 07:32:17 2017
@@ -33,7 +33,6 @@
#include "lldb/Core/Communication.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/PluginManager.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/DataFormatters/TypeSummary.h"
#include "lldb/Host/ConnectionFileDescriptor.h"
@@ -44,6 +43,7 @@
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/ThreadPlan.h"
+#include "lldb/Utility/Timer.h"
#if defined(_WIN32)
#include "lldb/Host/windows/ConnectionGenericFileWindows.h"
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Thu Jun 29 07:32:17 2017
@@ -13,13 +13,13 @@
#include "lldb/Core/DumpDataExtractor.h"
#include "lldb/Core/Mangled.h"
#include "lldb/Core/Module.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Host/StringConvert.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/LineTable.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
#include "DWARFDIECollection.h"
#include "DWARFDebugAbbrev.h"
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp Thu Jun 29 07:32:17 2017
@@ -14,9 +14,9 @@
#include <algorithm>
-#include "lldb/Core/Timer.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/Timer.h"
#include "DWARFCompileUnit.h"
#include "DWARFDebugInfo.h"
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp Thu Jun 29 07:32:17 2017
@@ -14,9 +14,9 @@
#include "lldb/Core/FileSpecList.h"
#include "lldb/Core/Module.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Host/Host.h"
#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Timer.h"
#include "LogChannelDWARF.h"
#include "SymbolFileDWARF.h"
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp Thu Jun 29 07:32:17 2017
@@ -9,8 +9,8 @@
#include "DWARFDebugPubnames.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/Timer.h"
#include "DWARFCompileUnit.h"
#include "DWARFDIECollection.h"
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu Jun 29 07:32:17 2017
@@ -21,10 +21,10 @@
#include "lldb/Core/Scalar.h"
#include "lldb/Core/Section.h"
#include "lldb/Core/StreamFile.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Core/Value.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
#include "Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h"
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Thu Jun 29 07:32:17 2017
@@ -22,12 +22,12 @@
#include "lldb/Core/Section.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Utility/RegularExpression.h"
+#include "lldb/Utility/Timer.h"
//#define DEBUG_OSO_DMAP // DO NOT CHECKIN WITH THIS NOT COMMENTED OUT
#if defined(DEBUG_OSO_DMAP)
#include "lldb/Core/StreamFile.h"
#endif
-#include "lldb/Core/Timer.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/LineTable.h"
Modified: lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp Thu Jun 29 07:32:17 2017
@@ -10,7 +10,6 @@
#include "SymbolFileSymtab.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/ObjectFile.h"
@@ -19,6 +18,7 @@
#include "lldb/Symbol/Symtab.h"
#include "lldb/Symbol/TypeList.h"
#include "lldb/Utility/RegularExpression.h"
+#include "lldb/Utility/Timer.h"
using namespace lldb;
using namespace lldb_private;
Modified: lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp Thu Jun 29 07:32:17 2017
@@ -15,11 +15,11 @@
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Section.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/Symbols.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
using namespace lldb;
using namespace lldb_private;
Modified: lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp (original)
+++ lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp Thu Jun 29 07:32:17 2017
@@ -14,7 +14,6 @@
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Section.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Core/dwarf.h"
#include "lldb/Host/Host.h"
#include "lldb/Symbol/DWARFCallFrameInfo.h"
@@ -23,6 +22,7 @@
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/Thread.h"
#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Timer.h"
using namespace lldb;
using namespace lldb_private;
Modified: lldb/trunk/source/Symbol/ObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ObjectFile.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ObjectFile.cpp (original)
+++ lldb/trunk/source/Symbol/ObjectFile.cpp Thu Jun 29 07:32:17 2017
@@ -13,7 +13,6 @@
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Section.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Symbol/ObjectContainer.h"
#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Target/Process.h"
@@ -25,6 +24,7 @@
#include "lldb/Utility/DataBufferLLVM.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RegularExpression.h"
+#include "lldb/Utility/Timer.h"
#include "lldb/lldb-private.h"
using namespace lldb;
Modified: lldb/trunk/source/Symbol/Symtab.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symtab.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Symtab.cpp (original)
+++ lldb/trunk/source/Symbol/Symtab.cpp Thu Jun 29 07:32:17 2017
@@ -13,15 +13,15 @@
#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
#include "Plugins/Language/ObjC/ObjCLanguage.h"
#include "lldb/Core/Module.h"
-#include "lldb/Core/Section.h"
#include "lldb/Core/STLUtils.h"
-#include "lldb/Core/Timer.h"
+#include "lldb/Core/Section.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/Symbol.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/Symtab.h"
#include "lldb/Utility/RegularExpression.h"
#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/Timer.h"
using namespace lldb;
using namespace lldb_private;
Modified: lldb/trunk/source/Target/ObjCLanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ObjCLanguageRuntime.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Target/ObjCLanguageRuntime.cpp (original)
+++ lldb/trunk/source/Target/ObjCLanguageRuntime.cpp Thu Jun 29 07:32:17 2017
@@ -11,7 +11,6 @@
#include "lldb/Core/MappedHash.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/SymbolContext.h"
@@ -21,6 +20,7 @@
#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Timer.h"
#include "llvm/ADT/StringRef.h"
Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Thu Jun 29 07:32:17 2017
@@ -30,7 +30,6 @@
#include "lldb/Core/SourceManager.h"
#include "lldb/Core/State.h"
#include "lldb/Core/StreamFile.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Expression/REPL.h"
#include "lldb/Expression/UserExpression.h"
@@ -58,6 +57,7 @@
#include "lldb/Utility/LLDBAssert.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
using namespace lldb;
using namespace lldb_private;
Modified: lldb/trunk/source/Target/TargetList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/TargetList.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Target/TargetList.cpp (original)
+++ lldb/trunk/source/Target/TargetList.cpp Thu Jun 29 07:32:17 2017
@@ -15,7 +15,6 @@
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/State.h"
-#include "lldb/Core/Timer.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Interpreter/CommandInterpreter.h"
@@ -24,6 +23,7 @@
#include "lldb/Target/Platform.h"
#include "lldb/Target/Process.h"
#include "lldb/Utility/TildeExpressionResolver.h"
+#include "lldb/Utility/Timer.h"
// Other libraries and framework includes
#include "llvm/ADT/SmallString.h"
Modified: lldb/trunk/source/Utility/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/CMakeLists.txt?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/source/Utility/CMakeLists.txt (original)
+++ lldb/trunk/source/Utility/CMakeLists.txt Thu Jun 29 07:32:17 2017
@@ -31,6 +31,7 @@ add_lldb_library(lldbUtility
StructuredData.cpp
TaskPool.cpp
TildeExpressionResolver.cpp
+ Timer.cpp
UserID.cpp
UriParser.cpp
UUID.cpp
Copied: lldb/trunk/source/Utility/Timer.cpp (from r306669, lldb/trunk/source/Core/Timer.cpp)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/Timer.cpp?p2=lldb/trunk/source/Utility/Timer.cpp&p1=lldb/trunk/source/Core/Timer.cpp&r1=306669&r2=306682&rev=306682&view=diff
==============================================================================
--- lldb/trunk/source/Core/Timer.cpp (original)
+++ lldb/trunk/source/Utility/Timer.cpp Thu Jun 29 07:32:17 2017
@@ -6,11 +6,8 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-#include "lldb/Core/Timer.h"
-
-#include "lldb/Host/Host.h"
+#include "lldb/Utility/Timer.h"
#include "lldb/Utility/Stream.h"
-#include "lldb/lldb-types.h" // for thread_key_t
#include <algorithm>
#include <map>
Modified: lldb/trunk/unittests/Core/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Core/CMakeLists.txt?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/unittests/Core/CMakeLists.txt (original)
+++ lldb/trunk/unittests/Core/CMakeLists.txt Thu Jun 29 07:32:17 2017
@@ -6,7 +6,6 @@ add_lldb_unittest(LLDBCoreTests
ScalarTest.cpp
StateTest.cpp
StreamCallbackTest.cpp
- TimerTest.cpp
LINK_LIBS
lldbCore
Removed: lldb/trunk/unittests/Core/TimerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Core/TimerTest.cpp?rev=306681&view=auto
==============================================================================
--- lldb/trunk/unittests/Core/TimerTest.cpp (original)
+++ lldb/trunk/unittests/Core/TimerTest.cpp (removed)
@@ -1,73 +0,0 @@
-//===-- TimerTest.cpp -------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "lldb/Core/Timer.h"
-#include "gtest/gtest.h"
-
-#include "lldb/Utility/StreamString.h"
-#include <thread>
-
-using namespace lldb_private;
-
-TEST(TimerTest, CategoryTimes) {
- Timer::ResetCategoryTimes();
- {
- static Timer::Category tcat("CAT1");
- Timer t(tcat, "");
- std::this_thread::sleep_for(std::chrono::milliseconds(10));
- }
- StreamString ss;
- Timer::DumpCategoryTimes(&ss);
- double seconds;
- ASSERT_EQ(1, sscanf(ss.GetData(), "%lf sec for CAT1", &seconds));
- EXPECT_LT(0.001, seconds);
- EXPECT_GT(0.1, seconds);
-}
-
-TEST(TimerTest, CategoryTimesNested) {
- Timer::ResetCategoryTimes();
- {
- static Timer::Category tcat1("CAT1");
- Timer t1(tcat1, "");
- std::this_thread::sleep_for(std::chrono::milliseconds(10));
- // Explicitly testing the same category as above.
- Timer t2(tcat1, "");
- std::this_thread::sleep_for(std::chrono::milliseconds(10));
- }
- StreamString ss;
- Timer::DumpCategoryTimes(&ss);
- double seconds;
- // It should only appear once.
- ASSERT_EQ(ss.GetString().count("CAT1"), 1U);
- ASSERT_EQ(1, sscanf(ss.GetData(), "%lf sec for CAT1", &seconds));
- EXPECT_LT(0.002, seconds);
- EXPECT_GT(0.2, seconds);
-}
-
-TEST(TimerTest, CategoryTimes2) {
- Timer::ResetCategoryTimes();
- {
- static Timer::Category tcat1("CAT1");
- Timer t1(tcat1, "");
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- static Timer::Category tcat2("CAT2");
- Timer t2(tcat2, "");
- std::this_thread::sleep_for(std::chrono::milliseconds(10));
- }
- StreamString ss;
- Timer::DumpCategoryTimes(&ss);
- double seconds1, seconds2;
- ASSERT_EQ(2, sscanf(ss.GetData(), "%lf sec for CAT1%*[\n ]%lf sec for CAT2",
- &seconds1, &seconds2))
- << "String: " << ss.GetData();
- EXPECT_LT(0.01, seconds1);
- EXPECT_GT(1, seconds1);
- EXPECT_LT(0.001, seconds2);
- EXPECT_GT(0.1, seconds2);
-}
Modified: lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp (original)
+++ lldb/trunk/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp Thu Jun 29 07:32:17 2017
@@ -12,10 +12,10 @@
#include "Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h"
#include "lldb/Core/ModuleSpec.h"
-#include "lldb/Core/TraceOptions.h"
#include "lldb/Target/MemoryRegionInfo.h"
#include "lldb/Utility/DataBuffer.h"
#include "lldb/Utility/StructuredData.h"
+#include "lldb/Utility/TraceOptions.h"
#include "lldb/lldb-enumerations.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Testing/Support/Error.h"
Modified: lldb/trunk/unittests/Utility/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/CMakeLists.txt?rev=306682&r1=306681&r2=306682&view=diff
==============================================================================
--- lldb/trunk/unittests/Utility/CMakeLists.txt (original)
+++ lldb/trunk/unittests/Utility/CMakeLists.txt Thu Jun 29 07:32:17 2017
@@ -10,6 +10,7 @@ add_lldb_unittest(UtilityTests
TaskPoolTest.cpp
TildeExpressionResolverTest.cpp
TimeoutTest.cpp
+ TimerTest.cpp
UriParserTest.cpp
VASprintfTest.cpp
Copied: lldb/trunk/unittests/Utility/TimerTest.cpp (from r306669, lldb/trunk/unittests/Core/TimerTest.cpp)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/TimerTest.cpp?p2=lldb/trunk/unittests/Utility/TimerTest.cpp&p1=lldb/trunk/unittests/Core/TimerTest.cpp&r1=306669&r2=306682&rev=306682&view=diff
==============================================================================
--- lldb/trunk/unittests/Core/TimerTest.cpp (original)
+++ lldb/trunk/unittests/Utility/TimerTest.cpp Thu Jun 29 07:32:17 2017
@@ -7,10 +7,9 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/Core/Timer.h"
-#include "gtest/gtest.h"
-
#include "lldb/Utility/StreamString.h"
+#include "lldb/Utility/Timer.h"
+#include "gtest/gtest.h"
#include <thread>
using namespace lldb_private;
More information about the lldb-commits
mailing list