summaryrefslogtreecommitdiff
path: root/nDPId-test.c
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2022-03-24 01:04:49 +0100
committerToni Uhlig <matzeton@googlemail.com>2022-03-24 01:04:49 +0100
commit65a9e5a18daf10cc2b8c7266d1ac0a9bcb7f1c4c (patch)
tree5b13befcee7e759c71618dc676884fe0d63a5726 /nDPId-test.c
parentc0b7bdacbc15c1cf5eaeb9faefc088aa698e94ba (diff)
Executing ./tests/run_tests.sh w/o zLib should not result in diff's anymore.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'nDPId-test.c')
-rw-r--r--nDPId-test.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/nDPId-test.c b/nDPId-test.c
index a37cec300..90f02ae65 100644
--- a/nDPId-test.c
+++ b/nDPId-test.c
@@ -990,28 +990,45 @@ int main(int argc, char ** argv)
nDPId_return.total_idle_flows,
distributor_return.stats.total_flow_timeouts);
- unsigned long long int total_memory_alloc =
+ unsigned long long int total_alloc_bytes =
#ifdef ENABLE_ZLIB
- (unsigned long long int)(ndpi_memory_alloc_bytes - zlib_compression_bytes);
+ (unsigned long long int)(ndpi_memory_alloc_bytes - zlib_compression_bytes - (zlib_compressions * sizeof(struct nDPId_detection_data)));
#else
(unsigned long long int)ndpi_memory_alloc_bytes;
#endif
- unsigned long long int total_memory_free =
+ unsigned long long int total_free_bytes =
#ifdef ENABLE_ZLIB
- (unsigned long long int)(ndpi_memory_free_bytes - zlib_compression_bytes);
+ (unsigned long long int)(ndpi_memory_free_bytes - zlib_compression_bytes - (zlib_compressions * sizeof(struct nDPId_detection_data)));
#else
(unsigned long long int)ndpi_memory_free_bytes;
#endif
+ unsigned long long int total_alloc_count =
+#ifdef ENABLE_ZLIB
+ (unsigned long long int)(ndpi_memory_alloc_count - zlib_compressions * 2);
+#else
+ (unsigned long long int)ndpi_memory_alloc_count;
+#endif
+
+ unsigned long long int total_free_count =
+#ifdef ENABLE_ZLIB
+ (unsigned long long int)(ndpi_memory_free_count - zlib_decompressions * 2);
+#else
+ (unsigned long long int)ndpi_memory_free_count;
+#endif
+
printf(
"~~ total memory allocated....: %llu bytes\n"
"~~ total memory freed........: %llu bytes\n"
"~~ total allocations/frees...: %llu/%llu\n"
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
- total_memory_alloc,
- total_memory_free,
- (unsigned long long int)ndpi_memory_alloc_count,
- (unsigned long long int)ndpi_memory_free_count);
+ total_alloc_bytes -
+ sizeof(struct nDPId_workflow) *
+ nDPId_options.reader_thread_count /* We do not want to take the workflow into account. */,
+ total_free_bytes -
+ sizeof(struct nDPId_workflow) *
+ nDPId_options.reader_thread_count /* We do not want to take the workflow into account. */,
+ total_alloc_count, total_free_count);
printf(
"~~ json string min len.......: %llu chars\n"