diff options
Diffstat (limited to 'test/dns_decoder_perf_main.cpp')
| -rw-r--r-- | test/dns_decoder_perf_main.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/test/dns_decoder_perf_main.cpp b/test/dns_decoder_perf_main.cpp index 3e81287..2046c62 100644 --- a/test/dns_decoder_perf_main.cpp +++ b/test/dns_decoder_perf_main.cpp @@ -100,10 +100,24 @@ extern "C" int commit_test_result_json(cJSON *node, const char *name) return 0; } -void perf_resource_record_decode(struct dns_message *dns_msg) +extern void dns_message_answer_resource_record_get0(struct dns_message *msg, struct dns_resource_record **answer_rr, uint16_t *n_answer_rr); +extern void dns_message_authority_resource_record_get0(struct dns_message *msg, struct dns_resource_record **authority_rr, uint16_t *n_authority_rr); +extern void dns_message_additional_resource_record_get0(struct dns_message *msg, struct dns_resource_record **additional_rr, uint16_t *n_additional_rr); + +void perf_resource_record_decode(struct dns_message *msg) { TIME_START(); + uint16_t n_answer_rr=0; + struct dns_resource_record *answer_rr=NULL; + dns_message_answer_resource_record_get0(msg, &answer_rr, &n_answer_rr); + + uint16_t n_authority_rr=0; + struct dns_resource_record *authority_rr=NULL; + dns_message_authority_resource_record_get0(msg, &authority_rr, &n_authority_rr); + uint16_t n_additional_rr=0; + struct dns_resource_record *additional_rr=NULL; + dns_message_additional_resource_record_get0(msg, &additional_rr, &n_additional_rr); TIME_DIFF(); //fieldstat_easy_histogram_record(main_env->fse.handle, tid, main_env->fse.id[PERF_TAG_QUESTION], &(main_env->fse.tag[PERF_TAG_QUESTION]), 1, time_diff_ns) } @@ -207,8 +221,16 @@ int32_t dns_decoder_test_config_load(const char *cfg_path, struct perf_main_env toml_free(root); return -1; } + + toml_table_t *perf_tbl=toml_table_in(test_tbl, "perf"); + if(NULL==perf_tbl) + { + fprintf(stderr, "[%s:%d] config file: %s has no key: [decoder.dns.test.perf]", __FUNCTION__, __LINE__, cfg_path); + toml_free(root); + return -1; + } - toml_datum_t perf_worker_thread_num_val=toml_int_in(test_tbl, "perf_worker_thread_num"); + toml_datum_t perf_worker_thread_num_val=toml_int_in(perf_tbl, "perf_worker_thread_num"); if(perf_worker_thread_num_val.ok) { main_env->worker_thread_num=perf_worker_thread_num_val.u.i; |
