1 //===-- Metric.h ------------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef __PerfTestDriver__Metric__
11 #define __PerfTestDriver__Metric__
13 #include <mach/task_info.h>
21 template <class ValueType> class Metric {
23 enum class StandardDeviationMode { eSample, ePopulation };
26 Metric(const char *, const char * = NULL);
28 void Append(ValueType v);
30 ValueType GetAverage() const;
32 size_t GetCount() const;
34 ValueType GetSum() const;
36 ValueType GetStandardDeviation(
37 StandardDeviationMode mode = StandardDeviationMode::ePopulation) const;
39 const char *GetName() const {
42 return m_name.c_str();
45 const char *GetDescription() const {
46 if (m_description.empty())
48 return m_description.c_str();
53 std::string m_description;
54 std::vector<ValueType> m_dataset;
58 #endif /* defined(__PerfTestDriver__Metric__) */