gator: Version 5.18
[firefly-linux-kernel-4.4.55.git] / tools / gator / daemon / PerfSource.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 PERFSOURCE_H
10 #define PERFSOURCE_H
11
12 #include <semaphore.h>
13
14 #include "Buffer.h"
15 #include "Monitor.h"
16 #include "PerfBuffer.h"
17 #include "PerfGroup.h"
18 #include "Source.h"
19 #include "UEvent.h"
20
21 class Sender;
22
23 class PerfSource : public Source {
24 public:
25         PerfSource(sem_t *senderSem, sem_t *startProfile);
26         ~PerfSource();
27
28         bool prepare();
29         void run();
30         void interrupt();
31
32         bool isDone();
33         void write(Sender *sender);
34
35 private:
36         bool handleUEvent();
37
38         Buffer mSummary;
39         Buffer mBuffer;
40         PerfBuffer mCountersBuf;
41         PerfGroup mCountersGroup;
42         Monitor mMonitor;
43         UEvent mUEvent;
44         sem_t *const mSenderSem;
45         sem_t *const mStartProfile;
46         int mInterruptFd;
47         bool mIsDone;
48
49         // Intentionally undefined
50         PerfSource(const PerfSource &);
51         PerfSource &operator=(const PerfSource &);
52 };
53
54 #endif // PERFSOURCE_H