PerfSensorGroup.h 1.12 KB
Newer Older
1
/*
2
 * PerfSensorGroup.h
3
4
5
6
7
 *
 *  Created on: 04.08.2018
 *      Author: Micha Mueller
 */

8
9
#ifndef PERFSENSORGROUP_H_
#define PERFSENSORGROUP_H_
10

11
#include "../../includes/SensorGroupTemplate.h"
12
#include "PerfSensorBase.h"
13

14
class PerfSensorGroup : public SensorGroupTemplate<PerfSensorBase> {
15
public:
16
	PerfSensorGroup(const std::string& name);
17
	virtual ~PerfSensorGroup();
18

19
20
21
	void init(boost::asio::io_service& io) override;
	void start() override;
	void stop() override;
22

23
24
25
26
27
28
	int		getCpuId() 				const	{ return _cpuId; }

	void setCpuId(int cpuId) 							{ _cpuId = cpuId; }
	void setSensorGroupLeader(bool sensorGroupLeader) { _sensorGroupLeader = sensorGroupLeader; }

	void pushBackGroup(PerfSensorGroup* perfGroup) { _fellowSensorGroups.push_back(perfGroup); }
29

30
private:
31
32
33
	void read() override;
	void readAsync() override;

34
35
36
	//are we the sensorGroupLeader?
	bool _sensorGroupLeader;

37
	int	_cpuId;
38
39
	int	_group_fd;
	std::vector<int> _fds;
40

41
42
43
	char *	_buf;
	std::size_t	_bufSize;
	std::vector<uint64_t>	_ids;
44
45
46

	//the sensorGroupLeader stores attached groups in here
	std::vector<PerfSensorGroup*> _fellowSensorGroups;
47
48
};

49
#endif /* PERFSENSORGROUP_H_ */