]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
counters: remove unused public API calls and make them private
authorVictor Julien <victor@inliniac.net>
Sat, 23 May 2015 12:16:21 +0000 (14:16 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 26 May 2015 15:56:56 +0000 (17:56 +0200)
src/counters.c
src/counters.h

index 2e4546a2001fb0a0b779dbccfd172a77e9d4d05e..66caf64fb05844ea1fd8bf9798929d80d5683574 100644 (file)
 /* Time interval at which the mgmt thread o/p the stats */
 #define SC_PERF_MGMTT_TTS 8
 
+/**
+ * \brief Different kinds of qualifier that can be used to modify the behaviour
+ *        of the Perf counter to be registered
+ */
+enum {
+    SC_PERF_TYPE_Q_NORMAL = 1,
+    SC_PERF_TYPE_Q_AVERAGE = 2,
+    SC_PERF_TYPE_Q_MAXIMUM = 3,
+    SC_PERF_TYPE_Q_MAX = 4,
+};
+
+/**
+ * \brief Different output interfaces made available by the Perf counter API
+ */
+enum {
+    SC_PERF_IFACE_FILE,
+    SC_PERF_IFACE_CONSOLE,
+    SC_PERF_IFACE_SYSLOG,
+    SC_PERF_IFACE_MAX,
+};
+
+/**
+ * \brief Holds multiple instances of the same TM together, used when the stats
+ *        have to be clubbed based on TM, before being sent out
+ */
+typedef struct SCPerfClubTMInst_ {
+    char *tm_name;
+
+    SCPerfPublicContext **head;
+    uint32_t size;
+
+    struct SCPerfClubTMInst_ *next;
+} SCPerfClubTMInst;
+
+/**
+ * \brief Holds the output interface context for the counter api
+ */
+typedef struct SCPerfOPIfaceContext_ {
+    SCPerfClubTMInst *pctmi;
+    SCMutex pctmi_lock;
+} SCPerfOPIfaceContext;
+
 static void *stats_thread_data = NULL;
 static SCPerfOPIfaceContext *sc_perf_op_ctx = NULL;
 static time_t sc_start_time;
@@ -967,7 +1009,7 @@ uint16_t SCPerfTVRegisterMaxCounter(char *cname, struct ThreadVars_ *tv,
  * \retval id Counter id for the newly registered counter, or the already
  *            present counter
  */
-uint16_t SCPerfRegisterCounter(char *cname, char *tm_name, int type, char *desc,
+static uint16_t SCPerfRegisterCounter(char *cname, char *tm_name, int type, char *desc,
                                SCPerfPublicContext *pctx)
 {
     uint16_t id = SCPerfRegisterQualifiedCounter(cname, tm_name, type, desc,
@@ -976,54 +1018,6 @@ uint16_t SCPerfRegisterCounter(char *cname, char *tm_name, int type, char *desc,
     return id;
 }
 
-/**
- * \brief Registers a counter, whose value holds the average of all the values
- *        assigned to it.
- *
- * \param cname   Name of the counter, to be registered
- * \param tm_name Name of the engine module under which the counter has to be
- *                registered
- * \param type    Datatype of this counter variable
- * \param desc    Description of this counter
- * \param pctx    SCPerfPublicContext 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
- */
-uint16_t SCPerfRegisterAvgCounter(char *cname, char *tm_name, int type,
-                                  char *desc, SCPerfPublicContext *pctx)
-{
-    uint16_t id = SCPerfRegisterQualifiedCounter(cname, tm_name, type, desc,
-                                                 pctx, SC_PERF_TYPE_Q_AVERAGE);
-
-    return id;
-}
-
-/**
- * \brief Registers a counter, whose value holds the maximum of all the values
- *        assigned to it.
- *
- * \param cname   Name of the counter, to be registered
- * \param tm_name Name of the engine module under which the counter has to be
- *                registered
- * \param type    Datatype of this counter variable
- * \param desc    Description of this counter
- * \param pctx    SCPerfPublicContext 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
- */
-uint16_t SCPerfRegisterMaxCounter(char *cname, char *tm_name, int type,
-                                  char *desc, SCPerfPublicContext *pctx)
-{
-    uint16_t id = SCPerfRegisterQualifiedCounter(cname, tm_name, type, desc,
-                                                 pctx, SC_PERF_TYPE_Q_MAXIMUM);
-
-    return id;
-}
-
 /** \internal
  *  \brief Adds a TM to the clubbed TM table.  Multiple instances of the same TM
  *         are stacked together in a PCTMI container.
index a63cc5bb4a4e2ca3f30ab2d0c0baff72608b61b4..75fac388961d830a76eb0701e8d704e879d6c37f 100644 (file)
@@ -36,27 +36,6 @@ enum {
     SC_PERF_TYPE_MAX,
 };
 
-/**
- * \brief Different kinds of qualifier that can be used to modify the behaviour
- *        of the Perf counter to be registered
- */
-enum {
-    SC_PERF_TYPE_Q_NORMAL = 1,
-    SC_PERF_TYPE_Q_AVERAGE = 2,
-    SC_PERF_TYPE_Q_MAXIMUM = 3,
-    SC_PERF_TYPE_Q_MAX = 4,
-};
-
-/**
- * \brief Different output interfaces made available by the Perf counter API
- */
-enum {
-    SC_PERF_IFACE_FILE,
-    SC_PERF_IFACE_CONSOLE,
-    SC_PERF_IFACE_SYSLOG,
-    SC_PERF_IFACE_MAX,
-};
-
 /**
  * \brief Container to hold the counter variable
  */
@@ -126,42 +105,16 @@ typedef struct SCPerfPrivateContext_ {
     int initialized;
 } SCPerfPrivateContext;
 
-/**
- * \brief Holds multiple instances of the same TM together, used when the stats
- *        have to be clubbed based on TM, before being sent out
- */
-typedef struct SCPerfClubTMInst_ {
-    char *tm_name;
-
-    SCPerfPublicContext **head;
-    uint32_t size;
-
-    struct SCPerfClubTMInst_ *next;
-} SCPerfClubTMInst;
-
-/**
- * \brief Holds the output interface context for the counter api
- */
-typedef struct SCPerfOPIfaceContext_ {
-    SCPerfClubTMInst *pctmi;
-    SCMutex pctmi_lock;
-} SCPerfOPIfaceContext;
-
 /* the initialization functions */
 void SCPerfInitCounterApi(void);
 void SCPerfSpawnThreads(void);
 void SCPerfRegisterTests(void);
 
-/* the ThreadVars counter registration functions */
+/* counter registration functions */
 uint16_t SCPerfTVRegisterCounter(char *, struct ThreadVars_ *, int, char *);
 uint16_t SCPerfTVRegisterAvgCounter(char *, struct ThreadVars_ *, int, char *);
 uint16_t SCPerfTVRegisterMaxCounter(char *, struct ThreadVars_ *, int, char *);
 
-/* the non-ThreadVars counter registration functions */
-uint16_t SCPerfRegisterCounter(char *, char *, int, char *, SCPerfPublicContext *);
-uint16_t SCPerfRegisterAvgCounter(char *, char *, int, char *, SCPerfPublicContext *);
-uint16_t SCPerfRegisterMaxCounter(char *, char *, int, char *, SCPerfPublicContext *);
-
 /* utility functions */
 int SCPerfUpdateCounterArray(SCPerfPrivateContext *, SCPerfPublicContext *);
 uint64_t SCPerfGetLocalCounterValue(struct ThreadVars_ *, uint16_t);
@@ -169,7 +122,6 @@ int SCPerfSetupPrivate(struct ThreadVars_ *);
 
 /* functions used to free the resources alloted by the Perf counter API */
 void SCPerfReleaseResources(void);
-void SCPerfReleasePerfCounterS(SCPerfCounter *);
 void SCPerfReleasePCA(SCPerfPrivateContext *);
 
 /* functions used to update local counter values */