static void SCPerfReleaseCounter(SCPerfCounter *pc)
{
if (pc != NULL) {
- if (pc->name != NULL) {
- if (pc->name->cname != NULL)
- SCFree(pc->name->cname);
+ if (pc->cname != NULL)
+ SCFree(pc->cname);
- if (pc->name->tm_name != NULL)
- SCFree(pc->name->tm_name);
+ if (pc->tm_name != NULL)
+ SCFree(pc->tm_name);
- SCFree(pc->name);
- }
if (pc->desc != NULL)
SCFree(pc->desc);
while (temp != NULL) {
prev = temp;
- if (strcmp(cname, temp->name->cname) == 0 &&
- strcmp(tm_name, temp->name->tm_name) == 0) {
+ if (strcmp(cname, temp->cname) == 0 &&
+ strcmp(tm_name, temp->tm_name) == 0) {
break;
}
return 0;
memset(pc, 0, sizeof(SCPerfCounter));
- if ( (pc->name = SCMalloc(sizeof(SCPerfCounterName))) == NULL) {
- SCFree(pc);
- return 0;
- }
- memset(pc->name, 0, sizeof(SCPerfCounterName));
- if ( (pc->name->cname = SCStrdup(cname)) == NULL) {
+ if ( (pc->cname = SCStrdup(cname)) == NULL) {
SCLogError(SC_ERR_MEM_ALLOC, "Error allocating memory");
exit(EXIT_FAILURE);
}
- if ( (pc->name->tm_name = SCStrdup(tm_name)) == NULL) {
+ if ( (pc->tm_name = SCStrdup(tm_name)) == NULL) {
SCLogError(SC_ERR_MEM_ALLOC, "Error allocating memory");
exit(EXIT_FAILURE);
}
SCMutexLock(&pctmi->head[u]->m);
- while(pc_heads[u] != NULL && strcmp(pctmi->tm_name, pc_heads[u]->name->tm_name)) {
+ while(pc_heads[u] != NULL && strcmp(pctmi->tm_name, pc_heads[u]->tm_name)) {
pc_heads[u] = pc_heads[u]->next;
}
}
}
fprintf(sc_perf_op_ctx->fp, "%-25s | %-25s | %-" PRIu64 "\n",
- pc->name->cname, pctmi->tm_name, ui64_result);
+ pc->cname, pctmi->tm_name, ui64_result);
}
for (u = 0; u < pctmi->size; u++)
uint64_t value;
- SCPerfCounterName *name;
-
/* no of times the local counter has been synced with this counter */
uint64_t updated;
+ /* name of the counter */
+ char *cname;
+ /* name of the thread module this counter is registered to */
+ char *tm_name;
+
/* the next perfcounter for this tv's tm instance */
struct SCPerfCounter_ *next;