counters: remove references to 'perf' counters

pull/1508/head
Victor Julien 11 years ago
parent faef92f8da
commit f05d0692ef

@ -46,7 +46,7 @@
/** /**
* \brief Different kinds of qualifier that can be used to modify the behaviour * \brief Different kinds of qualifier that can be used to modify the behaviour
* of the Perf counter to be registered * of the counter to be registered
*/ */
enum { enum {
STATS_TYPE_NORMAL = 1, STATS_TYPE_NORMAL = 1,
@ -231,8 +231,8 @@ static void StatsInitCtx(void)
} }
/** /**
* \brief Releases the resources alloted to the output context of the Perf * \brief Releases the resources alloted to the output context of the
* Counter API * Stats API
*/ */
static void StatsReleaseCtx() static void StatsReleaseCtx()
{ {
@ -267,10 +267,9 @@ static void StatsReleaseCtx()
} }
/** /**
* \brief The management thread. This thread is responsible for writing the * \brief management thread. This thread is responsible for writing the stats
* performance stats information.
* *
* \param arg is NULL always * \param arg thread var
* *
* \retval NULL This is the value that is always returned * \retval NULL This is the value that is always returned
*/ */
@ -297,7 +296,7 @@ static void *StatsMgmtThread(void *arg)
SCDropCaps(tv_local); SCDropCaps(tv_local);
if (stats_ctx == NULL) { if (stats_ctx == NULL) {
SCLogError(SC_ERR_PERF_STATS_NOT_INIT, "Perf Counter API not init" SCLogError(SC_ERR_STATS_NOT_INIT, "Stats API not init"
"StatsInitCounterApi() has to be called first"); "StatsInitCounterApi() has to be called first");
TmThreadsSetFlag(tv_local, THV_CLOSED | THV_RUNNING_DONE); TmThreadsSetFlag(tv_local, THV_CLOSED | THV_RUNNING_DONE);
return NULL; return NULL;
@ -307,7 +306,7 @@ static void *StatsMgmtThread(void *arg)
BUG_ON(tm->ThreadInit == NULL); BUG_ON(tm->ThreadInit == NULL);
int r = tm->ThreadInit(tv_local, NULL, &stats_thread_data); int r = tm->ThreadInit(tv_local, NULL, &stats_thread_data);
if (r != 0 || stats_thread_data == NULL) { if (r != 0 || stats_thread_data == NULL) {
SCLogError(SC_ERR_THREAD_INIT, "Perf Counter API " SCLogError(SC_ERR_THREAD_INIT, "Stats API "
"ThreadInit failed"); "ThreadInit failed");
TmThreadsSetFlag(tv_local, THV_CLOSED | THV_RUNNING_DONE); TmThreadsSetFlag(tv_local, THV_CLOSED | THV_RUNNING_DONE);
return NULL; return NULL;
@ -343,7 +342,7 @@ static void *StatsMgmtThread(void *arg)
r = tm->ThreadDeinit(tv_local, stats_thread_data); r = tm->ThreadDeinit(tv_local, stats_thread_data);
if (r != TM_ECODE_OK) { if (r != TM_ECODE_OK) {
SCLogError(SC_ERR_THREAD_DEINIT, "Perf Counter API " SCLogError(SC_ERR_THREAD_DEINIT, "Stats Counter API "
"ThreadDeinit failed"); "ThreadDeinit failed");
} }
@ -384,7 +383,7 @@ static void *StatsWakeupThread(void *arg)
SCDropCaps(tv_local); SCDropCaps(tv_local);
if (stats_ctx == NULL) { if (stats_ctx == NULL) {
SCLogError(SC_ERR_PERF_STATS_NOT_INIT, "Perf Counter API not init" SCLogError(SC_ERR_STATS_NOT_INIT, "Stats API not init"
"StatsInitCounterApi() has to be called first"); "StatsInitCounterApi() has to be called first");
TmThreadsSetFlag(tv_local, THV_CLOSED | THV_RUNNING_DONE); TmThreadsSetFlag(tv_local, THV_CLOSED | THV_RUNNING_DONE);
return NULL; return NULL;
@ -454,8 +453,7 @@ static void *StatsWakeupThread(void *arg)
} }
/** /**
* \brief Releases a perf counter. Used internally by * \brief Releases a counter
* StatsReleasePerfCounters()
* *
* \param pc Pointer to the StatsCounter to be freed * \param pc Pointer to the StatsCounter to be freed
*/ */
@ -472,7 +470,7 @@ static void StatsReleaseCounter(StatsCounter *pc)
} }
/** /**
* \brief Registers a counter. Used internally by the Perf Counter API * \brief Registers a counter.
* *
* \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
@ -523,7 +521,7 @@ static uint16_t StatsRegisterQualifiedCounter(char *cname, char *tm_name,
} }
/* assign a unique id to this StatsCounter. The id is local to this /* assign a unique id to this StatsCounter. The id is local to this
* PerfContext. Please note that the id start from 1, and not 0 */ * thread context. Please note that the id start from 1, and not 0 */
pc->id = ++(pctx->curr_id); pc->id = ++(pctx->curr_id);
pc->type = type_q; pc->type = type_q;
@ -760,8 +758,7 @@ void StatsSetupPostConfig(void)
} }
/** /**
* \brief Spawns the wakeup, and the management thread used by the perf * \brief Spawns the wakeup, and the management thread used by the stats api
* counter api
* *
* The threads use the condition variable in the thread vars to control * The threads use the condition variable in the thread vars to control
* their wait loops to make sure the main thread can quickly kill them. * their wait loops to make sure the main thread can quickly kill them.
@ -1147,7 +1144,7 @@ uint64_t StatsGetLocalCounterValue(ThreadVars *tv, uint16_t id)
} }
/** /**
* \brief Releases the resources alloted by the Perf Counter API * \brief Releases the resources alloted by the Stats API
*/ */
void StatsReleaseResources() void StatsReleaseResources()
{ {
@ -1157,12 +1154,12 @@ void StatsReleaseResources()
} }
/** /**
* \brief Releases a list of perf counters * \brief Releases counters
* *
* \param head Pointer to the head of the list of perf counters that have to * \param head Pointer to the head of the list of perf counters that have to
* be freed * be freed
*/ */
void StatsReleasePerfCounters(StatsCounter *head) void StatsReleaseCounters(StatsCounter *head)
{ {
StatsCounter *pc = NULL; StatsCounter *pc = NULL;
@ -1236,7 +1233,7 @@ static int StatsTestCounterReg03()
result = RegisterCounter("t1", "c1", &pctx); result = RegisterCounter("t1", "c1", &pctx);
StatsReleasePerfCounters(pctx.head); StatsReleaseCounters(pctx.head);
return result; return result;
} }
@ -1254,7 +1251,7 @@ static int StatsTestCounterReg04()
result = RegisterCounter("t1", "c1", &pctx); result = RegisterCounter("t1", "c1", &pctx);
StatsReleasePerfCounters(pctx.head); StatsReleaseCounters(pctx.head);
return result; return result;
} }
@ -1292,7 +1289,7 @@ static int StatsTestGetCntArray06()
result = (r == 0) ? 1 : 0; result = (r == 0) ? 1 : 0;
StatsReleasePerfCounters(tv.perf_public_ctx.head); StatsReleaseCounters(tv.perf_public_ctx.head);
StatsReleasePrivateThreadContext(&tv.perf_private_ctx); StatsReleasePrivateThreadContext(&tv.perf_private_ctx);
return result; return result;
@ -1319,7 +1316,7 @@ static int StatsTestCntArraySize07()
result = pca->size; result = pca->size;
StatsReleasePerfCounters(tv.perf_public_ctx.head); StatsReleaseCounters(tv.perf_public_ctx.head);
StatsReleasePrivateThreadContext(pca); StatsReleasePrivateThreadContext(pca);
return result; return result;
@ -1344,7 +1341,7 @@ static int StatsTestUpdateCounter08()
result = pca->head[id].value; result = pca->head[id].value;
StatsReleasePerfCounters(tv.perf_public_ctx.head); StatsReleaseCounters(tv.perf_public_ctx.head);
StatsReleasePrivateThreadContext(pca); StatsReleasePrivateThreadContext(pca);
return result; return result;
@ -1373,7 +1370,7 @@ static int StatsTestUpdateCounter09()
result = (pca->head[id1].value == 0) && (pca->head[id2].value == 101); result = (pca->head[id1].value == 0) && (pca->head[id2].value == 101);
StatsReleasePerfCounters(tv.perf_public_ctx.head); StatsReleaseCounters(tv.perf_public_ctx.head);
StatsReleasePrivateThreadContext(pca); StatsReleasePrivateThreadContext(pca);
return result; return result;
@ -1407,7 +1404,7 @@ static int StatsTestUpdateGlobalCounter10()
result &= (100 == tv.perf_public_ctx.head->next->value); result &= (100 == tv.perf_public_ctx.head->next->value);
result &= (101 == tv.perf_public_ctx.head->next->next->value); result &= (101 == tv.perf_public_ctx.head->next->next->value);
StatsReleasePerfCounters(tv.perf_public_ctx.head); StatsReleaseCounters(tv.perf_public_ctx.head);
StatsReleasePrivateThreadContext(pca); StatsReleasePrivateThreadContext(pca);
return result; return result;
@ -1446,7 +1443,7 @@ static int StatsTestCounterValues11()
result &= (16843024 == tv.perf_public_ctx.head->next->next->next->value); result &= (16843024 == tv.perf_public_ctx.head->next->next->next->value);
StatsReleasePerfCounters(tv.perf_public_ctx.head); StatsReleaseCounters(tv.perf_public_ctx.head);
StatsReleasePrivateThreadContext(pca); StatsReleasePrivateThreadContext(pca);
return result; return result;

