]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
counters: remove references to 'perf' counters
authorVictor Julien <victor@inliniac.net>
Tue, 26 May 2015 14:45:07 +0000 (16:45 +0200)
committerVictor Julien <victor@inliniac.net>
Wed, 27 May 2015 12:14:46 +0000 (14:14 +0200)
src/counters.c
src/counters.h
src/util-error.c
src/util-error.h

index cb50a33ebd5ac3963b3e21146a0a180372bab217..997ad01ca3b276f719b89fee2c3294ba17827acd 100644 (file)
@@ -46,7 +46,7 @@
 
 /**
  * \brief Different kinds of qualifier that can be used to modify the behaviour
- *        of the Perf counter to be registered
+ *        of the counter to be registered
  */
 enum {
     STATS_TYPE_NORMAL = 1,
@@ -231,8 +231,8 @@ static void StatsInitCtx(void)
 }
 
 /**
- * \brief Releases the resources alloted to the output context of the Perf
- *        Counter API
+ * \brief Releases the resources alloted to the output context of the
+ *        Stats API
  */
 static void StatsReleaseCtx()
 {
@@ -267,10 +267,9 @@ static void StatsReleaseCtx()
 }
 
 /**
- * \brief The management thread. This thread is responsible for writing the
- *        performance stats information.
+ * \brief management thread. This thread is responsible for writing the stats
  *
- * \param arg is NULL always
+ * \param arg thread var
  *
  * \retval NULL This is the value that is always returned
  */
