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

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

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

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

Loading…
Cancel
Save