From e7372d18a1a661d8c3dba9f51e1f17b5f94171a7 Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Wed, 10 Jan 2024 11:17:08 +0100 Subject: New upstream version 3.3.0 --- Meter.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'Meter.h') 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 #include #include #include #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); -- cgit v1.2.3