summaryrefslogtreecommitdiff
path: root/test/test
diff options
context:
space:
mode:
authorFiona Trahe <fiona.trahe@intel.com>2018-10-31 00:42:06 +0000
committerAkhil Goyal <akhil.goyal@nxp.com>2018-11-02 12:26:06 +0100
commit466a2c4bb5f4b9495380b1661d51047649d7fa76 (patch)
tree74b95dc6c345bbe29c9bda0127b8642dea571ede /test/test
parentcea6abe3796cd06cfa135964476565ab6ba74791 (diff)
downloaddpdk-466a2c4bb5f4b9495380b1661d51047649d7fa76.zip
dpdk-466a2c4bb5f4b9495380b1661d51047649d7fa76.tar.gz
dpdk-466a2c4bb5f4b9495380b1661d51047649d7fa76.tar.xz
test/compress: improve debug logs
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 <fiona.trahe@intel.com> Acked-by: Lee Daly <lee.daly@intel.com> Acked-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Diffstat (limited to 'test/test')
-rw-r--r--test/test/test_compressdev.c26
1 files 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 <rte_mempool.h>
#include <rte_mbuf.h>
#include <rte_compressdev.h>
+#include <rte_string_fns.h>
#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;
}