aboutsummaryrefslogtreecommitdiffstats
path: root/Meter.h
diff options
context:
space:
mode:
Diffstat (limited to 'Meter.h')
-rw-r--r--Meter.h19
1 files changed, 10 insertions, 9 deletions
diff --git a/Meter.h b/Meter.h
index bd7604a..17d77f3 100644
--- a/Meter.h
+++ b/Meter.h
@@ -7,20 +7,18 @@ Released under the GNU GPLv2+, see the COPYING file
in the source distribution for its full text.
*/
-#include "config.h" // IWYU pragma: keep
-
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <sys/time.h>
#include "ListItem.h"
+#include "Machine.h"
#include "Object.h"
-#include "ProcessList.h"
#define METER_TXTBUFFER_LEN 256
-#define METER_GRAPHDATA_SIZE 256
+#define MAX_METER_GRAPHDATA_VALUES 32768
#define METER_BUFFER_CHECK(buffer, size, written) \
do { \
@@ -97,20 +95,21 @@ typedef struct MeterClass_ {
typedef struct GraphData_ {
struct timeval time;
- double values[METER_GRAPHDATA_SIZE];
+ size_t nValues;
+ double* values;
} GraphData;
struct Meter_ {
Object super;
Meter_Draw draw;
+ const Machine* host;
char* caption;
int mode;
unsigned int param;
- GraphData* drawData;
+ GraphData drawData;
int h;
int columnWidthCount; /**< only used internally by the Header */
- const ProcessList* pl;
uint8_t curItems;
const int* curAttributes;
char txtBuffer[METER_TXTBUFFER_LEN];
@@ -143,9 +142,11 @@ typedef enum {
extern const MeterClass Meter_class;
-Meter* Meter_new(const ProcessList* pl, unsigned int param, const MeterClass* type);
+Meter* Meter_new(const Machine* host, unsigned int param, const MeterClass* type);
-int Meter_humanUnit(char* buffer, unsigned long int value, size_t size);
+/* Converts 'value' in kibibytes into a human readable string.
+ Example output strings: "0K", "1023K", "98.7M" and "1.23G" */
+int Meter_humanUnit(char* buffer, double value, size_t size);
void Meter_delete(Object* cast);

© 2014-2024 Faster IT GmbH | imprint | privacy policy