detect-address: remove debug mem counters

pull/1980/head
Victor Julien 10 years ago
parent e0111fbb90
commit 9bd8197009

@ -54,18 +54,6 @@ static int DetectAddressCut(DetectEngineCtx *, DetectAddress *, DetectAddress *,
DetectAddress **);
int DetectAddressMergeNot(DetectAddressHead *gh, DetectAddressHead *ghn);
/** memory usage counters
* \todo not MT safe */
#ifdef DEBUG
static uint32_t detect_address_group_memory = 0;
static uint32_t detect_address_group_init_cnt = 0;
static uint32_t detect_address_group_free_cnt = 0;
static uint32_t detect_address_group_head_memory = 0;
static uint32_t detect_address_group_head_init_cnt = 0;
static uint32_t detect_address_group_head_free_cnt = 0;
#endif
/**
* \brief Creates and returns a new instance of a DetectAddress.
*
@ -79,11 +67,6 @@ DetectAddress *DetectAddressInit(void)
return NULL;
memset(ag, 0, sizeof(DetectAddress));
#ifdef DEBUG
detect_address_group_memory += sizeof(DetectAddress);
detect_address_group_init_cnt++;
#endif
return ag;
}
@ -107,10 +90,6 @@ void DetectAddressFree(DetectAddress *ag)
}
ag->sh = NULL;
#ifdef DEBUG
detect_address_group_memory -= sizeof(DetectAddress);
detect_address_group_free_cnt++;
#endif
SCFree(ag);
return;
@ -140,42 +119,6 @@ DetectAddress *DetectAddressCopy(DetectAddress *orig)
return ag;
}
/**
* \brief Prints the memory statistics for the detection-engine-address section.
*/
void DetectAddressPrintMemory(void)
{
#ifdef DEBUG
SCLogDebug(" * Address group memory stats (DetectAddress %" PRIuMAX "):",
(uintmax_t)sizeof(DetectAddress));
SCLogDebug(" - detect_address_group_memory %" PRIu32,
detect_address_group_memory);
SCLogDebug(" - detect_address_group_init_cnt %" PRIu32,
detect_address_group_init_cnt);
SCLogDebug(" - detect_address_group_free_cnt %" PRIu32,
detect_address_group_free_cnt);
SCLogDebug(" - outstanding groups %" PRIu32,
detect_address_group_init_cnt - detect_address_group_free_cnt);
SCLogDebug(" * Address group memory stats done");
SCLogDebug(" * Address group head memory stats (DetectAddressHead %" PRIuMAX "):",
(uintmax_t)sizeof(DetectAddressHead));
SCLogDebug(" - detect_address_group_head_memory %" PRIu32,
detect_address_group_head_memory);
SCLogDebug(" - detect_address_group_head_init_cnt %" PRIu32,
detect_address_group_head_init_cnt);
SCLogDebug(" - detect_address_group_head_free_cnt %" PRIu32,
detect_address_group_head_free_cnt);
SCLogDebug(" - outstanding groups %" PRIu32,
(detect_address_group_head_init_cnt -
detect_address_group_head_free_cnt));
SCLogDebug(" * Address group head memory stats done");
SCLogDebug(" X Total %" PRIu32 "\n", (detect_address_group_memory +
detect_address_group_head_memory));
#endif
return;
}
/**
* \brief Used to check if a DetectAddress list contains an instance with
* a similar DetectAddress. The comparison done is not the one that
@ -1485,11 +1428,6 @@ DetectAddressHead *DetectAddressHeadInit(void)
return NULL;
memset(gh, 0, sizeof(DetectAddressHead));
#ifdef DEBUG
detect_address_group_head_init_cnt++;
detect_address_group_head_memory += sizeof(DetectAddressHead);
#endif
return gh;
}
@ -1531,10 +1469,6 @@ void DetectAddressHeadFree(DetectAddressHead *gh)
if (gh != NULL) {
DetectAddressHeadCleanup(gh);
SCFree(gh);
#ifdef DEBUG
detect_address_group_head_free_cnt++;
detect_address_group_head_memory -= sizeof(DetectAddressHead);
#endif
}
return;

@ -26,7 +26,6 @@
/* prototypes */
void DetectAddressRegister (void);
void DetectAddressPrintMemory(void);
DetectAddressHead *DetectAddressHeadInit(void);
void DetectAddressHeadFree(DetectAddressHead *);

@ -9241,7 +9241,7 @@ static int DetectIPProtoTestSig1(void)
uint16_t buflen = strlen((char *)buf);
Packet *p = UTHBuildPacket((uint8_t *)buf, buflen, IPPROTO_TCP);
if (p == NULL)
goto end;
return 0;
char *sigs[4];
sigs[0] = "alert ip any any -> any any "
@ -9268,8 +9268,6 @@ static int DetectIPProtoTestSig1(void)
result = UTHGenericTest(&p, 1, sigs, sid, results, 4);
UTHFreePacket(p);
end:
DetectAddressPrintMemory();
return result;
}

@ -585,7 +585,6 @@ cleanup:
DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
DetectEngineCtxFree(de_ctx);
DetectAddressPrintMemory();
UTHFreePackets(&p, 1);
end:
return result;

@ -8539,7 +8539,6 @@ static int SigTestMemory01 (void)
DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx);
printf("@pre cleanup\n\n");
DetectAddressPrintMemory();
DetectPortPrintMemory();
SigGroupCleanup(de_ctx);
@ -8547,7 +8546,6 @@ printf("@pre cleanup\n\n");
DetectEngineCtxFree(de_ctx);
printf("@exit\n\n");
DetectAddressPrintMemory();
DetectPortPrintMemory();
result = 1;
@ -8587,10 +8585,8 @@ printf("@cleanup\n\n");
DetectEngineCtxFree(de_ctx);
printf("@exit\n\n");
DetectAddressPrintMemory();
DetectPortPrintMemory();
printf("@exit\n\n");
DetectAddressPrintMemory();
DetectPortPrintMemory();
result = 1;
@ -8634,7 +8630,6 @@ printf("@cleanup\n\n");
DetectEngineCtxFree(de_ctx);
printf("@exit\n\n");
DetectAddressPrintMemory();
DetectPortPrintMemory();
result = 1;

Loading…
Cancel
Save