gator: Version 5.20
[firefly-linux-kernel-4.4.55.git] / tools / gator / daemon / SessionData.h
1 /**
2  * Copyright (C) ARM Limited 2010-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 SESSION_DATA_H
10 #define SESSION_DATA_H
11
12 #include <stdint.h>
13
14 #include "AnnotateListener.h"
15 #include "Config.h"
16 #include "Counter.h"
17 #include "FtraceDriver.h"
18 #include "KMod.h"
19 #include "MaliVideoDriver.h"
20 #include "PerfDriver.h"
21
22 #define PROTOCOL_VERSION 20
23 // Differentiates development versions (timestamp) from release versions
24 #define PROTOCOL_DEV 1000
25
26 #define NS_PER_S 1000000000LL
27 #define NS_PER_MS 1000000LL
28 #define NS_PER_US 1000LL
29
30 struct ImageLinkList {
31         char* path;
32         struct ImageLinkList *next;
33 };
34
35 class SessionData {
36 public:
37         static const size_t MAX_STRING_LEN = 80;
38
39         SessionData();
40         ~SessionData();
41         void initialize();
42         void parseSessionXML(char* xmlString);
43         void readModel();
44         void readCpuInfo();
45
46         PolledDriver *usDrivers[6];
47         KMod kmod;
48         PerfDriver perf;
49         MaliVideoDriver maliVideo;
50         FtraceDriver ftraceDriver;
51         AnnotateListener annotateListener;
52
53         char mCoreName[MAX_STRING_LEN];
54         struct ImageLinkList *mImages;
55         char *mConfigurationXMLPath;
56         char *mSessionXMLPath;
57         char *mEventsXMLPath;
58         char *mTargetPath;
59         char *mAPCDir;
60         char *mCaptureWorkingDir;
61         char *mCaptureCommand;
62         char *mCaptureUser;
63
64         bool mWaitingOnCommand;
65         bool mSessionIsActive;
66         bool mLocalCapture;
67         // halt processing of the driver data until profiling is complete or the buffer is filled
68         bool mOneShot;
69         bool mIsEBS;
70         bool mSentSummary;
71         bool mAllowCommands;
72
73         int64_t mMonotonicStarted;
74         int mBacktraceDepth;
75         // number of MB to use for the entire collection buffer
76         int mTotalBufferSize;
77         int mSampleRate;
78         int64_t mLiveRate;
79         int mDuration;
80         int mCores;
81         int mPageSize;
82         int *mCpuIds;
83         int mMaxCpuId;
84
85         // PMU Counters
86         int mCounterOverflow;
87         Counter mCounters[MAX_PERFORMANCE_COUNTERS];
88
89 private:
90         // Intentionally unimplemented
91         SessionData(const SessionData &);
92         SessionData &operator=(const SessionData &);
93 };
94
95 extern SessionData* gSessionData;
96
97 uint64_t getTime();
98 int getEventKey();
99 int pipe_cloexec(int pipefd[2]);
100 FILE *fopen_cloexec(const char *path, const char *mode);
101
102 #endif // SESSION_DATA_H