Jon Medhurst | aaf37a3 | 2013-06-11 12:10:56 +0100 | [diff] [blame] | 1 | /** |
Jon Medhurst | 15ce78d | 2014-04-10 09:02:02 +0100 | [diff] [blame] | 2 | * Copyright (C) ARM Limited 2013-2014. All rights reserved. |
Jon Medhurst | aaf37a3 | 2013-06-11 12:10:56 +0100 | [diff] [blame] | 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 COUNTER_H |
| 10 | #define COUNTER_H |
| 11 | |
| 12 | #include <string.h> |
| 13 | |
| 14 | class Driver; |
| 15 | |
| 16 | class Counter { |
| 17 | public: |
| 18 | static const size_t MAX_STRING_LEN = 80; |
| 19 | static const size_t MAX_DESCRIPTION_LEN = 400; |
| 20 | |
| 21 | Counter () { |
| 22 | clear(); |
| 23 | } |
| 24 | |
| 25 | void clear () { |
| 26 | mType[0] = '\0'; |
| 27 | mEnabled = false; |
Jon Medhurst | 15ce78d | 2014-04-10 09:02:02 +0100 | [diff] [blame] | 28 | mEvent = -1; |
Jon Medhurst | aaf37a3 | 2013-06-11 12:10:56 +0100 | [diff] [blame] | 29 | mCount = 0; |
Jon Medhurst | e31266f | 2014-08-04 15:47:44 +0100 | [diff] [blame^] | 30 | mCores = -1; |
Jon Medhurst | aaf37a3 | 2013-06-11 12:10:56 +0100 | [diff] [blame] | 31 | mKey = 0; |
| 32 | mDriver = NULL; |
| 33 | } |
| 34 | |
| 35 | void setType(const char *const type) { strncpy(mType, type, sizeof(mType)); mType[sizeof(mType) - 1] = '\0'; } |
| 36 | void setEnabled(const bool enabled) { mEnabled = enabled; } |
| 37 | void setEvent(const int event) { mEvent = event; } |
| 38 | void setCount(const int count) { mCount = count; } |
Jon Medhurst | e31266f | 2014-08-04 15:47:44 +0100 | [diff] [blame^] | 39 | void setCores(const int cores) { mCores = cores; } |
Jon Medhurst | aaf37a3 | 2013-06-11 12:10:56 +0100 | [diff] [blame] | 40 | void setKey(const int key) { mKey = key; } |
| 41 | void setDriver(Driver *const driver) { mDriver = driver; } |
| 42 | |
| 43 | const char *getType() const { return mType;} |
| 44 | bool isEnabled() const { return mEnabled; } |
| 45 | int getEvent() const { return mEvent; } |
| 46 | int getCount() const { return mCount; } |
Jon Medhurst | e31266f | 2014-08-04 15:47:44 +0100 | [diff] [blame^] | 47 | int getCores() const { return mCores; } |
Jon Medhurst | aaf37a3 | 2013-06-11 12:10:56 +0100 | [diff] [blame] | 48 | int getKey() const { return mKey; } |
| 49 | Driver *getDriver() const { return mDriver; } |
| 50 | |
| 51 | private: |
| 52 | // Intentionally unimplemented |
| 53 | Counter(const Counter &); |
| 54 | Counter & operator=(const Counter &); |
| 55 | |
| 56 | char mType[MAX_STRING_LEN]; |
| 57 | bool mEnabled; |
| 58 | int mEvent; |
| 59 | int mCount; |
Jon Medhurst | e31266f | 2014-08-04 15:47:44 +0100 | [diff] [blame^] | 60 | int mCores; |
Jon Medhurst | aaf37a3 | 2013-06-11 12:10:56 +0100 | [diff] [blame] | 61 | int mKey; |
| 62 | Driver *mDriver; |
| 63 | }; |
| 64 | |
| 65 | #endif // COUNTER_H |