diff options
author | Greg Clayton <gclayton@apple.com> | 2013-03-18 22:34:00 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2013-03-18 22:34:00 +0000 |
commit | 7b8f738227424f9c8105bf1db2bb067d596b228e (patch) | |
tree | a4ab33043496478235852e5dc2eeb805bce7e1fb /lldb/tools/lldb-perf/lib | |
parent | 8fc340976d28b6719e66014496608a095e6f8ecd (diff) | |
download | bcm5719-llvm-7b8f738227424f9c8105bf1db2bb067d596b228e.tar.gz bcm5719-llvm-7b8f738227424f9c8105bf1db2bb067d596b228e.zip |
Code cleanup:
- don't use preprocessor macros
- use switch statements
- don't put anything in the lldb namespace, use "lldb_perf" namespace.
- Pass the action struct into each TestStep() for each step fill in
- Modify the ActionWanted class to have accessors to make the continue, next, finish, kill instead of using preproc macros
llvm-svn: 177332
Diffstat (limited to 'lldb/tools/lldb-perf/lib')
-rw-r--r-- | lldb/tools/lldb-perf/lib/Gauge.h | 4 | ||||
-rw-r--r-- | lldb/tools/lldb-perf/lib/Measurement.h | 4 | ||||
-rw-r--r-- | lldb/tools/lldb-perf/lib/MemoryGauge.cpp | 2 | ||||
-rw-r--r-- | lldb/tools/lldb-perf/lib/MemoryGauge.h | 4 | ||||
-rw-r--r-- | lldb/tools/lldb-perf/lib/Metric.cpp | 6 | ||||
-rw-r--r-- | lldb/tools/lldb-perf/lib/Metric.h | 4 | ||||
-rw-r--r-- | lldb/tools/lldb-perf/lib/TestCase.cpp | 13 | ||||
-rw-r--r-- | lldb/tools/lldb-perf/lib/TestCase.h | 64 | ||||
-rw-r--r-- | lldb/tools/lldb-perf/lib/Timer.cpp | 2 | ||||
-rw-r--r-- | lldb/tools/lldb-perf/lib/Timer.h | 4 | ||||
-rw-r--r-- | lldb/tools/lldb-perf/lib/Xcode.cpp | 2 | ||||
-rw-r--r-- | lldb/tools/lldb-perf/lib/Xcode.h | 4 |
12 files changed, 73 insertions, 40 deletions
diff --git a/lldb/tools/lldb-perf/lib/Gauge.h b/lldb/tools/lldb-perf/lib/Gauge.h index 7c843368baa..33e6a284af3 100644 --- a/lldb/tools/lldb-perf/lib/Gauge.h +++ b/lldb/tools/lldb-perf/lib/Gauge.h @@ -11,7 +11,7 @@ #include <functional> -namespace lldb { namespace perf +namespace lldb_perf { template <class TASizeType> class Gauge @@ -45,6 +45,6 @@ public: } }; -} } +} #endif diff --git a/lldb/tools/lldb-perf/lib/Measurement.h b/lldb/tools/lldb-perf/lib/Measurement.h index 4623bdf8f6f..24a95bb4b5b 100644 --- a/lldb/tools/lldb-perf/lib/Measurement.h +++ b/lldb/tools/lldb-perf/lib/Measurement.h @@ -13,7 +13,7 @@ #include "Timer.h" #include "Metric.h" -namespace lldb { namespace perf +namespace lldb_perf { template <typename GaugeType, typename Action> class Measurement : public WriteToPList @@ -90,6 +90,6 @@ public: } }; -} } +} #endif /* defined(__PerfTestDriver__Measurement__) */ diff --git a/lldb/tools/lldb-perf/lib/MemoryGauge.cpp b/lldb/tools/lldb-perf/lib/MemoryGauge.cpp index 2a80fccb7e0..f12a7fd99cb 100644 --- a/lldb/tools/lldb-perf/lib/MemoryGauge.cpp +++ b/lldb/tools/lldb-perf/lib/MemoryGauge.cpp @@ -10,7 +10,7 @@ #include <assert.h> #include <mach/task.h> -using namespace lldb::perf; +using namespace lldb_perf; MemoryGauge::SizeType MemoryGauge::now () diff --git a/lldb/tools/lldb-perf/lib/MemoryGauge.h b/lldb/tools/lldb-perf/lib/MemoryGauge.h index 272b9969b8c..eefd274b9c4 100644 --- a/lldb/tools/lldb-perf/lib/MemoryGauge.h +++ b/lldb/tools/lldb-perf/lib/MemoryGauge.h @@ -13,7 +13,7 @@ #include <mach/task_info.h> -namespace lldb { namespace perf +namespace lldb_perf { class MemoryGauge : public Gauge<mach_vm_size_t> { @@ -48,6 +48,6 @@ public: SizeType value (); }; -} } +} #endif /* defined(__PerfTestDriver__MemoryGauge__) */ diff --git a/lldb/tools/lldb-perf/lib/Metric.cpp b/lldb/tools/lldb-perf/lib/Metric.cpp index 3791dd35409..ba56c033c15 100644 --- a/lldb/tools/lldb-perf/lib/Metric.cpp +++ b/lldb/tools/lldb-perf/lib/Metric.cpp @@ -12,7 +12,7 @@ #include "CFCMutableDictionary.h" #include "CFCString.h" -using namespace lldb::perf; +using namespace lldb_perf; template <class T> Metric<T>::Metric () : Metric ("") @@ -90,5 +90,5 @@ void Metric<T>::WriteImpl (CFCMutableArray& parent, identity<mach_vm_size_t>) parent.AppendValue(dict.get(), true); } -template class lldb::perf::Metric<double>; -template class lldb::perf::Metric<mach_vm_size_t>; +template class lldb_perf::Metric<double>; +template class lldb_perf::Metric<mach_vm_size_t>; diff --git a/lldb/tools/lldb-perf/lib/Metric.h b/lldb/tools/lldb-perf/lib/Metric.h index 874169522ad..4d7b57d33cb 100644 --- a/lldb/tools/lldb-perf/lib/Metric.h +++ b/lldb/tools/lldb-perf/lib/Metric.h @@ -15,7 +15,7 @@ #include "CFCMutableArray.h" -namespace lldb { namespace perf +namespace lldb_perf { class WriteToPList { @@ -70,6 +70,6 @@ private: std::string m_description; std::vector<ValueType> m_dataset; }; -} } +} #endif /* defined(__PerfTestDriver__Metric__) */ diff --git a/lldb/tools/lldb-perf/lib/TestCase.cpp b/lldb/tools/lldb-perf/lib/TestCase.cpp index beb335f6613..ca825d99ce4 100644 --- a/lldb/tools/lldb-perf/lib/TestCase.cpp +++ b/lldb/tools/lldb-perf/lib/TestCase.cpp @@ -9,7 +9,7 @@ #include "TestCase.h" #include "Xcode.h" -using namespace lldb::perf; +using namespace lldb_perf; TestCase::TestCase () : m_debugger(), @@ -131,14 +131,15 @@ TestCase::Loop () } if (m_verbose) printf("RUNNING STEP %d\n",step); - auto action = TestStep(step); + ActionWanted action; + TestStep(step, action); step++; switch (action.type) { - case ActionWanted::Type::eAWContinue: + case ActionWanted::Type::eContinue: m_debugger.HandleCommand("continue"); break; - case ActionWanted::Type::eAWFinish: + case ActionWanted::Type::eFinish: if (action.thread.IsValid() == false) { if (m_verbose) Xcode::RunCommand(m_debugger,"bt all",true); @@ -148,7 +149,7 @@ TestCase::Loop () m_process.SetSelectedThread(action.thread); m_debugger.HandleCommand("finish"); break; - case ActionWanted::Type::eAWNext: + case ActionWanted::Type::eNext: if (action.thread.IsValid() == false) { if (m_verbose) Xcode::RunCommand(m_debugger,"bt all",true); @@ -158,7 +159,7 @@ TestCase::Loop () m_process.SetSelectedThread(action.thread); m_debugger.HandleCommand("next"); break; - case ActionWanted::Type::eAWKill: + case ActionWanted::Type::eKill: if (m_verbose) printf("I want to die\n"); m_process.Kill(); return; diff --git a/lldb/tools/lldb-perf/lib/TestCase.h b/lldb/tools/lldb-perf/lib/TestCase.h index c4d449a330a..a46dc5af24b 100644 --- a/lldb/tools/lldb-perf/lib/TestCase.h +++ b/lldb/tools/lldb-perf/lib/TestCase.h @@ -12,9 +12,7 @@ #include "lldb/API/LLDB.h" #include "Measurement.h" -using namespace lldb; - -namespace lldb { namespace perf +namespace lldb_perf { class TestCase { @@ -25,12 +23,46 @@ public: { enum class Type { - eAWNext, - eAWContinue, - eAWFinish, - eAWKill + eNext, + eContinue, + eFinish, + eKill } type; - SBThread thread; + lldb::SBThread thread; + + ActionWanted () : + type (Type::eContinue), + thread () + { + } + + void + Continue() + { + type = Type::eContinue; + thread = lldb::SBThread(); + } + + void + Next (lldb::SBThread t) + { + type = Type::eNext; + thread = t; + } + + void + Finish (lldb::SBThread t) + { + type = Type::eFinish; + thread = t; + } + + void + Kill () + { + type = Type::eKill; + thread = lldb::SBThread(); + } }; virtual @@ -40,8 +72,8 @@ public: virtual void Setup (int argc, const char** argv); - virtual ActionWanted - TestStep (int counter) = 0; + virtual void + TestStep (int counter, ActionWanted &next_action) = 0; bool Launch (const char** args, const char* cwd); @@ -74,13 +106,13 @@ public: Run (TestCase& test, int argc, const char** argv); protected: - SBDebugger m_debugger; - SBTarget m_target; - SBProcess m_process; - SBThread m_thread; - SBListener m_listener; + lldb::SBDebugger m_debugger; + lldb::SBTarget m_target; + lldb::SBProcess m_process; + lldb::SBThread m_thread; + lldb::SBListener m_listener; bool m_verbose; }; -} } +} #endif /* defined(__PerfTestDriver__TestCase__) */ diff --git a/lldb/tools/lldb-perf/lib/Timer.cpp b/lldb/tools/lldb-perf/lib/Timer.cpp index 59871aab4ce..4f4c623c2f0 100644 --- a/lldb/tools/lldb-perf/lib/Timer.cpp +++ b/lldb/tools/lldb-perf/lib/Timer.cpp @@ -9,7 +9,7 @@ #include "Timer.h" #include <assert.h> -using namespace lldb::perf; +using namespace lldb_perf; TimeGauge::HPTime TimeGauge::now () diff --git a/lldb/tools/lldb-perf/lib/Timer.h b/lldb/tools/lldb-perf/lib/Timer.h index c877a3d3c9e..4f8ac15f943 100644 --- a/lldb/tools/lldb-perf/lib/Timer.h +++ b/lldb/tools/lldb-perf/lib/Timer.h @@ -15,7 +15,7 @@ using namespace std::chrono; -namespace lldb { namespace perf +namespace lldb_perf { class TimeGauge : public Gauge<double> { @@ -51,6 +51,6 @@ public: double value (); }; -} } +} #endif /* defined(__PerfTestDriver__Timer__) */ diff --git a/lldb/tools/lldb-perf/lib/Xcode.cpp b/lldb/tools/lldb-perf/lib/Xcode.cpp index 730844d520f..e0b2a798699 100644 --- a/lldb/tools/lldb-perf/lib/Xcode.cpp +++ b/lldb/tools/lldb-perf/lib/Xcode.cpp @@ -10,7 +10,7 @@ #include <string> using namespace std; -using namespace lldb::perf; +using namespace lldb_perf; void Xcode::FetchVariable (SBValue value, uint32_t expand, bool verbose) diff --git a/lldb/tools/lldb-perf/lib/Xcode.h b/lldb/tools/lldb-perf/lib/Xcode.h index 670fdcbc24f..1799fc9703a 100644 --- a/lldb/tools/lldb-perf/lib/Xcode.h +++ b/lldb/tools/lldb-perf/lib/Xcode.h @@ -23,7 +23,7 @@ using namespace lldb; -namespace lldb { namespace perf +namespace lldb_perf { class Xcode { @@ -58,6 +58,6 @@ public: static SBBreakpoint CreateFileLineBreakpoint (SBTarget target, const char* file, uint32_t line); }; -} } +} #endif /* defined(__PerfTestDriver__Xcode__) */ |