From f3fb83ac6b4037cad792a162e6e38344b3549cba Mon Sep 17 00:00:00 2001 From: Enrico Granata Date: Wed, 20 Mar 2013 21:18:20 +0000 Subject: Making MemoryGauge work by fixing a Mach API call mistake - saving (and dumping) more information out of the task_info call llvm-svn: 177580 --- lldb/tools/lldb-perf/lib/Metric.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'lldb/tools/lldb-perf/lib/Metric.cpp') diff --git a/lldb/tools/lldb-perf/lib/Metric.cpp b/lldb/tools/lldb-perf/lib/Metric.cpp index ba56c033c15..afacc9b11a4 100644 --- a/lldb/tools/lldb-perf/lib/Metric.cpp +++ b/lldb/tools/lldb-perf/lib/Metric.cpp @@ -11,6 +11,7 @@ #include "CFCMutableArray.h" #include "CFCMutableDictionary.h" #include "CFCString.h" +#include "MemoryGauge.h" using namespace lldb_perf; @@ -70,8 +71,8 @@ Metric::description () return m_description.c_str(); } -template -void Metric::WriteImpl (CFCMutableArray& parent, identity) +template <> +void Metric::WriteImpl (CFCMutableArray& parent, identity) { CFCMutableDictionary dict; dict.AddValueCString(CFCString("name").get(),name(), true); @@ -80,15 +81,24 @@ void Metric::WriteImpl (CFCMutableArray& parent, identity) parent.AppendValue(dict.get(), true); } -template -void Metric::WriteImpl (CFCMutableArray& parent, identity) +template <> +void Metric::WriteImpl (CFCMutableArray& parent, identity) { CFCMutableDictionary dict; dict.AddValueCString(CFCString("name").get(),name(), true); dict.AddValueCString(CFCString("description").get(),description(), true); - dict.AddValueUInt64(CFCString("value").get(),this->average(), true); + CFCMutableDictionary value; + + auto avg = this->average(); + + 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); + + dict.AddValue(CFCString("value").get(),value.get(), true); + parent.AppendValue(dict.get(), true); } template class lldb_perf::Metric; -template class lldb_perf::Metric; +template class lldb_perf::Metric; -- cgit v1.2.3