aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libosmocore/include/osmocore/rate_ctr.h8
-rw-r--r--libosmocore/src/rate_ctr.c4
2 files changed, 5 insertions, 7 deletions
diff --git a/libosmocore/include/osmocore/rate_ctr.h b/libosmocore/include/osmocore/rate_ctr.h
index c6a1ace2f..88c9de5a6 100644
--- a/libosmocore/include/osmocore/rate_ctr.h
+++ b/libosmocore/include/osmocore/rate_ctr.h
@@ -33,8 +33,8 @@ struct rate_ctr_desc {
/* Describe a counter group class */
struct rate_ctr_group_desc {
- /* The prefix / format string to be used for all counters */
- char *group_prefix_fmt;
+ /* The prefix to the name of all counters in this group */
+ char *group_name_prefix;
/* The human-readable description of the group */
char *group_description;
/* The number of counters in this group */
@@ -49,8 +49,8 @@ struct rate_ctr_group {
struct llist_head list;
/* Pointer to the counter group class */
const struct rate_ctr_group_desc *desc;
- /* The name prefix generated from desc->group_prefix_fmt and index */
- char *name_prefix;
+ /* The index of this ctr_group within its class */
+ unsigned int idx;
/* Actual counter structures below */
struct rate_ctr ctr[0];
};
diff --git a/libosmocore/src/rate_ctr.c b/libosmocore/src/rate_ctr.c
index 9b2459e89..e48c77928 100644
--- a/libosmocore/src/rate_ctr.c
+++ b/libosmocore/src/rate_ctr.c
@@ -51,9 +51,7 @@ struct rate_ctr_group *rate_ctr_group_alloc(void *ctx,
return NULL;
group->desc = desc;
- /* Generate the Group prefix from the user-specified index */
- group->name_prefix = talloc_size(group, strlen(desc->group_prefix_fmt) + 20);
- sprintf(group->name_prefix, desc->group_prefix_fmt, idx);
+ group->idx = idx;
llist_add(&group->list, &rate_ctr_groups);