* \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;
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)
*/
int StatsUpdateCounterArray(StatsPrivateThreadContext *pca, StatsPublicThreadContext *pctx)
{
- SCPCAElem *pcae = NULL;
+ StatsLocalCounter *pcae = NULL;
uint32_t i = 0;
if (pca == NULL || pctx == NULL) {
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 */
} 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 */
} 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' */
/* 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;
/* 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_ *);