blob: d0c8900317a54a5bea34d43139896a04ab613aa5 [file] [log] [blame]
Jon Medhurstaaf37a32013-06-11 12:10:56 +01001/**
Jon Medhurstb1d07442015-05-08 12:04:18 +01002 * Copyright (C) ARM Limited 2010-2015. All rights reserved.
Jon Medhurstaaf37a32013-06-11 12:10:56 +01003 *
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
Jon Medhurst15ce78d2014-04-10 09:02:02 +010014#include "Config.h"
Jon Medhurstaaf37a32013-06-11 12:10:56 +010015#include "Counter.h"
Jon Medhurst96b56152014-10-30 18:01:15 +000016#include "FtraceDriver.h"
17#include "KMod.h"
Jon Medhurste31266f2014-08-04 15:47:44 +010018#include "MaliVideoDriver.h"
Jon Medhurst15ce78d2014-04-10 09:02:02 +010019#include "PerfDriver.h"
Jon Medhurstaaf37a32013-06-11 12:10:56 +010020
Jon Medhurstb1d07442015-05-08 12:04:18 +010021#define PROTOCOL_VERSION 21
Jon Medhurst96b56152014-10-30 18:01:15 +000022// Differentiates development versions (timestamp) from release versions
23#define PROTOCOL_DEV 1000
Jon Medhurstaaf37a32013-06-11 12:10:56 +010024
Jon Medhurst96b56152014-10-30 18:01:15 +000025#define NS_PER_S 1000000000LL
26#define NS_PER_MS 1000000LL
27#define NS_PER_US 1000LL
Jon Medhurste31266f2014-08-04 15:47:44 +010028
Jon Medhurstaaf37a32013-06-11 12:10:56 +010029struct ImageLinkList {
30 char* path;
31 struct ImageLinkList *next;
32};
33
34class SessionData {
35public:
36 static const size_t MAX_STRING_LEN = 80;
37
38 SessionData();
39 ~SessionData();
40 void initialize();
41 void parseSessionXML(char* xmlString);
Jon Medhurst96b56152014-10-30 18:01:15 +000042 void readModel();
Jon Medhurste31266f2014-08-04 15:47:44 +010043 void readCpuInfo();
Jon Medhurstaaf37a32013-06-11 12:10:56 +010044
Jon Medhurstb1d07442015-05-08 12:04:18 +010045 PolledDriver *usDrivers[5];
Jon Medhurst96b56152014-10-30 18:01:15 +000046 KMod kmod;
Jon Medhurst15ce78d2014-04-10 09:02:02 +010047 PerfDriver perf;
Jon Medhurste31266f2014-08-04 15:47:44 +010048 MaliVideoDriver maliVideo;
Jon Medhurst96b56152014-10-30 18:01:15 +000049 FtraceDriver ftraceDriver;
Jon Medhurstaaf37a32013-06-11 12:10:56 +010050
51 char mCoreName[MAX_STRING_LEN];
52 struct ImageLinkList *mImages;
Jon Medhurst96b56152014-10-30 18:01:15 +000053 char *mConfigurationXMLPath;
54 char *mSessionXMLPath;
55 char *mEventsXMLPath;
Jon Medhurstb1d07442015-05-08 12:04:18 +010056 char *mEventsXMLAppend;
Jon Medhurst96b56152014-10-30 18:01:15 +000057 char *mTargetPath;
58 char *mAPCDir;
59 char *mCaptureWorkingDir;
60 char *mCaptureCommand;
61 char *mCaptureUser;
Jon Medhurstaaf37a32013-06-11 12:10:56 +010062
63 bool mWaitingOnCommand;
64 bool mSessionIsActive;
65 bool mLocalCapture;
Jon Medhurst96b56152014-10-30 18:01:15 +000066 // halt processing of the driver data until profiling is complete or the buffer is filled
67 bool mOneShot;
Jon Medhurst15ce78d2014-04-10 09:02:02 +010068 bool mIsEBS;
Jon Medhurste31266f2014-08-04 15:47:44 +010069 bool mSentSummary;
Jon Medhurst96b56152014-10-30 18:01:15 +000070 bool mAllowCommands;
Jon Medhurste31266f2014-08-04 15:47:44 +010071
Jon Medhurst96b56152014-10-30 18:01:15 +000072 int64_t mMonotonicStarted;
Jon Medhurstaaf37a32013-06-11 12:10:56 +010073 int mBacktraceDepth;
Jon Medhurst96b56152014-10-30 18:01:15 +000074 // number of MB to use for the entire collection buffer
75 int mTotalBufferSize;
Jon Medhurstaaf37a32013-06-11 12:10:56 +010076 int mSampleRate;
77 int64_t mLiveRate;
78 int mDuration;
79 int mCores;
Jon Medhurst15ce78d2014-04-10 09:02:02 +010080 int mPageSize;
Jon Medhurste31266f2014-08-04 15:47:44 +010081 int *mCpuIds;
Jon Medhurst15ce78d2014-04-10 09:02:02 +010082 int mMaxCpuId;
Jon Medhurstb1d07442015-05-08 12:04:18 +010083 int mAnnotateStart;
Jon Medhurstaaf37a32013-06-11 12:10:56 +010084
85 // PMU Counters
86 int mCounterOverflow;
87 Counter mCounters[MAX_PERFORMANCE_COUNTERS];
88
89private:
Jon Medhurst34d97692013-12-19 09:23:06 +000090 // Intentionally unimplemented
91 SessionData(const SessionData &);
92 SessionData &operator=(const SessionData &);
Jon Medhurstaaf37a32013-06-11 12:10:56 +010093};
94
95extern SessionData* gSessionData;
Jon Medhurstb1d07442015-05-08 12:04:18 +010096extern const char *const gSrcMd5;
Jon Medhurstaaf37a32013-06-11 12:10:56 +010097
Jon Medhurste31266f2014-08-04 15:47:44 +010098uint64_t getTime();
Jon Medhurstaaf37a32013-06-11 12:10:56 +010099int getEventKey();
Jon Medhurst96b56152014-10-30 18:01:15 +0000100int pipe_cloexec(int pipefd[2]);
101FILE *fopen_cloexec(const char *path, const char *mode);
Jon Medhurstaaf37a32013-06-11 12:10:56 +0100102
103#endif // SESSION_DATA_H