]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
counters: s/SCPerfPublicContext/StatsPublicThreadContext/g
authorVictor Julien <victor@inliniac.net>
Tue, 26 May 2015 14:01:09 +0000 (16:01 +0200)
committerVictor Julien <victor@inliniac.net>
Wed, 27 May 2015 12:14:46 +0000 (14:14 +0200)
src/counters.c
src/counters.h
src/threadvars.h

index 9a333a7eb761e7b71a1d887263cc926e8f35d18e..15d8b85ae186a49049bae7a5bc0c32fe229c68ee 100644 (file)
@@ -65,9 +65,9 @@ typedef struct StatsThreadStore_ {
 
     char *tm_name;
 
-    SCPerfPublicContext *ctx;
+    StatsPublicThreadContext *ctx;
 
-    SCPerfPublicContext **head;
+    StatsPublicThreadContext **head;
     uint32_t size;
 
     struct StatsThreadStore_ *next;
@@ -84,7 +84,7 @@ typedef struct StatsGlobalContext_ {
 
     HashTable *counters_id_hash;
 
-    SCPerfPublicContext global_counter_ctx;
+    StatsPublicThreadContext global_counter_ctx;
 } StatsGlobalContext;
 
 static void *stats_thread_data = NULL;
@@ -96,7 +96,7 @@ static uint32_t stats_tts = STATS_MGMTT_TTS;
 static char stats_enabled = TRUE;
 
 static int StatsOutput(ThreadVars *tv);
-static int StatsThreadRegister(const char *thread_name, SCPerfPublicContext *);
+static int StatsThreadRegister(const char *thread_name, StatsPublicThreadContext *);
 
 /** stats table is filled each interval and passed to the
  *  loggers. Initialized at first use. */
@@ -359,7 +359,7 @@ static void *SCPerfMgmtThread(void *arg)
 
 /**
  * \brief Wake up thread.  This thread wakes up every TTS(time to sleep) seconds
- *        and sets the flag for every ThreadVars' SCPerfPublicContext
+ *        and sets the flag for every ThreadVars' StatsPublicThreadContext
  *
  * \param arg is NULL always
  *
@@ -482,7 +482,7 @@ static void SCPerfReleaseCounter(SCPerfCounter *pc)
  *
  * \param cname    Name of the counter, to be registered
  * \param tm_name  Thread module to which this counter belongs
- * \param pctx     SCPerfPublicContext for this tm-tv instance
+ * \param pctx     StatsPublicThreadContext for this tm-tv instance
  * \param type_q   Qualifier describing the type of counter to be registered
  *
  * \retval the counter id for the newly registered counter, or the already
@@ -490,7 +490,7 @@ static void SCPerfReleaseCounter(SCPerfCounter *pc)
  * \retval 0 on failure
  */
 static uint16_t StatsRegisterQualifiedCounter(char *cname, char *tm_name,
-                                              SCPerfPublicContext *pctx,
+                                              StatsPublicThreadContext *pctx,
                                               int type_q, uint64_t (*Func)(void))
 {
     SCPerfCounter **head = &pctx->head;
@@ -499,7 +499,7 @@ static uint16_t StatsRegisterQualifiedCounter(char *cname, char *tm_name,
     SCPerfCounter *pc = NULL;
 
     if (cname == NULL || pctx == NULL) {
-        SCLogDebug("Counter name, SCPerfPublicContext NULL");
+        SCLogDebug("Counter name, StatsPublicThreadContext NULL");
         return 0;
     }
 
@@ -1061,11 +1061,11 @@ void CountersIdHashFreeFunc(void *data)
  *         are stacked together in a PCTMI container.
  *
  *  \param tm_name Name of the tm to be added to the table
- *  \param pctx    SCPerfPublicContext associated with the TM tm_name
+ *  \param pctx    StatsPublicThreadContext associated with the TM tm_name
  *
  *  \retval 1 on success, 0 on failure
  */
-static int StatsThreadRegister(const char *thread_name, SCPerfPublicContext *pctx)
+static int StatsThreadRegister(const char *thread_name, StatsPublicThreadContext *pctx)
 {
     if (stats_ctx == NULL) {
         SCLogDebug("Counter module has been disabled");
@@ -1131,12 +1131,12 @@ static int StatsThreadRegister(const char *thread_name, SCPerfPublicContext *pct
  *
  *  \param s_id Counter id of the first counter to be added to the array
  *  \param e_id Counter id of the last counter to be added to the array
- *  \param pctx Pointer to the tv's SCPerfPublicContext
+ *  \param pctx Pointer to the tv's StatsPublicThreadContext
  *
  *  \retval a counter-array in this(s_id-e_id) range for this TM instance
  */
 static int SCPerfGetCounterArrayRange(uint16_t s_id, uint16_t e_id,
-                                      SCPerfPublicContext *pctx,
+                                      StatsPublicThreadContext *pctx,
                                       SCPerfPrivateContext *pca)
 {
     SCPerfCounter *pc = NULL;
@@ -1183,12 +1183,12 @@ static int SCPerfGetCounterArrayRange(uint16_t s_id, uint16_t e_id,
  *  \brief Returns a counter array for all counters registered for this tm
  *         instance
  *
- *  \param pctx Pointer to the tv's SCPerfPublicContext
+ *  \param pctx Pointer to the tv's StatsPublicThreadContext
  *
  *  \retval pca Pointer to a counter-array for all counter of this tm instance
  *              on success; NULL on failure
  */
-static int SCPerfGetAllCountersArray(SCPerfPublicContext *pctx, SCPerfPrivateContext *private)
+static int SCPerfGetAllCountersArray(StatsPublicThreadContext *pctx, SCPerfPrivateContext *private)
 {
     if (pctx == NULL || private == NULL)
         return -1;
@@ -1209,12 +1209,12 @@ int SCPerfSetupPrivate(ThreadVars *tv)
  * \brief Syncs the counter array with the global counter variables
  *
  * \param pca      Pointer to the SCPerfPrivateContext
- * \param pctx     Pointer the the tv's SCPerfPublicContext
+ * \param pctx     Pointer the the tv's StatsPublicThreadContext
  *
  * \retval  0 on success
  * \retval -1 on error
  */
-int SCPerfUpdateCounterArray(SCPerfPrivateContext *pca, SCPerfPublicContext *pctx)
+int SCPerfUpdateCounterArray(SCPerfPrivateContext *pca, StatsPublicThreadContext *pctx)
 {
     SCPCAElem *pcae = NULL;
     uint32_t i = 0;
@@ -1313,14 +1313,14 @@ void SCPerfReleasePCA(SCPerfPrivateContext *pca)
  * \param tm_name Name of the engine module under which the counter has to be
  *                registered
  * \param type    Datatype of this counter variable
- * \param pctx    SCPerfPublicContext corresponding to the tm_name key under which the
+ * \param pctx    StatsPublicThreadContext corresponding to the tm_name key under which the
  *                key has to be registered
  *
  * \retval id Counter id for the newly registered counter, or the already
  *            present counter
  */
 static uint16_t RegisterCounter(char *cname, char *tm_name,
-                               SCPerfPublicContext *pctx)
+                               StatsPublicThreadContext *pctx)
 {
     uint16_t id = StatsRegisterQualifiedCounter(cname, tm_name, pctx,
                                                 STATS_TYPE_NORMAL, NULL);
@@ -1329,19 +1329,19 @@ static uint16_t RegisterCounter(char *cname, char *tm_name,
 
 static int SCPerfTestCounterReg02()
 {
-    SCPerfPublicContext pctx;
+    StatsPublicThreadContext pctx;
 
-    memset(&pctx, 0, sizeof(SCPerfPublicContext));
+    memset(&pctx, 0, sizeof(StatsPublicThreadContext));
 
     return RegisterCounter(NULL, NULL, &pctx);
 }
 
 static int SCPerfTestCounterReg03()
 {
-    SCPerfPublicContext pctx;
+    StatsPublicThreadContext pctx;
     int result;
 
-    memset(&pctx, 0, sizeof(SCPerfPublicContext));
+    memset(&pctx, 0, sizeof(StatsPublicThreadContext));
 
     result = RegisterCounter("t1", "c1", &pctx);
 
@@ -1352,10 +1352,10 @@ static int SCPerfTestCounterReg03()
 
 static int SCPerfTestCounterReg04()
 {
-    SCPerfPublicContext pctx;
+    StatsPublicThreadContext pctx;
     int result;
 
-    memset(&pctx, 0, sizeof(SCPerfPublicContext));
+    memset(&pctx, 0, sizeof(StatsPublicThreadContext));
 
     RegisterCounter("t1", "c1", &pctx);
     RegisterCounter("t2", "c2", &pctx);
index 0a6e830fbf5faa5f89d736555b6b0cd21206d1ae..7d91afa83bf5fdf87e03da12cdcdbd9d83036bfc 100644 (file)
@@ -58,7 +58,7 @@ typedef struct SCPerfCounter_ {
 /**
  * \brief Holds the Perf Context for a ThreadVars instance
  */
-typedef struct SCPerfPublicContext_ {
+typedef struct StatsPublicThreadContext_ {
     /* flag set by the wakeup thread, to inform the client threads to sync */
     uint32_t perf_flag;
 
@@ -70,7 +70,7 @@ typedef struct SCPerfPublicContext_ {
 
     /* mutex to prevent simultaneous access during update_counter/output_stat */
     SCMutex m;
-} SCPerfPublicContext;
+} StatsPublicThreadContext;
 
 /**
  * \brief Node elements used by the SCPerfPrivateContext(PCA) Node
@@ -115,7 +115,7 @@ uint16_t StatsRegisterMaxCounter(char *, struct ThreadVars_ *);
 uint16_t StatsRegisterGlobalCounter(char *cname, uint64_t (*Func)(void));
 
 /* utility functions */
-int SCPerfUpdateCounterArray(SCPerfPrivateContext *, SCPerfPublicContext *);
+int SCPerfUpdateCounterArray(SCPerfPrivateContext *, StatsPublicThreadContext *);
 uint64_t SCPerfGetLocalCounterValue(struct ThreadVars_ *, uint16_t);
 int SCPerfSetupPrivate(struct ThreadVars_ *);
 
index b5702cfc70a3b4dcaf56ca4530e8dba494776023..7f915e1b82d2747f7ac9360eea2e89c094d51bd7 100644 (file)
@@ -104,7 +104,7 @@ typedef struct ThreadVars_ {
     /* counters */
 
     /** public counter store: counter syncs update this */
-    SCPerfPublicContext perf_public_ctx;
+    StatsPublicThreadContext perf_public_ctx;
 
     /** private counter store: counter updates modify this */
     SCPerfPrivateContext perf_private_ctx;