mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
cb1c002bed
In tabular output, chpstat adds an additional space between columns of different groups (e.g. between READ and WRITE data). Currently this is done by increasing the column width of the first column in a group. Depending on the value displayed in this first column of a group, the spacing may vanish, and under certain circumstances, the precision of auto-scaled *_PART columns may be higher than the precision of the related *_TOTAL columns, resulting in a confusing view. Example: DPU READ(B/s) WRITE(B/s) ID PART TOTAL PART TOTAL 6 10.7M 10.7M 10.8M 10.8M 6 0.00 11.3K 0.00 0.00 ^^ ^^ Fix this by consistently adding padding between column groups without increasing the column width of the first column of a group. Also ensure the same width for *_PART and *_TOTAL columns. 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>
91 lines
1.8 KiB
C
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, char suffix_char);
|
|
void column_exit(void);
|
|
|
|
#endif /* COLUMN_H */
|