counters: s/SCPerfPrivateContext/StatsPrivateThreadContext/g

pull/1508/head
Victor Julien 10 years ago
parent 628c3b1bc7
commit 4362d0a6e9

@ -113,7 +113,7 @@ static uint16_t counters_global_id = 0;
*/ */
void StatsAddUI64(ThreadVars *tv, uint16_t id, uint64_t x) void StatsAddUI64(ThreadVars *tv, uint16_t id, uint64_t x)
{ {
SCPerfPrivateContext *pca = &tv->perf_private_ctx; StatsPrivateThreadContext *pca = &tv->perf_private_ctx;
#ifdef UNITTESTS #ifdef UNITTESTS
if (pca->initialized == 0) if (pca->initialized == 0)
return; return;
@ -134,7 +134,7 @@ void StatsAddUI64(ThreadVars *tv, uint16_t id, uint64_t x)
*/ */
void StatsIncr(ThreadVars *tv, uint16_t id) void StatsIncr(ThreadVars *tv, uint16_t id)
{ {
SCPerfPrivateContext *pca = &tv->perf_private_ctx; StatsPrivateThreadContext *pca = &tv->perf_private_ctx;
#ifdef UNITTESTS #ifdef UNITTESTS
if (pca->initialized == 0) if (pca->initialized == 0)
return; return;
@ -151,12 +151,12 @@ void StatsIncr(ThreadVars *tv, uint16_t id)
* \brief Sets a value of type double to the local counter * \brief Sets a value of type double to the local counter
* *
* \param id Index of the local counter in the counter array * \param id Index of the local counter in the counter array
* \param pca Pointer to the SCPerfPrivateContext * \param pca Pointer to the StatsPrivateThreadContext
* \param x The value to set for the counter * \param x The value to set for the counter
*/ */
void StatsSetUI64(ThreadVars *tv, uint16_t id, uint64_t x) void StatsSetUI64(ThreadVars *tv, uint16_t id, uint64_t x)
{ {
SCPerfPrivateContext *pca = &tv->perf_private_ctx; StatsPrivateThreadContext *pca = &tv->perf_private_ctx;
#ifdef UNITTESTS #ifdef UNITTESTS
if (pca->initialized == 0) if (pca->initialized == 0)
return; return;
@ -546,10 +546,10 @@ static uint16_t StatsRegisterQualifiedCounter(char *cname, char *tm_name,
/** /**
* \brief Copies the SCPerfCounter value from the local counter present in the * \brief Copies the SCPerfCounter value from the local counter present in the
* SCPerfPrivateContext to its corresponding global counterpart. Used * StatsPrivateThreadContext to its corresponding global counterpart. Used
* internally by SCPerfUpdateCounterArray() * internally by SCPerfUpdateCounterArray()
* *
* \param pcae Pointer to the SCPerfPrivateContext which holds the local * \param pcae Pointer to the StatsPrivateThreadContext which holds the local
* versions of the counters * versions of the counters
*/ */
static void SCPerfCopyCounterValue(SCPCAElem *pcae) static void SCPerfCopyCounterValue(SCPCAElem *pcae)
@ -1137,7 +1137,7 @@ static int StatsThreadRegister(const char *thread_name, StatsPublicThreadContext
*/ */
static int SCPerfGetCounterArrayRange(uint16_t s_id, uint16_t e_id, static int SCPerfGetCounterArrayRange(uint16_t s_id, uint16_t e_id,
StatsPublicThreadContext *pctx, StatsPublicThreadContext *pctx,
SCPerfPrivateContext *pca) StatsPrivateThreadContext *pca)
{ {
SCPerfCounter *pc = NULL; SCPerfCounter *pc = NULL;
uint32_t i = 0; uint32_t i = 0;
@ -1188,7 +1188,7 @@ static int SCPerfGetCounterArrayRange(uint16_t s_id, uint16_t e_id,
* \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(StatsPublicThreadContext *pctx, SCPerfPrivateContext *private) static int SCPerfGetAllCountersArray(StatsPublicThreadContext *pctx, StatsPrivateThreadContext *private)
{ {
if (pctx == NULL || private == NULL) if (pctx == NULL || private == NULL)
return -1; return -1;
@ -1208,13 +1208,13 @@ 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 StatsPrivateThreadContext
* \param pctx Pointer the the tv's StatsPublicThreadContext * \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, StatsPublicThreadContext *pctx) int SCPerfUpdateCounterArray(StatsPrivateThreadContext *pca, StatsPublicThreadContext *pctx)
{ {
SCPCAElem *pcae = NULL; SCPCAElem *pcae = NULL;
uint32_t i = 0; uint32_t i = 0;
@ -1248,7 +1248,7 @@ int SCPerfUpdateCounterArray(SCPerfPrivateContext *pca, StatsPublicThreadContext
*/ */
uint64_t SCPerfGetLocalCounterValue(ThreadVars *tv, uint16_t id) uint64_t SCPerfGetLocalCounterValue(ThreadVars *tv, uint16_t id)
{ {
SCPerfPrivateContext *pca = &tv->perf_private_ctx; StatsPrivateThreadContext *pca = &tv->perf_private_ctx;
#ifdef DEBUG #ifdef DEBUG
BUG_ON ((id < 1) || (id > pca->size)); BUG_ON ((id < 1) || (id > pca->size));
#endif #endif
@ -1285,12 +1285,12 @@ void SCPerfReleasePerfCounterS(SCPerfCounter *head)
} }
/** /**
* \brief Releases the SCPerfPrivateContext allocated by the user, for storing and * \brief Releases the StatsPrivateThreadContext allocated by the user, for storing and
* updating local counter values * updating local counter values
* *
* \param pca Pointer to the SCPerfPrivateContext * \param pca Pointer to the StatsPrivateThreadContext
*/ */
void SCPerfReleasePCA(SCPerfPrivateContext *pca) void SCPerfReleasePCA(StatsPrivateThreadContext *pca)
{ {
if (pca != NULL) { if (pca != NULL) {
if (pca->head != NULL) { if (pca->head != NULL) {
@ -1410,12 +1410,12 @@ static int SCPerfTestGetCntArray06()
static int SCPerfTestCntArraySize07() static int SCPerfTestCntArraySize07()
{ {
ThreadVars tv; ThreadVars tv;
SCPerfPrivateContext *pca = NULL; StatsPrivateThreadContext *pca = NULL;
int result; int result;
memset(&tv, 0, sizeof(ThreadVars)); memset(&tv, 0, sizeof(ThreadVars));
//pca = (SCPerfPrivateContext *)&tv.perf_private_ctx; //pca = (StatsPrivateThreadContext *)&tv.perf_private_ctx;
RegisterCounter("t1", "c1", &tv.perf_public_ctx); RegisterCounter("t1", "c1", &tv.perf_public_ctx);
RegisterCounter("t2", "c2", &tv.perf_public_ctx); RegisterCounter("t2", "c2", &tv.perf_public_ctx);
@ -1437,7 +1437,7 @@ static int SCPerfTestCntArraySize07()
static int SCPerfTestUpdateCounter08() static int SCPerfTestUpdateCounter08()
{ {
ThreadVars tv; ThreadVars tv;
SCPerfPrivateContext *pca = NULL; StatsPrivateThreadContext *pca = NULL;
int id; int id;
int result; int result;
@ -1462,7 +1462,7 @@ static int SCPerfTestUpdateCounter08()
static int SCPerfTestUpdateCounter09() static int SCPerfTestUpdateCounter09()
{ {
ThreadVars tv; ThreadVars tv;
SCPerfPrivateContext *pca = NULL; StatsPrivateThreadContext *pca = NULL;
uint16_t id1, id2; uint16_t id1, id2;
int result; int result;
@ -1491,7 +1491,7 @@ static int SCPerfTestUpdateCounter09()
static int SCPerfTestUpdateGlobalCounter10() static int SCPerfTestUpdateGlobalCounter10()
{ {
ThreadVars tv; ThreadVars tv;
SCPerfPrivateContext *pca = NULL; StatsPrivateThreadContext *pca = NULL;
int result = 1; int result = 1;
uint16_t id1, id2, id3; uint16_t id1, id2, id3;
@ -1525,7 +1525,7 @@ static int SCPerfTestUpdateGlobalCounter10()
static int SCPerfTestCounterValues11() static int SCPerfTestCounterValues11()
{ {
ThreadVars tv; ThreadVars tv;
SCPerfPrivateContext *pca = NULL; StatsPrivateThreadContext *pca = NULL;
int result = 1; int result = 1;
uint16_t id1, id2, id3, id4; uint16_t id1, id2, id3, id4;

@ -73,7 +73,7 @@ typedef struct StatsPublicThreadContext_ {
} StatsPublicThreadContext; } StatsPublicThreadContext;
/** /**
* \brief Node elements used by the SCPerfPrivateContext(PCA) Node * \brief Node elements used by the StatsPrivateThreadContext(PCA) Node
*/ */
typedef struct SCPCAElem_ { typedef struct SCPCAElem_ {
/* pointer to the PerfCounter that corresponds to this PCAElem */ /* pointer to the PerfCounter that corresponds to this PCAElem */
@ -92,7 +92,7 @@ typedef struct SCPCAElem_ {
/** /**
* \brief used to hold the private version of the counters registered * \brief used to hold the private version of the counters registered
*/ */
typedef struct SCPerfPrivateContext_ { typedef struct StatsPrivateThreadContext_ {
/* points to the array holding PCAElems */ /* points to the array holding PCAElems */
SCPCAElem *head; SCPCAElem *head;
@ -100,7 +100,7 @@ typedef struct SCPerfPrivateContext_ {
uint32_t size; uint32_t size;
int initialized; int initialized;
} SCPerfPrivateContext; } StatsPrivateThreadContext;
/* the initialization functions */ /* the initialization functions */
void StatsInit(void); void StatsInit(void);
@ -115,13 +115,13 @@ 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 *, StatsPublicThreadContext *); int SCPerfUpdateCounterArray(StatsPrivateThreadContext *, StatsPublicThreadContext *);
uint64_t SCPerfGetLocalCounterValue(struct ThreadVars_ *, uint16_t); uint64_t SCPerfGetLocalCounterValue(struct ThreadVars_ *, uint16_t);
int SCPerfSetupPrivate(struct ThreadVars_ *); int SCPerfSetupPrivate(struct ThreadVars_ *);
/* functions used to free the resources alloted by the Perf counter API */ /* functions used to free the resources alloted by the Perf counter API */
void SCPerfReleaseResources(void); void SCPerfReleaseResources(void);
void SCPerfReleasePCA(SCPerfPrivateContext *); void SCPerfReleasePCA(StatsPrivateThreadContext *);
/* functions used to update local counter values */ /* functions used to update local counter values */
void StatsAddUI64(struct ThreadVars_ *, uint16_t, uint64_t); void StatsAddUI64(struct ThreadVars_ *, uint16_t, uint64_t);

@ -107,7 +107,7 @@ typedef struct ThreadVars_ {
StatsPublicThreadContext 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; StatsPrivateThreadContext perf_private_ctx;
SCCtrlMutex *ctrl_mutex; SCCtrlMutex *ctrl_mutex;
SCCtrlCondT *ctrl_cond; SCCtrlCondT *ctrl_cond;

Loading…
Cancel
Save