Merge tag 'v3.10.72' into linux-linaro-lsk
[firefly-linux-kernel-4.4.55.git] / tools / gator / daemon / PerfDriver.h
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 <stdint.h>
13
14 #include "Driver.h"
15
16 // If debugfs is not mounted at /sys/kernel/debug, update DEBUGFS_PATH
17 #define DEBUGFS_PATH "/sys/kernel/debug"
18 #define EVENTS_PATH DEBUGFS_PATH "/tracing/events"
19
20 #define SCHED_SWITCH "sched/sched_switch"
21 #define CPU_IDLE "power/cpu_idle"
22
23 class Buffer;
24 class DynBuf;
25 class PerfGroup;
26
27 class PerfDriver : public SimpleDriver {
28 public:
29         PerfDriver();
30         ~PerfDriver();
31
32         bool getLegacySupport() const { return mLegacySupport; }
33
34         bool setup();
35         bool summary(Buffer *const buffer);
36         void coreName(const uint32_t startTime, Buffer *const buffer, const int cpu);
37         bool isSetup() const { return mIsSetup; }
38
39         void setupCounter(Counter &counter);
40
41         bool enable(const uint64_t currTime, PerfGroup *const group, Buffer *const buffer) const;
42
43         static long long getTracepointId(const char *const name, DynBuf *const printb);
44
45 private:
46         void addCpuCounters(const char *const counterName, const int type, const int numCounters);
47         void addUncoreCounters(const char *const counterName, const int type, const int numCounters);
48
49         bool mIsSetup;
50         bool mLegacySupport;
51
52         // Intentionally undefined
53         PerfDriver(const PerfDriver &);
54         PerfDriver &operator=(const PerfDriver &);
55 };
56
57 #endif // PERFDRIVER_H