diff options
author | Daniel Lange <DLange@git.local> | 2024-01-10 11:17:08 +0100 |
---|---|---|
committer | Daniel Lange <DLange@git.local> | 2024-01-10 11:17:08 +0100 |
commit | e7372d18a1a661d8c3dba9f51e1f17b5f94171a7 (patch) | |
tree | e8270dd60ec096bee8157dbadf029e15ed584592 /Meter.h | |
parent | 937052b231259a47d881d539ad5748245ef55b99 (diff) | |
download | debian_htop-e7372d18a1a661d8c3dba9f51e1f17b5f94171a7.tar.gz debian_htop-e7372d18a1a661d8c3dba9f51e1f17b5f94171a7.tar.bz2 debian_htop-e7372d18a1a661d8c3dba9f51e1f17b5f94171a7.zip |
New upstream version 3.3.0
Diffstat (limited to 'Meter.h')
-rw-r--r-- | Meter.h | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -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); |