Files
s390-tools/zconf/chp/chpstat/column.h
Peter Oberparleiter d15e36cf24 chpstat: Add options to select IEC units for scaling
Add options to select power-of-two based IEC units such as KiB/s
(1024 B/s) for scaling throughput values in human readable reports.

Option            Scaling factor
================================
--scale ki        1024
--scale mi        1048576
--scale gi        1073741824
--scale auto-iec  IEC units

Reviewed-by: Jimmy Brisson <jbrisson@linux.ibm.com>
Reviewed-by: Vineeth Vijayan <vneethv@linux.ibm.com>
Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2025-09-15 11:12:15 +02:00

91 lines
1.8 KiB
C

/*
* Registry for supported table columns
*
* Copyright IBM Corp. 2024
*
* s390-tools is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
*/
#ifndef COLUMN_H
#define COLUMN_H
#include <stdbool.h>
enum column_id_t {
COL_NONE = -1,
COL_CHPID,
COL_TYPE,
COL_CMG,
COL_SHARED,
COL_SPEED,
COL_INTERVAL,
COL_TIMESTAMP,
COL_UTIL_PART,
COL_UTIL_TOTAL,
COL_UTIL_BUS,
COL_UTIL_DATA,
COL_READ_PART,
COL_READ_TOTAL,
COL_WRITE_PART,
COL_WRITE_TOTAL,
COL_FICON_RATE,
COL_FICON_ACTIVE,
COL_FICON_DEFER,
COL_HPF_RATE,
COL_HPF_ACTIVE,
COL_HPF_DEFER,
COL_MSG_RATE_PART,
COL_MSG_RATE_TOTAL,
COL_MSG_SIZE_PART,
COL_MSG_SIZE_TOTAL,
COL_SEND_FAIL_PART,
COL_RCV_FAIL_PART,
COL_RCV_FAIL_TOTAL,
COL_DPU_ID,
COL_DPU_UTIL_PART,
COL_DPU_UTIL_TOTAL,
COL_DPU_UTIL,
/* Special value indicating no column. */
COL_END
};
enum col_unit_t {
COL_OTHER,
COL_NUMBER,
COL_PERCENT,
COL_BPS,
};
struct column_t {
enum column_id_t id;
const char *name;
enum col_unit_t unit;
const char *desc;
const char *hdr2;
const char *hdr1_single;
char *hdr1_group;
unsigned int width;
unsigned int pad;
};
#define column_for_each(c) \
for (unsigned int __i = 0; ((c) = column_get_by_index(__i, false)); \
__i++)
#define column_for_each_selected(c) \
for (unsigned int __i = 0; ((c) = column_get_by_index(__i, true)); \
__i++)
struct column_t *column_get_by_index(unsigned int i, bool selected);
struct column_t *column_get_by_name(const char *name);
void column_select(struct column_t *col);
void column_select_id_list(const int *ids);
void column_select_default(void);
void column_select_all(void);
void column_update_bps_suffix(bool auto_scale, bool iec, char suffix_char);
void column_exit(void);
#endif /* COLUMN_H */