summaryrefslogtreecommitdiffstats
path: root/lldb/tools/lldb-perf/lib/Measurement.h
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/tools/lldb-perf/lib/Measurement.h')
-rw-r--r--lldb/tools/lldb-perf/lib/Measurement.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/lldb/tools/lldb-perf/lib/Measurement.h b/lldb/tools/lldb-perf/lib/Measurement.h
new file mode 100644
index 00000000000..0697b0fe30f
--- /dev/null
+++ b/lldb/tools/lldb-perf/lib/Measurement.h
@@ -0,0 +1,52 @@
+//
+// Measurement.h
+// PerfTestDriver
+//
+// Created by Enrico Granata on 3/7/13.
+// Copyright (c) 2013 Apple Inc. All rights reserved.
+//
+
+#ifndef __PerfTestDriver__Measurement__
+#define __PerfTestDriver__Measurement__
+
+#include "Gauge.h"
+#include "Metric.h"
+
+namespace lldb { namespace perf
+{
+template <typename GaugeType, typename Action>
+class Measurement : public WriteToPList
+{
+public:
+ Measurement (Action act, const char* name = NULL) :
+ m_action (act),
+ m_metric (Metric<typename GaugeType::SizeType>(name))
+ {}
+
+ template <typename... Args>
+ void
+ operator () (Args... args)
+ {
+ GaugeType gauge;
+ m_metric.append (gauge.gauge(m_action,args...));
+ }
+
+ Metric<typename GaugeType::SizeType>
+ metric ()
+ {
+ return m_metric;
+ }
+
+ virtual void
+ Write (CFCMutableArray& parent)
+ {
+ m_metric.Write(parent);
+ }
+
+private:
+ Action m_action;
+ Metric<typename GaugeType::SizeType> m_metric;
+};
+} }
+
+#endif /* defined(__PerfTestDriver__Measurement__) */
OpenPOWER on IntegriCloud