Jon Medhurst | 15ce78d | 2014-04-10 09:02:02 +0100 | [diff] [blame^] | 1 | /** |
| 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 | |
| 17 | class Sender; |
| 18 | |
| 19 | class PerfBuffer { |
| 20 | public: |
| 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 | |
| 29 | private: |
| 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 |