diff --git a/src/counters.c b/src/counters.c index 10521363c5..421f5a6440 100644 --- a/src/counters.c +++ b/src/counters.c @@ -552,7 +552,7 @@ static uint16_t StatsRegisterQualifiedCounter(char *cname, char *tm_name, * \param pcae Pointer to the StatsPrivateThreadContext which holds the local * versions of the counters */ -static void StatsCopyCounterValue(SCPCAElem *pcae) +static void StatsCopyCounterValue(StatsLocalCounter *pcae) { StatsCounter *pc = pcae->pc; @@ -1157,10 +1157,10 @@ static int StatsGetCounterArrayRange(uint16_t s_id, uint16_t e_id, return -1; } - if ( (pca->head = SCMalloc(sizeof(SCPCAElem) * (e_id - s_id + 2))) == NULL) { + if ( (pca->head = SCMalloc(sizeof(StatsLocalCounter) * (e_id - s_id + 2))) == NULL) { return -1; } - memset(pca->head, 0, sizeof(SCPCAElem) * (e_id - s_id + 2)); + memset(pca->head, 0, sizeof(StatsLocalCounter) * (e_id - s_id + 2)); pc = pctx->head; while (pc->id != s_id) @@ -1216,7 +1216,7 @@ int StatsSetupPrivate(ThreadVars *tv) */ int StatsUpdateCounterArray(StatsPrivateThreadContext *pca, StatsPublicThreadContext *pctx) { - SCPCAElem *pcae = NULL; + StatsLocalCounter *pcae = NULL; uint32_t i = 0; if (pca == NULL || pctx == NULL) { diff --git a/src/counters.h b/src/counters.h index 4ba866d5c6..0bf52c0030 100644 --- a/src/counters.h +++ b/src/counters.h @@ -34,10 +34,10 @@ struct ThreadVars_; typedef struct StatsCounter_ { int type; - /* local id for this counter in this tm */ + /* local id for this counter in this thread */ uint16_t id; - /* global id */ + /* global id, used in output */ uint16_t gid; /* counter value(s): copies from the 'private' counter */ @@ -56,7 +56,7 @@ typedef struct StatsCounter_ { } StatsCounter; /** - * \brief Holds the Perf Context for a ThreadVars instance + * \brief Stats Context for a ThreadVars instance */ typedef struct StatsPublicThreadContext_ { /* flag set by the wakeup thread, to inform the client threads to sync */ @@ -73,13 +73,14 @@ typedef struct StatsPublicThreadContext_ { } StatsPublicThreadContext; /** - * \brief Node elements used by the StatsPrivateThreadContext(PCA) Node + * \brief Storage for local counters, with a link to the public counter used + * for syncs */ -typedef struct SCPCAElem_ { - /* pointer to the PerfCounter that corresponds to this PCAElem */ +typedef struct StatsLocalCounter_ { + /* pointer to the counter that corresponds to this local counter */ StatsCounter *pc; - /* counter id of the above counter(pc) */ + /* local counter id of the above counter */ uint16_t id; /* total value of the adds/increments, or exact value in case of 'set' */ @@ -87,16 +88,16 @@ typedef struct SCPCAElem_ { /* no of times the local counter has been updated */ uint64_t updates; -} SCPCAElem; +} StatsLocalCounter; /** * \brief used to hold the private version of the counters registered */ typedef struct StatsPrivateThreadContext_ { - /* points to the array holding PCAElems */ - SCPCAElem *head; + /* points to the array holding local counters */ + StatsLocalCounter *head; - /* no of PCAElems in head */ + /* size of head array in elements */ uint32_t size; int initialized; @@ -110,7 +111,6 @@ void StatsRegisterTests(void); /* functions used to free the resources alloted by the Perf counter API */ void StatsReleaseResources(void); -void StatsReleasePCA(StatsPrivateThreadContext *); /* counter registration functions */ uint16_t StatsRegisterCounter(char *, struct ThreadVars_ *);