@@ -297,7 +296,7 @@ static void *StatsMgmtThread(void *arg)
     SCDropCaps(tv_local);
 
     if (stats_ctx == NULL) {
-        SCLogError(SC_ERR_PERF_STATS_NOT_INIT, "Perf Counter API not init"
+        SCLogError(SC_ERR_STATS_NOT_INIT, "Stats API not init"
                    "StatsInitCounterApi() has to be called first");
         TmThreadsSetFlag(tv_local, THV_CLOSED | THV_RUNNING_DONE);
         return NULL;
@@ -307,7 +306,7 @@ static void *StatsMgmtThread(void *arg)
     BUG_ON(tm->ThreadInit == NULL);
     int r = tm->ThreadInit(tv_local, NULL, &stats_thread_data);
     if (r != 0 || stats_thread_data == NULL) {
-        SCLogError(SC_ERR_THREAD_INIT, "Perf Counter API "
+        SCLogError(SC_ERR_THREAD_INIT, "Stats API "
                    "ThreadInit failed");
         TmThreadsSetFlag(tv_local, THV_CLOSED | THV_RUNNING_DONE);
         return NULL;
@@ -343,7 +342,7 @@ static void *StatsMgmtThread(void *arg)
 
     r = tm->ThreadDeinit(tv_local, stats_thread_data);
     if (r != TM_ECODE_OK) {
-        SCLogError(SC_ERR_THREAD_DEINIT, "Perf Counter API "
+        SCLogError(SC_ERR_THREAD_DEINIT, "Stats Counter API "
                    "ThreadDeinit failed");
     }
 
@@ -384,7 +383,7 @@ static void *StatsWakeupThread(void *arg)
     SCDropCaps(tv_local);
 
     if (stats_ctx == NULL) {
-        SCLogError(SC_ERR_PERF_STATS_NOT_INIT, "Perf Counter API not init"
+        SCLogError(SC_ERR_STATS_NOT_INIT, "Stats API not init"
                    "StatsInitCounterApi() has to be called first");
         TmThreadsSetFlag(tv_local, THV_CLOSED | THV_RUNNING_DONE);
         return NULL;
@@ -454,8 +453,7 @@ static void *StatsWakeupThread(void *arg)
 }
 
 /**
- * \brief Releases a perf counter.  Used internally by
- *        StatsReleasePerfCounters()
+ * \brief Releases a counter
  *
  * \param pc Pointer to the StatsCounter to be freed
  */
@@ -472,7 +470,7 @@ static void StatsReleaseCounter(StatsCounter *pc)
 }
 
 /**
- * \brief Registers a counter.  Used internally by the Perf Counter API
+ * \brief Registers a counter.
  *
  * \param cname    Name of the counter, to be registered
  * \param tm_name  Thread module to which this counter belongs
@@ -523,7 +521,7 @@ static uint16_t StatsRegisterQualifiedCounter(char *cname, char *tm_name,
     }
 
     /* assign a unique id to this StatsCounter.  The id is local to this
-     * PerfContext.  Please note that the id start from 1, and not 0 */
+     * thread context.  Please note that the id start from 1, and not 0 */
     pc->id = ++(pctx->curr_id);
 
     pc->type = type_q;
@@ -760,8 +758,7 @@ void StatsSetupPostConfig(void)
 }
 
 /**
- * \brief Spawns the wakeup, and the management thread used by the perf
- *        counter api
+ * \brief Spawns the wakeup, and the management thread used by the stats api
  *
  *  The threads use the condition variable in the thread vars to control
  *  their wait loops to make sure the main thread can quickly kill them.
@@ -1147,7 +1144,7 @@ uint64_t StatsGetLocalCounterValue(ThreadVars *tv, uint16_t id)
 }
 
 /**
- * \brief Releases the resources alloted by the Perf Counter API
+ * \brief Releases the resources alloted by the Stats API
  */
 void StatsReleaseResources()
 {
@@ -1157,12 +1154,12 @@ void StatsReleaseResources()
 }
 
 /**
- * \brief Releases a list of perf counters
+ * \brief Releases counters
  *
  * \param head Pointer to the head of the list of perf counters that have to
  *             be freed
  */
-void StatsReleasePerfCounters(StatsCounter *head)
+void StatsReleaseCounters(StatsCounter *head)
 {
     StatsCounter *pc = NULL;
 
@@ -1236,7 +1233,7 @@ static int StatsTestCounterReg03()
 
     result = RegisterCounter("t1", "c1", &pctx);
 
-    StatsReleasePerfCounters(pctx.head);
+    StatsReleaseCounters(pctx.head);
 
     return result;
 }
@@ -1254,7 +1251,7 @@ static int StatsTestCounterReg04()
 
     result = RegisterCounter("t1", "c1", &pctx);
 
-    StatsReleasePerfCounters(pctx.head);
+    StatsReleaseCounters(pctx.head);
 
     return result;
 }
@@ -1292,7 +1289,7 @@ static int StatsTestGetCntArray06()
 
     result = (r == 0) ? 1  : 0;
 
-    StatsReleasePerfCounters(tv.perf_public_ctx.head);
+    StatsReleaseCounters(tv.perf_public_ctx.head);
     StatsReleasePrivateThreadContext(&tv.perf_private_ctx);
 
     return result;
@@ -1319,7 +1316,7 @@ static int StatsTestCntArraySize07()
 
     result = pca->size;
 
-    StatsReleasePerfCounters(tv.perf_public_ctx.head);
+    StatsReleaseCounters(tv.perf_public_ctx.head);
     StatsReleasePrivateThreadContext(pca);
 
     return result;
@@ -1344,7 +1341,7 @@ static int StatsTestUpdateCounter08()
 
     result = pca->head[id].value;
 
-    StatsReleasePerfCounters(tv.perf_public_ctx.head);
+    StatsReleaseCounters(tv.perf_public_ctx.head);
     StatsReleasePrivateThreadContext(pca);
 
     return result;
@@ -1373,7 +1370,7 @@ static int StatsTestUpdateCounter09()
 
     result = (pca->head[id1].value == 0) && (pca->head[id2].value == 101);
 
-    StatsReleasePerfCounters(tv.perf_public_ctx.head);
+    StatsReleaseCounters(tv.perf_public_ctx.head);
     StatsReleasePrivateThreadContext(pca);
 
     return result;
@@ -1407,7 +1404,7 @@ static int StatsTestUpdateGlobalCounter10()
     result &= (100 == tv.perf_public_ctx.head->next->value);
     result &= (101 == tv.perf_public_ctx.head->next->next->value);
 
-    StatsReleasePerfCounters(tv.perf_public_ctx.head);
+    StatsReleaseCounters(tv.perf_public_ctx.head);
     StatsReleasePrivateThreadContext(pca);
 
     return result;
@@ -1446,7 +1443,7 @@ static int StatsTestCounterValues11()
 
     result &= (16843024 == tv.perf_public_ctx.head->next->next->next->value);
 
-    StatsReleasePerfCounters(tv.perf_public_ctx.head);
+    StatsReleaseCounters(tv.perf_public_ctx.head);
     StatsReleasePrivateThreadContext(pca);
 
     return result;
index 0bf52c0030017bf9e094d6590a2c04c80cf0a8ae..01e65e3b72f281502a40fe368ffa3f7082adfb2f 100644 (file)
@@ -109,7 +109,7 @@ void StatsSetupPostConfig(void);
 void StatsSpawnThreads(void);
 void StatsRegisterTests(void);
 
-/* functions used to free the resources alloted by the Perf counter API */
+/* functions used to free the resources alloted by the Stats API */
 void StatsReleaseResources(void);
 
 /* counter registration functions */
index 354765343f6a68bcc8e67d76fde1f60793e0ab39..fd52a4d264f0de006c7234f65b60de0045a9bc69 100644 (file)
@@ -264,7 +264,7 @@ const char * SCErrorToString(SCError err)
         CASE_CODE (SC_ERR_SYSCALL);
         CASE_CODE (SC_ERR_SYSCONF);
         CASE_CODE (SC_ERR_INVALID_ARGUMENTS);
-        CASE_CODE (SC_ERR_PERF_STATS_NOT_INIT);
+        CASE_CODE (SC_ERR_STATS_NOT_INIT);
         CASE_CODE (SC_ERR_NFQ_OPEN);
         CASE_CODE (SC_ERR_NFQ_MAXLEN);
         CASE_CODE (SC_ERR_NFQ_CREATE_QUEUE);
index db6b462206b07590acceef7b1f5e0a9759884761..83529d0cdf10c4768a73c309158a0f81fb03bb87 100644 (file)
@@ -80,7 +80,7 @@ typedef enum {
     SC_ERR_SYSCALL,
     SC_ERR_SYSCONF,
     SC_ERR_INVALID_ARGUMENTS,
-    SC_ERR_PERF_STATS_NOT_INIT,
+    SC_ERR_STATS_NOT_INIT,
     SC_ERR_COMPLETE_PORT_SPACE_NEGATED,
     SC_ERR_NO_PORTS_LEFT_AFTER_MERGE,
     SC_ERR_NEGATED_VALUE_IN_PORT_RANGE,