summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'daemon/PerfDriver.h')
-rw-r--r--daemon/PerfDriver.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/daemon/PerfDriver.h b/daemon/PerfDriver.h
new file mode 100644
index 0000000..3181b74
--- /dev/null
+++ b/daemon/PerfDriver.h
@@ -0,0 +1,56 @@
1/**
2 * Copyright (C) ARM Limited 2013-2014. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef PERFDRIVER_H
10#define PERFDRIVER_H
11
12#include "Driver.h"
13
14// If debugfs is not mounted at /sys/kernel/debug, update DEBUGFS_PATH
15#define DEBUGFS_PATH "/sys/kernel/debug"
16#define EVENTS_PATH DEBUGFS_PATH "/tracing/events"
17
18#define SCHED_SWITCH "sched/sched_switch"
19
20class Buffer;
21class DynBuf;
22class PerfCounter;
23class PerfGroup;
24
25class PerfDriver : public Driver {
26public:
27 PerfDriver();
28 ~PerfDriver();
29
30 bool setup();
31 bool summary(Buffer *const buffer);
32 bool isSetup() const { return mIsSetup; }
33
34 bool claimCounter(const Counter &counter) const;
35 void resetCounters();
36 void setupCounter(Counter &counter);
37
38 int writeCounters(mxml_node_t *root) const;
39
40 bool enable(PerfGroup *group, Buffer *const buffer) const;
41
42 static long long getTracepointId(const char *const name, DynBuf *const printb);
43
44private:
45 PerfCounter *findCounter(const Counter &counter) const;
46 void addCpuCounters(const char *const counterName, const int type, const int numCounters);
47
48 PerfCounter *mCounters;
49 bool mIsSetup;
50
51 // Intentionally undefined
52 PerfDriver(const PerfDriver &);
53 PerfDriver &operator=(const PerfDriver &);
54};
55
56#endif // PERFDRIVER_H