]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
counters: rename unparsable SCPCAElem to StatsLocalCounter
authorVictor Julien <victor@inliniac.net>
Tue, 26 May 2015 14:24:39 +0000 (16:24 +0200)
committerVictor Julien <victor@inliniac.net>
Wed, 27 May 2015 12:14:46 +0000 (14:14 +0200)
src/counters.c
src/counters.h

index 10521363c5b8044a5a2eba856e26654720ee9459..421f5a6440021eeef3a0706808faf222084b9644 100644 (file)
@@ -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) {
index 4ba866d5c6a7b1ca01e119d4c1c5e27e13808bc9..0bf52c0030017bf9e094d6590a2c04c80cf0a8ae 100644 (file)
@@ -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_ *);