/* 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;
* \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,
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.
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
*/
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);
/* 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 */