summaryrefslogtreecommitdiff
path: root/tools/gator/daemon/PerfSource.h
blob: a7d98ecf5196dfde1bd2f0ec271235d2c4b49887 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
 * Copyright (C) ARM Limited 2010-2016. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#ifndef PERFSOURCE_H
#define PERFSOURCE_H

#include <semaphore.h>

#include "Buffer.h"
#include "Monitor.h"
#include "PerfBuffer.h"
#include "PerfGroup.h"
#include "Source.h"
#include "UEvent.h"

class Sender;

class PerfSource : public Source {
public:
	PerfSource(sem_t *senderSem, sem_t *startProfile);
	~PerfSource();

	bool prepare();
	void run();
	void interrupt();

	bool isDone();
	void write(Sender *sender);

private:
	bool handleUEvent(const uint64_t currTime);

	Buffer mSummary;
	Buffer *mBuffer;
	PerfBuffer mCountersBuf;
	PerfGroup mCountersGroup;
	Monitor mMonitor;
	UEvent mUEvent;
	sem_t *const mSenderSem;
	sem_t *const mStartProfile;
	int mInterruptFd;
	bool mIsDone;

	// Intentionally undefined
	PerfSource(const PerfSource &);
	PerfSource &operator=(const PerfSource &);
};

#endif // PERFSOURCE_H