From: Victor Julien Date: Sat, 23 May 2015 12:16:21 +0000 (+0200) Subject: counters: remove unused public API calls and make them private X-Git-Tag: suricata-3.0RC1~387 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7da657dc3dd449ff00f3cb35841df84ff3f00871;p=thirdparty%2Fsuricata.git counters: remove unused public API calls and make them private --- diff --git a/src/counters.c b/src/counters.c index 2e4546a200..66caf64fb0 100644 --- a/src/counters.c +++ b/src/counters.c @@ -50,6 +50,48 @@ /* 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. diff --git a/src/counters.h b/src/counters.h index a63cc5bb4a..75fac38896 100644 --- a/src/counters.h +++ b/src/counters.h @@ -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 */