diff options
author | Greg Clayton <gclayton@apple.com> | 2013-03-22 02:31:35 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2013-03-22 02:31:35 +0000 |
commit | 880afc5728954e36d00e42d7961897814e7ae028 (patch) | |
tree | 6f81faa725d1f4e99229d4ba8a64f8d73f0c0d6a /lldb/tools/lldb-perf/lib/Timer.cpp | |
parent | 0a9875abfe7c7b0eefe8da92766066043c2fa05a (diff) | |
download | bcm5719-llvm-880afc5728954e36d00e42d7961897814e7ae028.tar.gz bcm5719-llvm-880afc5728954e36d00e42d7961897814e7ae028.zip |
Much more cleanup on the performance testing infrastructure:
- Added new abtract Results class to keep CoreFoundation out of the tests. There are many subclasses for different settings:
Results::Result::Dictionary
Results::Result::Array
Results::Result::Unsigned
Results::Result::Double
Results::Result::String
- Gauge<T> can now write themselves out via a templatized write to results function:
template <class T>
Results::ResultSP GetResult (const char *description, T value);
- There are four specializations of this so far:
template <>
Results::ResultSP GetResult (const char *description, double value);
template <>
Results::ResultSP GetResult (const char *description, uint64_t value);
template <>
Results::ResultSP GetResult (const char *description, std::string value);
template <>
Results::ResultSP GetResult (const char *description, MemoryStats value);
- Don't emit the virtual memory reading from the task info call as it really doesn't mean much as it includes way too much (shared cache + other stuff we don't have control over)
- Fixed other test cases to build correctly and use the new classes
llvm-svn: 177696
Diffstat (limited to 'lldb/tools/lldb-perf/lib/Timer.cpp')
-rw-r--r-- | lldb/tools/lldb-perf/lib/Timer.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/lldb/tools/lldb-perf/lib/Timer.cpp b/lldb/tools/lldb-perf/lib/Timer.cpp index 428328b88d1..52b6c2917d8 100644 --- a/lldb/tools/lldb-perf/lib/Timer.cpp +++ b/lldb/tools/lldb-perf/lib/Timer.cpp @@ -10,6 +10,9 @@ #include "Timer.h" #include <assert.h> +#include "CFCMutableDictionary.h" +#include "CFCString.h" + using namespace lldb_perf; TimeGauge::TimeType @@ -19,7 +22,7 @@ TimeGauge::Now () } TimeGauge::TimeGauge () : -m_start(), + m_start(), m_state(TimeGauge::State::eNeverUsed) { } @@ -34,15 +37,28 @@ TimeGauge::Start () double TimeGauge::Stop () { - auto stop = Now(); + m_stop = Now(); assert(m_state == TimeGauge::State::eCounting && "cannot stop a non-started clock"); m_state = TimeGauge::State::eStopped; - return (m_value = duration_cast<duration<double>>(stop-m_start).count()); + m_delta = duration_cast<duration<double>>(m_stop-m_start).count(); + return m_delta; +} + +double +TimeGauge::GetStartValue () const +{ + return (double)m_start.time_since_epoch().count() * (double)system_clock::period::num / (double)system_clock::period::den; +} + +double +TimeGauge::GetStopValue () const +{ + return (double)m_stop.time_since_epoch().count() * (double)system_clock::period::num / (double)system_clock::period::den; } double -TimeGauge::GetValue () +TimeGauge::GetDeltaValue () const { assert(m_state == TimeGauge::State::eStopped && "clock must be used before you can evaluate it"); - return m_value; + return m_delta; } |