Host: ignore usecnt add/sub result. Expose HostPrintStats.

pull/211/merge
Victor Julien 12 years ago
parent e30b1bfe64
commit 18535e6ef9

@ -234,12 +234,14 @@ void HostInitConfig(char quiet)
/** \brief print some host stats
* \warning Not thread safe */
static void HostPrintStats (void)
void HostPrintStats (void)
{
#ifdef HOSTBITS_STATS
SCLogInfo("hostbits added: %" PRIu32 ", removed: %" PRIu32 ", max memory usage: %" PRIu32 "",
hostbits_added, hostbits_removed, hostbits_memuse_max);
#endif /* HOSTBITS_STATS */
SCLogInfo("host memory usage: %llu bytes, maximum: %"PRIu64,
SC_ATOMIC_GET(host_memuse), host_config.memcap);
return;
}

@ -108,9 +108,9 @@ typedef struct HostConfig_ {
((((uint64_t)SC_ATOMIC_GET(host_memuse) + (uint64_t)(size)) <= host_config.memcap))
#define HostIncrUsecnt(h) \
SC_ATOMIC_ADD((h)->use_cnt, 1)
(void)SC_ATOMIC_ADD((h)->use_cnt, 1)
#define HostDecrUsecnt(h) \
SC_ATOMIC_SUB((h)->use_cnt, 1)
(void)SC_ATOMIC_SUB((h)->use_cnt, 1)
#define HostReference(dst_h_ptr, h) do { \
if ((h) != NULL) { \
@ -141,6 +141,7 @@ void HostLock(Host *);
void HostClearMemory(Host *);
void HostMoveToSpare(Host *);
uint32_t HostSpareQueueGetSize(void);
void HostPrintStats (void);
#endif /* __HOST_H__ */

Loading…
Cancel
Save