From 18535e6ef9f4ced7ab184f271f37df654760120e Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Fri, 16 Nov 2012 17:41:42 +0100 Subject: [PATCH] Host: ignore usecnt add/sub result. Expose HostPrintStats. --- src/host.c | 4 +++- src/host.h | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/host.c b/src/host.c index 76854660f7..7cf18dcdf7 100644 --- a/src/host.c +++ b/src/host.c @@ -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; } diff --git a/src/host.h b/src/host.h index c25a42e96a..ee835319f8 100644 --- a/src/host.h +++ b/src/host.h @@ -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__ */