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/Metric.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/Metric.cpp')
| -rw-r--r-- | lldb/tools/lldb-perf/lib/Metric.cpp | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/lldb/tools/lldb-perf/lib/Metric.cpp b/lldb/tools/lldb-perf/lib/Metric.cpp index 5f17bea9a21..bf8120f2b89 100644 --- a/lldb/tools/lldb-perf/lib/Metric.cpp +++ b/lldb/tools/lldb-perf/lib/Metric.cpp @@ -18,14 +18,16 @@ using namespace lldb_perf; template <class T> Metric<T>::Metric () : Metric ("") -{} +{ +} template <class T> Metric<T>::Metric (const char* n, const char* d) : -m_name(n ? n : ""), -m_description(d ? d : ""), -m_dataset () -{} + m_name(n ? n : ""), + m_description(d ? d : ""), + m_dataset () +{ +} template <class T> void @@ -59,32 +61,32 @@ Metric<T>::GetAverage () const } template <> -void Metric<double>::WriteImpl (CFCMutableArray& parent, identity<double>) +void Metric<double>::WriteImpl (CFCMutableDictionary& parent_dict, const char *name, const char *description, double value) { + assert(name && name[0]); CFCMutableDictionary dict; - dict.AddValueCString(CFCString("name").get(), GetName(), true); - dict.AddValueCString(CFCString("description").get(),GetDescription(), true); - dict.AddValueDouble(CFCString("value").get(),this->GetAverage(), true); - parent.AppendValue(dict.get(), true); + if (description && description[0]) + dict.AddValueCString(CFCString("description").get(),description, true); + dict.AddValueDouble(CFCString("value").get(),value, true); + parent_dict.AddValue(CFCString(name).get(), dict.get(), true); } template <> -void Metric<MemoryStats>::WriteImpl (CFCMutableArray& parent, identity<MemoryStats>) +void Metric<MemoryStats>::WriteImpl (CFCMutableDictionary& parent_dict, const char *name, const char *description, MemoryStats value) { CFCMutableDictionary dict; - dict.AddValueCString(CFCString("name").get(), GetName(), true); - dict.AddValueCString(CFCString("description").get(), GetDescription(), true); - CFCMutableDictionary value; - - auto avg = this->GetAverage(); - - value.AddValueUInt64(CFCString("virtual").get(), avg.GetVirtualSize(), true); - value.AddValueUInt64(CFCString("resident").get(), avg.GetResidentSize(), true); - value.AddValueUInt64(CFCString("max_resident").get(), avg.GetMaxResidentSize(), true); + if (description && description[0]) + dict.AddValueCString(CFCString("description").get(),description, true); + CFCMutableDictionary value_dict; + // don't write out the "virtual size", it doesn't mean anything useful as it includes + // all of the shared cache and many other things that make it way too big to be useful + //value_dict.AddValueUInt64(CFCString("virtual").get(), value.GetVirtualSize(), true); + value_dict.AddValueUInt64(CFCString("resident").get(), value.GetResidentSize(), true); + value_dict.AddValueUInt64(CFCString("max_resident").get(), value.GetMaxResidentSize(), true); - dict.AddValue(CFCString("value").get(), value.get(), true); - - parent.AppendValue(dict.get(), true); + dict.AddValue(CFCString("value").get(),value_dict.get(), true); + + parent_dict.AddValue(CFCString(name).get(), dict.get(), true); } template class lldb_perf::Metric<double>; |

