counters: s/SCPerfPublicContext/StatsPublicThreadContext/g

pull/1508/head
Victor Julien 11 years ago
parent 7e70f136ec
commit 628c3b1bc7

@ -65,9 +65,9 @@ typedef struct StatsThreadStore_ {
char *tm_name; char *tm_name;
SCPerfPublicContext *ctx; StatsPublicThreadContext *ctx;
SCPerfPublicContext **head; StatsPublicThreadContext **head;
uint32_t size; uint32_t size;
struct StatsThreadStore_ *next; struct StatsThreadStore_ *next;
@ -84,7 +84,7 @@ typedef struct StatsGlobalContext_ {
HashTable *counters_id_hash; HashTable *counters_id_hash;
SCPerfPublicContext global_counter_ctx; StatsPublicThreadContext global_counter_ctx;
} StatsGlobalContext; } StatsGlobalContext;
static void *stats_thread_data = NULL; static void *stats_thread_data = NULL;
@ -96,7 +96,7 @@ static uint32_t stats_tts = STATS_MGMTT_TTS;
static char stats_enabled = TRUE; static char stats_enabled = TRUE;
static int StatsOutput(ThreadVars *tv); 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 /** stats table is filled each interval and passed to the
* loggers. Initialized at first use. */ * 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 * \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 * \param arg is NULL always
* *
@ -482,7 +482,7 @@ static void SCPerfReleaseCounter(SCPerfCounter *pc)
* *
* \param cname Name of the counter, to be registered * \param cname Name of the counter, to be registered
* \param tm_name Thread module to which this counter belongs * \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 * \param type_q Qualifier describing the type of counter to be registered
* *
* \retval the counter id for the newly registered counter, or the already * \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 * \retval 0 on failure
*/ */
static uint16_t StatsRegisterQualifiedCounter(char *cname, char *tm_name, static uint16_t StatsRegisterQualifiedCounter(char *cname, char *tm_name,
SCPerfPublicContext *pctx, StatsPublicThreadContext *pctx,
int type_q, uint64_t (*Func)(void)) int type_q, uint64_t (*Func)(void))
{ {
SCPerfCounter **head = &pctx->head; SCPerfCounter **head = &pctx->head;
@ -499,7 +499,7 @@ static uint16_t StatsRegisterQualifiedCounter(char *cname, char *tm_name,
SCPerfCounter *pc = NULL; SCPerfCounter *pc = NULL;
if (cname == NULL || pctx == NULL) { if (cname == NULL || pctx == NULL) {
SCLogDebug("Counter name, SCPerfPublicContext NULL"); SCLogDebug("Counter name, StatsPublicThreadContext NULL");
return 0; return 0;
} }
@ -1061,11 +1061,11 @@ void CountersIdHashFreeFunc(void *data)
* are stacked together in a PCTMI container. * are stacked together in a PCTMI container.
* *
* \param tm_name Name of the tm to be added to the table * \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 * \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) { if (stats_ctx == NULL) {
SCLogDebug("Counter module has been disabled"); 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 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 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 * \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, static int SCPerfGetCounterArrayRange(uint16_t s_id, uint16_t e_id,
SCPerfPublicContext *pctx, StatsPublicThreadContext *pctx,
SCPerfPrivateContext *pca) SCPerfPrivateContext *pca)
{ {
SCPerfCounter *pc = NULL; 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 * \brief Returns a counter array for all counters registered for this tm
* instance * 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 * \retval pca Pointer to a counter-array for all counter of this tm instance
* on success; NULL on failure * on success; NULL on failure
*/ */
static int SCPerfGetAllCountersArray(SCPerfPublicContext *pctx, SCPerfPrivateContext *private) static int SCPerfGetAllCountersArray(StatsPublicThreadContext *pctx, SCPerfPrivateContext *private)
{ {
if (pctx == NULL || private == NULL) if (pctx == NULL || private == NULL)
return -1; return -1;
@ -1209,12 +1209,12 @@ int SCPerfSetupPrivate(ThreadVars *tv)
* \brief Syncs the counter array with the global counter variables * \brief Syncs the counter array with the global counter variables
* *
* \param pca Pointer to the SCPerfPrivateContext * \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 0 on success
* \retval -1 on error * \retval -1 on error
*/ */
int SCPerfUpdateCounterArray(SCPerfPrivateContext *pca, SCPerfPublicContext *pctx) int SCPerfUpdateCounterArray(SCPerfPrivateContext *pca, StatsPublicThreadContext *pctx)
{ {
SCPCAElem *pcae = NULL; SCPCAElem *pcae = NULL;
uint32_t i = 0; 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 * \param tm_name Name of the engine module under which the counter has to be
* registered * registered
* \param type Datatype of this counter variable * \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 * key has to be registered
* *
* \retval id Counter id for the newly registered counter, or the already * \retval id Counter id for the newly registered counter, or the already
* present counter * present counter
*/ */
static uint16_t RegisterCounter(char *cname, char *tm_name, static uint16_t RegisterCounter(char *cname, char *tm_name,
SCPerfPublicContext *pctx) StatsPublicThreadContext *pctx)
{ {
uint16_t id = StatsRegisterQualifiedCounter(cname, tm_name, pctx, uint16_t id = StatsRegisterQualifiedCounter(cname, tm_name, pctx,
STATS_TYPE_NORMAL, NULL); STATS_TYPE_NORMAL, NULL);
@ -1329,19 +1329,19 @@ static uint16_t RegisterCounter(char *cname, char *tm_name,
static int SCPerfTestCounterReg02() static int SCPerfTestCounterReg02()
{ {
SCPerfPublicContext pctx; StatsPublicThreadContext pctx;
memset(&pctx, 0, sizeof(SCPerfPublicContext)); memset(&pctx, 0, sizeof(StatsPublicThreadContext));
return RegisterCounter(NULL, NULL, &pctx); return RegisterCounter(NULL, NULL, &pctx);
} }
static int SCPerfTestCounterReg03() static int SCPerfTestCounterReg03()
{ {
SCPerfPublicContext pctx; StatsPublicThreadContext pctx;
int result; int result;
memset(&pctx, 0, sizeof(SCPerfPublicContext)); memset(&pctx, 0, sizeof(StatsPublicThreadContext));
result = RegisterCounter("t1", "c1", &pctx); result = RegisterCounter("t1", "c1", &pctx);
@ -1352,10 +1352,10 @@ static int SCPerfTestCounterReg03()
static int SCPerfTestCounterReg04() static int SCPerfTestCounterReg04()
{ {
SCPerfPublicContext pctx; StatsPublicThreadContext pctx;
int result; int result;
memset(&pctx, 0, sizeof(SCPerfPublicContext)); memset(&pctx, 0, sizeof(StatsPublicThreadContext));
RegisterCounter("t1", "c1", &pctx); RegisterCounter("t1", "c1", &pctx);
RegisterCounter("t2", "c2", &pctx); RegisterCounter("t2", "c2", &pctx);

@ -58,7 +58,7 @@ typedef struct SCPerfCounter_ {
/** /**
* \brief Holds the Perf Context for a ThreadVars instance * \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 */ /* flag set by the wakeup thread, to inform the client threads to sync */
uint32_t perf_flag; uint32_t perf_flag;
@ -70,7 +70,7 @@ typedef struct SCPerfPublicContext_ {
/* mutex to prevent simultaneous access during update_counter/output_stat */ /* mutex to prevent simultaneous access during update_counter/output_stat */
SCMutex m; SCMutex m;
} SCPerfPublicContext; } StatsPublicThreadContext;
/** /**
* \brief Node elements used by the SCPerfPrivateContext(PCA) Node * \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)); uint16_t StatsRegisterGlobalCounter(char *cname, uint64_t (*Func)(void));
/* utility functions */ /* utility functions */
int SCPerfUpdateCounterArray(SCPerfPrivateContext *, SCPerfPublicContext *); int SCPerfUpdateCounterArray(SCPerfPrivateContext *, StatsPublicThreadContext *);
uint64_t SCPerfGetLocalCounterValue(struct ThreadVars_ *, uint16_t); uint64_t SCPerfGetLocalCounterValue(struct ThreadVars_ *, uint16_t);
int SCPerfSetupPrivate(struct ThreadVars_ *); int SCPerfSetupPrivate(struct ThreadVars_ *);

@ -104,7 +104,7 @@ typedef struct ThreadVars_ {
/* counters */ /* counters */
/** public counter store: counter syncs update this */ /** public counter store: counter syncs update this */
SCPerfPublicContext perf_public_ctx; StatsPublicThreadContext perf_public_ctx;
/** private counter store: counter updates modify this */ /** private counter store: counter updates modify this */
SCPerfPrivateContext perf_private_ctx; SCPerfPrivateContext perf_private_ctx;

Loading…
Cancel
Save