diff options
Diffstat (limited to 'nDPId-test.c')
-rw-r--r-- | nDPId-test.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/nDPId-test.c b/nDPId-test.c index 38f327a38..d48784f38 100644 --- a/nDPId-test.c +++ b/nDPId-test.c @@ -7,7 +7,7 @@ extern void nDPIsrvd_memprof_log(char const * const format, ...); extern void nDPIsrvd_memprof_log_alloc(size_t alloc_size); extern void nDPIsrvd_memprof_log_free(size_t free_size); -//#define VERBOSE_MEMORY_PROFILING 1 +// #define VERBOSE_MEMORY_PROFILING 1 #define NO_MAIN 1 #include "utils.c" #include "nio.c" @@ -1315,7 +1315,7 @@ static void * nDPId_mainloop_thread(void * const arg) } run_capture_loop(&reader_threads[0]); process_remaining_flows(); - for (size_t i = 0; i < nDPId_options.reader_thread_count; ++i) + for (size_t i = 0; i < GET_CMDARG_ULL(nDPId_options.reader_thread_count); ++i) { nrv->packets_captured += reader_threads[i].workflow->packets_captured; nrv->packets_processed += reader_threads[i].workflow->packets_processed; @@ -1667,27 +1667,30 @@ int main(int argc, char ** argv) return retval; } - nDPIsrvd_options.max_write_buffers = 32; - nDPId_options.enable_data_analysis = 1; - nDPId_options.max_packets_per_flow_to_send = 5; + set_cmdarg_ull(&nDPIsrvd_options.max_write_buffers, 32); + set_cmdarg_boolean(&nDPId_options.enable_data_analysis, 1); + set_cmdarg_ull(&nDPId_options.max_packets_per_flow_to_send, 5); #ifdef ENABLE_ZLIB /* * zLib compression is forced enabled for testing. * Remember to compile nDPId with zlib enabled. * There will be diff's while running `test/run_tests.sh' otherwise. */ - nDPId_options.enable_zlib_compression = 1; + set_cmdarg_boolean(&nDPId_options.enable_zlib_compression, 1); #endif - nDPId_options.memory_profiling_log_interval = (unsigned long long int)-1; - nDPId_options.reader_thread_count = 1; /* Please do not change this! Generating meaningful pcap diff's relies on a - single reader thread! */ - set_cmdarg(&nDPId_options.instance_alias, "nDPId-test"); + set_cmdarg_ull(&nDPId_options.memory_profiling_log_interval, (unsigned long long int)-1); + set_cmdarg_ull(&nDPId_options.reader_thread_count, 1); /* Please do not change this! Generating meaningful pcap + diff's relies on a single reader thread! */ + set_cmdarg_string(&nDPId_options.instance_alias, "nDPId-test"); if (access(argv[1], R_OK) != 0) { logger(1, "%s: pcap file `%s' does not exist or is not readable", argv[0], argv[1]); return 1; } - set_cmdarg(&nDPId_options.pcap_file_or_interface, argv[1]); + set_cmdarg_string(&nDPId_options.pcap_file_or_interface, argv[1]); + set_config_defaults(&config_map[0], nDPIsrvd_ARRAY_LENGTH(config_map)); + set_config_defaults(&general_config_map[0], nDPIsrvd_ARRAY_LENGTH(general_config_map)); + set_config_defaults(&tuning_config_map[0], nDPIsrvd_ARRAY_LENGTH(tuning_config_map)); if (validate_options() != 0) { return 1; @@ -1845,10 +1848,12 @@ int main(int argc, char ** argv) "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n", total_alloc_bytes - sizeof(struct nDPId_workflow) * - nDPId_options.reader_thread_count /* We do not want to take the workflow into account. */, + GET_CMDARG_ULL( + 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. */, + GET_CMDARG_ULL( + nDPId_options.reader_thread_count) /* We do not want to take the workflow into account. */, total_alloc_count, total_free_count); |