#include "util-mem.h"
#include "util-misc.h"
+#include "app-layer-htp-mem.h"
+
uint64_t htp_config_memcap = 0;
SC_ATOMIC_DECLARE(uint64_t, htp_memuse);
return;
}
+void HTPMemuseCounter(ThreadVars *tv, TcpReassemblyThreadCtx *trt)
+{
+ uint64_t memusecopy = SC_ATOMIC_GET(htp_memuse);
+ SCPerfCounterSetUI64(trt->counter_htp_memuse, tv->sc_perf_pca, memusecopy);
+ return;
+}
/**
* \brief Check if alloc'ing "size" would mean we're over memcap
*
* 02110-1301, USA.
*/
+#include "stream-tcp-reassemble.h"
+
void HTPParseMemcap();
void *HTPMalloc(size_t size);
void *HTPRealloc(void *ptr, size_t orig_size, size_t size);
void HTPFree(void *ptr, size_t size);
+
+
+void HTPMemuseCounter(ThreadVars *tv, TcpReassemblyThreadCtx *trt);
#include "util-profiling.h"
#include "util-validate.h"
#include "decode-events.h"
+#include "app-layer-htp-mem.h"
/**
* \brief This is for the app layer in general and it contains per thread
}
}
+ /** \fixme a bit hacky but will be improved in 2.1 */
+ HTPMemuseCounter(tv, ra_ctx);
goto end;
failure:
r = -1;
uint16_t counter_tcp_reass_memuse;
/** count number of streams with a unrecoverable stream gap (missing pkts) */
uint16_t counter_tcp_reass_gap;
+ /** account memory usage by suricata to handle HTTP protocol (not counting
+ * libhtp memory usage)*/
+ uint16_t counter_htp_memuse;
} TcpReassemblyThreadCtx;
#define OS_POLICY_DEFAULT OS_POLICY_BSD
stt->ra_ctx->counter_tcp_reass_gap = SCPerfTVRegisterCounter("tcp.reassembly_gap", tv,
SC_PERF_TYPE_UINT64,
"NULL");
+ /** \fixme Find a better place in 2.1 as it is linked with app layer */
+ stt->ra_ctx->counter_htp_memuse = SCPerfTVRegisterCounter("http.memuse", tv,
+ SC_PERF_TYPE_UINT64,
+ "NULL");
SCLogDebug("StreamTcp thread specific ctx online at %p, reassembly ctx %p",
stt, stt->ra_ctx);