MINOR: stats: add stat_col flags

Add stat_col flags member to store .generic bit and prepare for upcoming
flags. No functional change expected.
This commit is contained in:
Aurelien DARRAGON 2025-04-08 11:56:23 +02:00
parent f0b40b49b8
commit d04843167c
3 changed files with 10 additions and 6 deletions

View File

@ -342,6 +342,10 @@ enum stat_idx_info {
ST_I_INF_MAX
};
/* Flags for stat_col.flags */
#define STAT_COL_FL_NONE 0x00
#define STAT_COL_FL_GENERIC 0x01 /* stat is generic if set */
/* Represent an exposed statistic. */
struct stat_col {
const char *name; /* short name, used notably in CSV headers */
@ -350,8 +354,8 @@ struct stat_col {
uint32_t type; /* combination of field_nature and field_format */
uint8_t cap; /* mask of stats_domain_px_cap to restrain metrics to an object types subset */
uint8_t generic; /* bit set if generic */
/* 2 bytes hole */
/* 1 byte hole */
uint16_t flags; /* STAT_COL_FL_* flags */
/* used only for generic metrics */
struct {

View File

@ -79,7 +79,7 @@ int stats_emit_field_tags(struct buffer *out, const struct field *f,
/* Returns true if <col> is fully defined, false if only used as name-desc. */
static inline int stcol_is_generic(const struct stat_col *col)
{
return col->generic;
return col->flags & STAT_COL_FL_GENERIC;
}
static inline enum field_format stcol_format(const struct stat_col *col)

View File

@ -25,7 +25,7 @@
.metric.offset[0] = offsetof(struct fe_counters, offset_f), \
.metric.offset[1] = offsetof(struct be_counters, offset_f), \
.cap = (cap_f), \
.generic = 1, \
.flags = STAT_COL_FL_GENERIC, \
.alt_name = alt_n, \
}
@ -34,7 +34,7 @@
{ .name = (name_f), .desc = (desc_f), .type = (nature)|(format), \
.metric.offset[0] = offsetof(struct fe_counters, offset_f), \
.cap = (cap_f), \
.generic = 1, \
.flags = STAT_COL_FL_GENERIC, \
.alt_name = alt_n, \
}
@ -43,7 +43,7 @@
{ .name = (name_f), .desc = (desc_f), .type = (nature)|(format), \
.metric.offset[1] = offsetof(struct be_counters, offset_f), \
.cap = (cap_f), \
.generic = 1, \
.flags = STAT_COL_FL_GENERIC, \
.alt_name = alt_n, \
}