//===----------------------------------------------------------------------===//
#include "Metric.h"
-
-#include "CFCMutableArray.h"
-#include "CFCMutableDictionary.h"
-#include "CFCString.h"
#include "MemoryGauge.h"
using namespace lldb_perf;
return GetSum()/GetCount();
}
-template <>
-void Metric<double>::WriteImpl (CFCMutableDictionary& parent_dict, const char *name, const char *description, double value)
-{
- assert(name && name[0]);
- CFCMutableDictionary dict;
- 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 (CFCMutableDictionary& parent_dict, const char *name, const char *description, MemoryStats value)
-{
- CFCMutableDictionary dict;
- 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_dict.get(), true);
-
- parent_dict.AddValue(CFCString(name).get(), dict.get(), true);
-}
-
template class lldb_perf::Metric<double>;
template class lldb_perf::Metric<MemoryStats>;
#include <string>
#include <mach/task_info.h>
-#include "CFCMutableDictionary.h"
-
namespace lldb_perf {
class MemoryStats;
-class WriteResults
-{
-public:
- virtual void
- Write (CFCMutableDictionary& parent) = 0;
-
- virtual
- ~WriteResults () {}
-};
-
template <class ValueType>
-class Metric : public WriteResults
+class Metric
{
public:
Metric ();
return NULL;
return m_description.c_str();
}
-
- virtual void
- Write (CFCMutableDictionary& parent)
- {
- WriteImpl(parent, GetName(), GetDescription(), GetAverage());
- }
-
- static void WriteImpl (CFCMutableDictionary& parent, const char *name, const char *description, double);
- static void WriteImpl (CFCMutableDictionary& parent, const char *name, const char *description, MemoryStats);
private:
std::string m_name;