From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2176DC5B57D for ; Fri, 5 Jul 2019 06:34:45 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id B6BA9218BC for ; Fri, 5 Jul 2019 06:34:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B6BA9218BC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CD0EB559A; Fri, 5 Jul 2019 08:34:43 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id E59165587 for ; Fri, 5 Jul 2019 08:34:42 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Jul 2019 23:34:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,454,1557212400"; d="scan'208";a="248102035" Received: from atrybulx-mobl.ger.corp.intel.com (HELO build-VirtualBox.isw.intel.com) ([10.103.104.106]) by orsmga001.jf.intel.com with ESMTP; 04 Jul 2019 23:34:37 -0700 From: Artur Trybula To: dev@dpdk.org, fiona.trahe@intel.com, shally.verma@caviumnetworks.com, adamx.dybkowski@intel.com, arturx.trybula@intel.com, akhil.goyal@nxp.com Date: Fri, 5 Jul 2019 08:30:14 +0200 Message-Id: <20190705063014.25503-2-arturx.trybula@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190705063014.25503-1-arturx.trybula@intel.com> References: <20190603102401.25715-1-arturx.trybula@intel.com> <20190705063014.25503-1-arturx.trybula@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=y Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 1/1] app/test-compress-perf: report header improvement X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch adds extra features to the compress performance test. Some important parameters (memory allocation, number of ops, number of segments) are calculated and printed out on the screen. Signed-off-by: Artur Trybula --- .../comp_perf_test_common.c | 94 ++++++++++++++++++- .../comp_perf_test_common.h | 3 + app/test-compress-perf/main.c | 4 +- 3 files changed, 98 insertions(+), 3 deletions(-) diff --git a/app/test-compress-perf/comp_perf_test_common.c b/app/test-compress-perf/comp_perf_test_common.c index dc9d0b0f4..dc3eaccac 100644 --- a/app/test-compress-perf/comp_perf_test_common.c +++ b/app/test-compress-perf/comp_perf_test_common.c @@ -15,6 +15,19 @@ #define DIV_CEIL(a, b) ((a) / (b) + ((a) % (b) != 0)) +struct performance_tests_results { + uint16_t total_segments; + uint16_t segment_sz; + uint16_t last_segment_sz; + uint32_t total_buffs; /*number of buffers = number of ops*/ + uint16_t segments_per_buff; + uint16_t segments_per_last_buff; + size_t input_data_sz; +}; + +static struct performance_tests_results tests_res; +//extern static struct performance_tests_results tests_res; + int param_range_check(uint16_t size, const struct rte_param_log2_range *range) { @@ -169,6 +182,13 @@ comp_perf_allocate_memory(struct comp_test_data *test_data, " could not be allocated\n"); return -1; } + + tests_res.total_segments = total_segs; + tests_res.segment_sz = test_data->seg_sz; + tests_res.total_buffs = mem->total_bufs; + tests_res.segments_per_buff = test_data->max_sgl_segs; + tests_res.input_data_sz = test_data->input_data_sz; + return 0; } @@ -177,9 +197,10 @@ prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem) { uint32_t remaining_data = test_data->input_data_sz; uint8_t *input_data_ptr = test_data->input_data; - size_t data_sz; + size_t data_sz = 0; uint8_t *data_addr; uint32_t i, j; + uint16_t segs_per_mbuf = 0; for (i = 0; i < mem->total_bufs; i++) { /* Allocate data in input mbuf and copy data from input file */ @@ -203,7 +224,7 @@ prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem) remaining_data -= data_sz; /* Already one segment in the mbuf */ - uint16_t segs_per_mbuf = 1; + segs_per_mbuf = 1; /* Chain mbufs if needed for input mbufs */ while (segs_per_mbuf < test_data->max_sgl_segs @@ -280,5 +301,74 @@ prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem) } } + tests_res.segments_per_last_buff = segs_per_mbuf; + tests_res.last_segment_sz = data_sz; + return 0; } + +void +print_test_dynamics(void) +{ + uint32_t opt_total_segs = DIV_CEIL(tests_res.input_data_sz, + MAX_SEG_SIZE); + + if (tests_res.total_buffs > 1) { + printf("\nWarning: for the current input parameters number" + " of ops is higher than one, which may result" + " in sub-optimal performance.\n"); + printf("To improve the performance (for the current" + " input data) following parameters are" + " suggested:\n"); + printf(" • Segment size: %d\n", MAX_SEG_SIZE); + printf(" • Number of segments: %u\n", opt_total_segs); + } else if (tests_res.total_buffs == 1) { + printf("\nWarning: There is only one op with %u segments –" + " the compression ratio is the best.\n", + tests_res.segments_per_last_buff); + if (tests_res.segment_sz < MAX_SEG_SIZE) + printf("To reduce compression time, please use" + " bigger segment size: %d.\n", + MAX_SEG_SIZE); + else if (tests_res.segment_sz == MAX_SEG_SIZE) + printf("Segment size is optimal for the best" + " performance.\n"); + } else + printf("Warning: something wrong happened!!\n"); + + printf("\nFor the current input parameters (segment size = %u," + " segments number = %u):\n", + tests_res.segment_sz, + tests_res.segments_per_buff); + printf(" • Total number of segments: %d\n", + tests_res.total_segments); + printf(" • %u segments %u bytes long, last segment %u" + " byte(s) long\n", + tests_res.total_segments - 1, + tests_res.segment_sz, + tests_res.last_segment_sz); + printf(" • Number of ops: %u\n", tests_res.total_buffs); + printf(" • Total memory allocation: %u\n", + (tests_res.total_segments - 1) * tests_res.segment_sz + + tests_res.last_segment_sz); + if (tests_res.total_buffs > 1) + printf(" • %u ops: %u segments in each," + " segment size %u\n", + tests_res.total_buffs - 1, + tests_res.segments_per_buff, + tests_res.segment_sz); + if (tests_res.segments_per_last_buff > 1) { + printf(" • 1 op %u segments:\n", + tests_res.segments_per_last_buff); + printf(" o %u segment size %u\n", + tests_res.segments_per_last_buff - 1, + tests_res.segment_sz); + printf(" o last segment size %u\n", + tests_res.last_segment_sz); + } else if (tests_res.segments_per_last_buff == 1) { + printf(" • 1 op (the last one): %u segment %u" + " byte(s) long\n\n", + tests_res.segments_per_last_buff, + tests_res.last_segment_sz); + } +} diff --git a/app/test-compress-perf/comp_perf_test_common.h b/app/test-compress-perf/comp_perf_test_common.h index 9c11e3a00..c72f3ef3c 100644 --- a/app/test-compress-perf/comp_perf_test_common.h +++ b/app/test-compress-perf/comp_perf_test_common.h @@ -38,4 +38,7 @@ comp_perf_allocate_memory(struct comp_test_data *test_data, int prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem); +void +print_test_dynamics(void); + #endif /* _COMP_PERF_TEST_COMMON_H_ */ diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c index e746e4708..76961bffb 100644 --- a/app/test-compress-perf/main.c +++ b/app/test-compress-perf/main.c @@ -363,7 +363,7 @@ main(int argc, char **argv) printf("App uses socket: %u\n", rte_socket_id()); printf("Burst size = %u\n", test_data->burst_sz); - printf("File size = %zu\n", test_data->input_data_sz); + printf("Input data size = %zu\n", test_data->input_data_sz); test_data->cleanup = ST_DURING_TEST; total_nb_qps = nb_compressdevs * test_data->nb_qps; @@ -390,6 +390,8 @@ main(int argc, char **argv) i++; } + print_test_dynamics(); + while (test_data->level <= test_data->level_lst.max) { i = 0; -- 2.17.1