Merge remote-tracking branch 'lsk/v3.10/topic/arm64-perf' into linux-linaro-lsk
[firefly-linux-kernel-4.4.55.git] / tools / gator / daemon / ExternalSource.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 EXTERNALSOURCE_H
10 #define EXTERNALSOURCE_H
11
12 #include <semaphore.h>
13
14 #include "Buffer.h"
15 #include "OlySocket.h"
16 #include "Source.h"
17
18 // Unix domain socket counters from external sources like graphics drivers
19 class ExternalSource : public Source {
20 public:
21         ExternalSource(sem_t *senderSem);
22         ~ExternalSource();
23
24         bool prepare();
25         void run();
26         void interrupt();
27
28         bool isDone();
29         void write(Sender *sender);
30
31 private:
32         Buffer mBuffer;
33         OlySocket mSock;
34
35         // Intentionally unimplemented
36         ExternalSource(const ExternalSource &);
37         ExternalSource &operator=(const ExternalSource &);
38 };
39
40 #endif // EXTERNALSOURCE_H