blob: 278a3b9d6db7d0a117be461a42a6d1eab6374219 [file] [log] [blame]
Jon Medhurst15ce78d2014-04-10 09:02:02 +01001/**
2 * Copyright (C) ARM Limited 2013-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 PERF_BUFFER
10#define PERF_BUFFER
11
12#include "Config.h"
13
14#define BUF_SIZE (gSessionData->mTotalBufferSize * 1024 * 1024)
15#define BUF_MASK (BUF_SIZE - 1)
16
17class Sender;
18
19class PerfBuffer {
20public:
21 PerfBuffer();
22 ~PerfBuffer();
23
24 bool useFd(const int cpu, const int fd, const int groupFd);
25 void discard(const int cpu);
26 bool isEmpty();
27 bool send(Sender *const sender);
28
29private:
30 void *mBuf[NR_CPUS];
31 // After the buffer is flushed it should be unmaped
32 bool mDiscard[NR_CPUS];
33
34 // Intentionally undefined
35 PerfBuffer(const PerfBuffer &);
36 PerfBuffer &operator=(const PerfBuffer &);
37};
38
39#endif // PERF_BUFFER