PCPDynamicMeter.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef HEADER_PCPDynamicMeter
  2. #define HEADER_PCPDynamicMeter
  3. /*
  4. htop - PCPDynamicMeter.h
  5. (C) 2023 htop dev team
  6. Released under the GNU GPLv2+, see the COPYING file
  7. in the source distribution for its full text.
  8. */
  9. #include <stddef.h>
  10. #include "CRT.h"
  11. #include "DynamicMeter.h"
  12. #include "Hashtable.h"
  13. #include "Meter.h"
  14. #include "RichString.h"
  15. typedef struct PCPDynamicMetric_ {
  16. size_t id; /* index into metric array */
  17. ColorElements color;
  18. char* name; /* derived metric name */
  19. char* label;
  20. char* suffix;
  21. } PCPDynamicMetric;
  22. typedef struct PCPDynamicMeter_ {
  23. DynamicMeter super;
  24. PCPDynamicMetric* metrics;
  25. size_t totalMetrics;
  26. } PCPDynamicMeter;
  27. typedef struct PCPDynamicMeters_ {
  28. Hashtable* table;
  29. size_t count; /* count of dynamic meters discovered by scan */
  30. size_t offset; /* start offset into the Platform metric array */
  31. size_t cursor; /* identifier allocator for each new metric used */
  32. } PCPDynamicMeters;
  33. void PCPDynamicMeters_init(PCPDynamicMeters* meters);
  34. void PCPDynamicMeters_done(Hashtable* table);
  35. void PCPDynamicMeter_enable(PCPDynamicMeter* this);
  36. void PCPDynamicMeter_updateValues(PCPDynamicMeter* this, Meter* meter);
  37. void PCPDynamicMeter_display(PCPDynamicMeter* this, const Meter* meter, RichString* out);
  38. #endif