PCPDynamicColumn.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef HEADER_PCPDynamicColumn
  2. #define HEADER_PCPDynamicColumn
  3. /*
  4. htop - PCPDynamicColumn.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 "DynamicColumn.h"
  11. #include "Hashtable.h"
  12. #include "Process.h"
  13. #include "RichString.h"
  14. #include "pcp/PCPProcess.h"
  15. struct pmDesc;
  16. typedef struct PCPDynamicColumn_ {
  17. DynamicColumn super;
  18. char* metricName;
  19. char* format;
  20. size_t id; /* identifier for metric array lookups */
  21. int width; /* optional width from configuration file */
  22. bool defaultEnabled; /* default enabled in dynamic screen */
  23. bool percent;
  24. bool instances; /* an instance *names* column, not values */
  25. } PCPDynamicColumn;
  26. typedef struct PCPDynamicColumns_ {
  27. Hashtable* table;
  28. size_t count; /* count of dynamic columns discovered by scan */
  29. size_t offset; /* start offset into the Platform metric array */
  30. size_t cursor; /* identifier allocator for each new metric used */
  31. } PCPDynamicColumns;
  32. void PCPDynamicColumns_init(PCPDynamicColumns* columns);
  33. void PCPDynamicColumns_done(Hashtable* table);
  34. void PCPDynamicColumns_setupWidths(PCPDynamicColumns* columns);
  35. void PCPDynamicColumn_writeField(PCPDynamicColumn* this, const Process* proc, RichString* str);
  36. void PCPDynamicColumn_writeAtomValue(PCPDynamicColumn* column, RichString* str, const struct Settings_* settings, int metric, int instance, const struct pmDesc* desc, const void* atomvalue);
  37. int PCPDynamicColumn_compareByKey(const PCPProcess* p1, const PCPProcess* p2, ProcessField key);
  38. void PCPDynamicColumn_done(PCPDynamicColumn* this);
  39. #endif