blob: ed282af4a869d9b34913dfec4f6fa61c095d3eec [file] [log] [blame]
Jon Medhurstaaf37a32013-06-11 12:10:56 +01001/**
Jon Medhurst15ce78d2014-04-10 09:02:02 +01002 * Copyright (C) ARM Limited 2010-2014. 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 Medhurst96b56152014-10-30 18:01:15 +000014#include "AnnotateListener.h"
Jon Medhurst15ce78d2014-04-10 09:02:02 +010015#include "Config.h"
Jon Medhurstaaf37a32013-06-11 12:10:56 +010016#include "Counter.h"
Jon Medhurst96b56152014-10-30 18:01:15 +000017#include "FtraceDriver.h"
18#include "KMod.h"
Jon Medhurste31266f2014-08-04 15:47:44 +010019#include "MaliVideoDriver.h"
Jon Medhurst15ce78d2014-04-10 09:02:02 +010020#include "PerfDriver.h"
Jon Medhurstaaf37a32013-06-11 12:10:56 +010021
Jon Medhurst96b56152014-10-30 18:01:15 +000022#define PROTOCOL_VERSION 20
23// Differentiates development versions (timestamp) from release versions
24#define PROTOCOL_DEV 1000
Jon Medhurstaaf37a32013-06-11 12:10:56 +010025
Jon Medhurst96b56152014-10-30 18:01:15 +000026#define NS_PER_S 1000000000LL
27#define NS_PER_MS 1000000LL
28#define NS_PER_US 1000LL
Jon Medhurste31266f2014-08-04 15:47:44 +010029
Jon Medhurstaaf37a32013-06-11 12:10:56 +010030struct ImageLinkList {
31 char* path;
32 struct ImageLinkList *next;
33};
34
35class SessionData {
36public:
37 static const size_t MAX_STRING_LEN = 80;
38
39 SessionData();
40 ~SessionData();
41 void initialize();
42 void parseSessionXML(char* xmlString);
Jon Medhurst96b56152014-10-30 18:01:15 +000043 void readModel();
Jon Medhurste31266f2014-08-04 15:47:44 +010044 void readCpuInfo();
Jon Medhurstaaf37a32013-06-11 12:10:56 +010045
Jon Medhurst96b56152014-10-30 18:01:15 +000046 PolledDriver *usDrivers[6];
47 KMod kmod;
Jon Medhurst15ce78d2014-04-10 09:02:02 +010048 PerfDriver perf;
Jon Medhurste31266f2014-08-04 15:47:44 +010049 MaliVideoDriver maliVideo;
Jon Medhurst96b56152014-10-30 18:01:15 +000050 FtraceDriver ftraceDriver;
51 AnnotateListener annotateListener;
Jon Medhurstaaf37a32013-06-11 12:10:56 +010052
53 char mCoreName[MAX_STRING_LEN];
54 struct ImageLinkList *mImages;
Jon Medhurst96b56152014-10-30 18:01:15 +000055 char *mConfigurationXMLPath;
56 char *mSessionXMLPath;
57 char *mEventsXMLPath;
58 char *mTargetPath;
59 char *mAPCDir;
60 char *mCaptureWorkingDir;
61 char *mCaptureCommand;
62 char *mCaptureUser;
Jon Medhurstaaf37a32013-06-11 12:10:56 +010063
64 bool mWaitingOnCommand;
65 bool mSessionIsActive;
66 bool mLocalCapture;
Jon Medhurst96b56152014-10-30 18:01:15 +000067 // halt processing of the driver data until profiling is complete or the buffer is filled
68 bool mOneShot;
Jon Medhurst15ce78d2014-04-10 09:02:02 +010069 bool mIsEBS;
Jon Medhurste31266f2014-08-04 15:47:44 +010070 bool mSentSummary;
Jon Medhurst96b56152014-10-30 18:01:15 +000071 bool mAllowCommands;
Jon Medhurste31266f2014-08-04 15:47:44 +010072
Jon Medhurst96b56152014-10-30 18:01:15 +000073 int64_t mMonotonicStarted;
Jon Medhurstaaf37a32013-06-11 12:10:56 +010074 int mBacktraceDepth;
Jon Medhurst96b56152014-10-30 18:01:15 +000075 // number of MB to use for the entire collection buffer
76 int mTotalBufferSize;
Jon Medhurstaaf37a32013-06-11 12:10:56 +010077 int mSampleRate;
78 int64_t mLiveRate;
79 int mDuration;
80 int mCores;
Jon Medhurst15ce78d2014-04-10 09:02:02 +010081 int mPageSize;
Jon Medhurste31266f2014-08-04 15:47:44 +010082 int *mCpuIds;
Jon Medhurst15ce78d2014-04-10 09:02:02 +010083 int mMaxCpuId;
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;
96
Jon Medhurste31266f2014-08-04 15:47:44 +010097uint64_t getTime();
Jon Medhurstaaf37a32013-06-11 12:10:56 +010098int getEventKey();
Jon Medhurst96b56152014-10-30 18:01:15 +000099int pipe_cloexec(int pipefd[2]);
100FILE *fopen_cloexec(const char *path, const char *mode);
Jon Medhurstaaf37a32013-06-11 12:10:56 +0100101
102#endif // SESSION_DATA_H