From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 7EDF823D for ; Wed, 31 Oct 2018 01:42:13 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2018 17:42:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,446,1534834800"; d="scan'208";a="87829643" Received: from sivswdev01.ir.intel.com (HELO localhost.localdomain) ([10.237.217.45]) by orsmga008.jf.intel.com with ESMTP; 30 Oct 2018 17:42:10 -0700 From: Fiona Trahe To: dev@dpdk.org Cc: thomas@monjalon.net, akhil.goyal@nxp.com, tomaszx.jozwiak@intel.com, lee.daly@intel.com, Fiona Trahe Date: Wed, 31 Oct 2018 00:42:06 +0000 Message-Id: <1540946526-24837-1-git-send-email-fiona.trahe@intel.com> X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-dev] [PATCH] test/compress: improve trace 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: , X-List-Received-Date: Wed, 31 Oct 2018 00:42:13 -0000 Make clear which engine is compressing and which is decompressing in debug output. Also add newline and print ratio = 0 if test fails. Signed-off-by: Fiona Trahe --- test/test/test_compressdev.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/test/test/test_compressdev.c b/test/test/test_compressdev.c index 8645388..5d5e519 100644 --- a/test/test/test_compressdev.c +++ b/test/test/test_compressdev.c @@ -10,6 +10,7 @@ #include #include #include +#include #include "test_compressdev_test_buffer.h" #include "test.h" @@ -856,13 +857,20 @@ test_deflate_comp_decomp(const char * const test_bufs[], &compress_xforms[xform_idx]->compress; enum rte_comp_huffman huffman_type = compress_xform->deflate.huffman; - RTE_LOG(DEBUG, USER1, "Buffer %u compressed from %u to %u bytes " - "(level = %d, huffman = %s)\n", - buf_idx[priv_data->orig_idx], + char engine[22]; + if (zlib_dir == ZLIB_COMPRESS || zlib_dir == ZLIB_ALL) + strlcpy(engine, "zlib (direct, no pmd)", 22); + else + strlcpy(engine, "pmd", 22); + + RTE_LOG(DEBUG, USER1, "Buffer %u compressed by %s from %u to" + " %u bytes (level = %d, huffman = %s)\n", + buf_idx[priv_data->orig_idx], engine, ops_processed[i]->consumed, ops_processed[i]->produced, compress_xform->level, huffman_type_strings[huffman_type]); - RTE_LOG(DEBUG, USER1, "Compression ratio = %.2f", + RTE_LOG(DEBUG, USER1, "Compression ratio = %.2f\n", + ops_processed[i]->consumed == 0 ? 0 : (float)ops_processed[i]->produced / ops_processed[i]->consumed * 100); ops[i] = NULL; @@ -1058,8 +1066,14 @@ test_deflate_comp_decomp(const char * const test_bufs[], for (i = 0; i < num_bufs; i++) { priv_data = (struct priv_op_data *)(ops_processed[i] + 1); - RTE_LOG(DEBUG, USER1, "Buffer %u decompressed from %u to %u bytes\n", - buf_idx[priv_data->orig_idx], + char engine[22]; + if (zlib_dir == ZLIB_DECOMPRESS || zlib_dir == ZLIB_ALL) + strlcpy(engine, "zlib (direct, no pmd)", 22); + else + strlcpy(engine, "pmd", 22); + RTE_LOG(DEBUG, USER1, + "Buffer %u decompressed by %s from %u to %u bytes\n", + buf_idx[priv_data->orig_idx], engine, ops_processed[i]->consumed, ops_processed[i]->produced); ops[i] = NULL; } -- 2.7.4