@ -109,7 +109,7 @@ void StatsSetupPostConfig(void);
void StatsSpawnThreads(void); void StatsSpawnThreads(void);
void StatsRegisterTests(void); void StatsRegisterTests(void);
/* functions used to free the resources alloted by the Perf counter API */ /* functions used to free the resources alloted by the Stats API */
void StatsReleaseResources(void); void StatsReleaseResources(void);
/* counter registration functions */ /* counter registration functions */

@ -264,7 +264,7 @@ const char * SCErrorToString(SCError err)
CASE_CODE (SC_ERR_SYSCALL); CASE_CODE (SC_ERR_SYSCALL);
CASE_CODE (SC_ERR_SYSCONF); CASE_CODE (SC_ERR_SYSCONF);
CASE_CODE (SC_ERR_INVALID_ARGUMENTS); CASE_CODE (SC_ERR_INVALID_ARGUMENTS);
CASE_CODE (SC_ERR_PERF_STATS_NOT_INIT); CASE_CODE (SC_ERR_STATS_NOT_INIT);
CASE_CODE (SC_ERR_NFQ_OPEN); CASE_CODE (SC_ERR_NFQ_OPEN);
CASE_CODE (SC_ERR_NFQ_MAXLEN); CASE_CODE (SC_ERR_NFQ_MAXLEN);
CASE_CODE (SC_ERR_NFQ_CREATE_QUEUE); CASE_CODE (SC_ERR_NFQ_CREATE_QUEUE);

@ -80,7 +80,7 @@ typedef enum {
SC_ERR_SYSCALL, SC_ERR_SYSCALL,
SC_ERR_SYSCONF, SC_ERR_SYSCONF,
SC_ERR_INVALID_ARGUMENTS, SC_ERR_INVALID_ARGUMENTS,
SC_ERR_PERF_STATS_NOT_INIT, SC_ERR_STATS_NOT_INIT,
SC_ERR_COMPLETE_PORT_SPACE_NEGATED, SC_ERR_COMPLETE_PORT_SPACE_NEGATED,
SC_ERR_NO_PORTS_LEFT_AFTER_MERGE, SC_ERR_NO_PORTS_LEFT_AFTER_MERGE,
SC_ERR_NEGATED_VALUE_IN_PORT_RANGE, SC_ERR_NEGATED_VALUE_IN_PORT_RANGE,

Loading…
Cancel
Save