24 #ifndef STATS_CLUSTER_H_INCLUDED
25 #define STATS_CLUSTER_H_INCLUDED 1
49 typedef enum _StatsClusterUnit
65 typedef enum _StatsClusterFrameOfReference
86 gboolean (*
get_type_label)(StatsCounterGroup *
self, gint type, StatsClusterLabel *label);
97 void (*
init)(StatsCounterGroupInit *
self, StatsCounterGroup *counter_group);
98 gboolean (*
equals)(
const StatsCounterGroupInit *
self,
const StatsCounterGroupInit *other);
99 void (*
clone)(StatsCounterGroupInit *dst,
const StatsCounterGroupInit *src);
113 static inline StatsClusterLabel
114 stats_cluster_label(
const gchar *
name,
const gchar *
value)
116 return (StatsClusterLabel)
154 typedef struct _StatsCluster
187 static inline gboolean
190 return self->use_count == 0;
193 static inline gboolean
194 stats_cluster_get_type_label(
StatsCluster *
self, gint type, StatsClusterLabel *label)
196 if (!
self->counter_group.get_type_label)
199 return self->counter_group.get_type_label(&
self->counter_group, type, label);
207 StatsCounterGroupInit counter_group_ctor);
209 StatsCounterGroupInit counter_group_ctor);
211 const gchar *instance,
212 StatsCounterGroupInit counter_group_ctor);
214 static inline gboolean
215 stats_cluster_key_is_legacy(
const StatsClusterKey *
self)
217 return self->legacy.set;
219 static inline gboolean
220 stats_cluster_key_legacy_id_equal(
const StatsClusterKey *
self,
const gchar *
id)
222 return g_strcmp0(
self->legacy.id,
id) == 0;
const gchar * name
Definition: debugger.c:265
#define self
Definition: rcptid.c:38
const gchar * stats_cluster_get_component_name(StatsCluster *self, gchar *buf, gsize buf_len)
Definition: stats-cluster.c:264
StatsClusterKey * stats_cluster_key_clone(StatsClusterKey *dst, const StatsClusterKey *src)
Definition: stats-cluster.c:140
guint stats_cluster_key_hash(const StatsClusterKey *self)
Definition: stats-cluster.c:319
void stats_cluster_free(StatsCluster *self)
Definition: stats-cluster.c:462
StatsClusterUnit
Definition: stats-cluster.h:50
@ SCU_MINUTES
Definition: stats-cluster.h:54
@ SCU_MILLISECONDS
Definition: stats-cluster.h:56
@ SCU_NANOSECONDS
Definition: stats-cluster.h:57
@ SCU_HOURS
Definition: stats-cluster.h:55
@ SCU_SECONDS
Definition: stats-cluster.h:53
@ SCU_NONE
Definition: stats-cluster.h:51
@ SCU_KIB
Definition: stats-cluster.h:60
@ SCU_BYTES
Definition: stats-cluster.h:59
@ SCU_MIB
Definition: stats-cluster.h:61
@ SCU_GIB
Definition: stats-cluster.h:62
void stats_cluster_key_add_legacy_alias(StatsClusterKey *self, guint16 component, const gchar *id, const gchar *instance, StatsCounterGroupInit counter_group_ctor)
Definition: stats-cluster.c:198
gboolean stats_cluster_key_equal(const StatsClusterKey *key1, const StatsClusterKey *key2)
Definition: stats-cluster.c:300
void stats_cluster_key_legacy_set(StatsClusterKey *self, guint16 component, const gchar *id, const gchar *instance, StatsCounterGroupInit counter_group_ctor)
Definition: stats-cluster.c:187
void stats_cluster_reset_counter_if_needed(StatsCluster *sc, StatsCounterItem *counter)
Definition: stats-cluster.c:391
StatsCluster * stats_cluster_dynamic_new(const StatsClusterKey *key)
Definition: stats-cluster.c:439
void(* StatsForeachCounterFunc)(StatsCluster *sc, gint type, StatsCounterItem *counter, gpointer user_data)
Definition: stats-cluster.h:164
void stats_counter_group_free(StatsCounterGroup *self)
Definition: stats-cluster.c:448
StatsCluster * stats_cluster_new(const StatsClusterKey *key)
Definition: stats-cluster.c:426
void stats_cluster_key_cloned_free(StatsClusterKey *self)
Definition: stats-cluster.c:205
StatsClusterFrameOfReference
Definition: stats-cluster.h:66
@ SCFOR_NONE
Definition: stats-cluster.h:67
@ SCFOR_ABSOLUTE
Definition: stats-cluster.h:68
@ SCFOR_RELATIVE_TO_TIME_OF_QUERY
Definition: stats-cluster.h:75
gboolean stats_counter_group_init_equals(const StatsCounterGroupInit *self, const StatsCounterGroupInit *other)
Definition: stats-cluster.c:285
guint stats_register_type(const gchar *type_name)
Definition: stats-cluster.c:59
@ SCS_CENTER
Definition: stats-cluster.h:37
@ SCS_SENDER
Definition: stats-cluster.h:39
@ SCS_GROUP
Definition: stats-cluster.h:35
@ SCS_FACILITY
Definition: stats-cluster.h:42
@ SCS_TAG
Definition: stats-cluster.h:43
@ SCS_PARSER
Definition: stats-cluster.h:45
@ SCS_SEVERITY
Definition: stats-cluster.h:41
@ SCS_HOST
Definition: stats-cluster.h:38
@ SCS_SOURCE_MASK
Definition: stats-cluster.h:46
@ SCS_DESTINATION
Definition: stats-cluster.h:34
@ SCS_GLOBAL
Definition: stats-cluster.h:36
@ SCS_SOURCE
Definition: stats-cluster.h:33
@ SCS_FILTER
Definition: stats-cluster.h:44
@ SCS_PROGRAM
Definition: stats-cluster.h:40
void stats_cluster_key_set(StatsClusterKey *self, const gchar *name, StatsClusterLabel *labels, gsize labels_len, StatsCounterGroupInit counter_group_ctor)
Definition: stats-cluster.c:162
void stats_cluster_foreach_counter(StatsCluster *self, StatsForeachCounterFunc func, gpointer user_data)
Definition: stats-cluster.c:225
void stats_cluster_key_free(StatsClusterKey *self)
Definition: stats-cluster.c:218
StatsCounterItem * stats_cluster_get_counter(StatsCluster *self, gint type)
Definition: stats-cluster.c:340
const gchar * stats_cluster_get_type_name(StatsCluster *self, gint type)
Definition: stats-cluster.c:238
gboolean stats_cluster_is_alive(StatsCluster *self, gint type)
Definition: stats-cluster.c:418
StatsCounterItem * stats_cluster_track_counter(StatsCluster *self, gint type)
Definition: stats-cluster.c:328
void stats_cluster_untrack_counter(StatsCluster *self, gint type, StatsCounterItem **counter)
Definition: stats-cluster.c:353
void stats_cluster_init(void)
Definition: stats-cluster.c:33
void stats_cluster_deinit(void)
Definition: stats-cluster.c:75
Definition: stats-cluster.h:155
guint16 live_mask
Definition: stats-cluster.h:159
guint16 use_count
Definition: stats-cluster.h:158
guint16 dynamic
Definition: stats-cluster.h:160
StatsClusterKey key
Definition: stats-cluster.h:156
gchar * query_key
Definition: stats-cluster.h:161
StatsCounterGroup counter_group
Definition: stats-cluster.h:157
Definition: stats-counter.h:67
Definition: stats-cluster.h:123
StatsCounterGroupInit counter_group_init
Definition: stats-cluster.h:142
guint16 component
Definition: stats-cluster.h:138
const gchar * id
Definition: stats-cluster.h:136
struct _StatsClusterKey::@83 formatting
guint set
Definition: stats-cluster.h:140
const gchar * instance
Definition: stats-cluster.h:139
gsize labels_len
Definition: stats-cluster.h:126
const gchar * name
Definition: stats-cluster.h:124
StatsClusterFrameOfReference frame_of_reference
Definition: stats-cluster.h:131
struct _StatsClusterKey::@84 legacy
StatsClusterLabel * labels
Definition: stats-cluster.h:125
StatsClusterUnit stored_unit
Definition: stats-cluster.h:130
Definition: stats-cluster.h:108
const gchar * name
Definition: stats-cluster.h:109
const gchar * value
Definition: stats-cluster.h:110
Definition: stats-cluster.h:91
void(* clone)(StatsCounterGroupInit *dst, const StatsCounterGroupInit *src)
Definition: stats-cluster.h:99
union _StatsCounterGroupInit::@82 counter
void(* init)(StatsCounterGroupInit *self, StatsCounterGroup *counter_group)
Definition: stats-cluster.h:97
void(* cloned_free)(StatsCounterGroupInit *self)
Definition: stats-cluster.h:100
const gchar * name
Definition: stats-cluster.h:95
const gchar ** names
Definition: stats-cluster.h:94
gboolean(* equals)(const StatsCounterGroupInit *self, const StatsCounterGroupInit *other)
Definition: stats-cluster.h:98
Definition: stats-cluster.h:82
StatsCounterItem * counters
Definition: stats-cluster.h:83
gboolean(* get_type_label)(StatsCounterGroup *self, gint type, StatsClusterLabel *label)
Definition: stats-cluster.h:86
void(* free_fn)(StatsCounterGroup *self)
Definition: stats-cluster.h:87
const gchar ** counter_names
Definition: stats-cluster.h:84
guint16 capacity
Definition: stats-cluster.h:85
GString * value
Definition: test_decode.c:28
struct tm key
Definition: cache.c:63