blob: 33ed6c2744310f61accab60c67dcd3875308b64a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
//
// Metric.h
// PerfTestDriver
//
// Created by Enrico Granata on 3/7/13.
// Copyright (c) 2013 Apple Inc. All rights reserved.
//
#ifndef __PerfTestDriver__Metric__
#define __PerfTestDriver__Metric__
#include <vector>
#include <string>
#include <mach/task_info.h>
#include "CFCMutableArray.h"
namespace lldb { namespace perf
{
class WriteToPList
{
public:
virtual void
Write (CFCMutableArray& parent) = 0;
virtual
~WriteToPList () {}
};
template <class ValueType>
class Metric : public WriteToPList {
public:
Metric ();
Metric (const char*);
void
append (ValueType v);
size_t
count ();
ValueType
sum ();
ValueType
average ();
const char*
name ();
virtual void
Write (CFCMutableArray& parent)
{
WriteImpl(parent, identity<ValueType>());
}
private:
template<typename T>
struct identity { typedef T type; };
void WriteImpl (CFCMutableArray& parent, identity<double>);
void WriteImpl (CFCMutableArray& parent, identity<mach_vm_size_t>);
std::string m_name;
std::vector<ValueType> m_dataset;
};
} }
#endif /* defined(__PerfTestDriver__Metric__) */
|