Testing the KAEZlib Library
After installing the zlib library (KAE 1.0) or KAEZlib library (KAE 2.0), you can test the library functions and performance based on the operations provided in this section.
Perform the test procedure in the source code directory. If KAE is installed using an RPM or DEB package, download and decompress the KAE source package before the test.
- Go to the test directory.
- KAE 1.0
1cd kae_zip_engine/test/
- KAE 2.0
1cd KAEZlib/test/gtest/
- KAE 1.0
- Test the KAEZlib library functions.
1 2
sh build.sh ./kaezlibtest --gtest_filter=*Case*
In the command output, if the execution results of both SmallCase and LargeCase are passed, the KAEZlib library functions are normal.
- Test the performance.
- Set the environment variable LD_LIBRARY_PATH and enable the KAEZlib library.
1export LD_LIBRARY_PATH=/usr/local/kaezip/lib:$ LD_LIBRARY_PATH
- Go to the performance test directory.
- KAE 1.0
1cd kae_zip_engine/test
- KAE 2.0
1cd KAEZlib/test/perftest
- KAE 1.0
- Compile the performance test tool.
1make
- Test the compression performance.
- Testing the compression performance of the zip library
1./zip_perf -m 8 -l 10240 -n 1000
Command output:
1 2 3 4 5 6 7 8 9 10 11 12
kaezip perf parameter: multi process 8, stream length: 10240(KB), loop times: 1000, windowBits : 15, level : 6 input_size is 10485760B compress_size is 10488746B = 10.003MB, compress_rate is 100.028% compress_size is 10488746B = 10.003MB, compress_rate is 100.028% compress_size is 10488746B = 10.003MB, compress_rate is 100.028% compress_size is 10488746B = 10.003MB, compress_rate is 100.028% compress_size is 10488746B = 10.003MB, compress_rate is 100.028% compress_size is 10488746B = 10.003MB, compress_rate is 100.028% compress size is 10488746B = 10.003MB, compress_rate is 100.028% compress_size is 10488746B = 10.003MB, compress_rate is 100.028% kaezip compress perf result: time used: 335108108 us, speed = 0.233 GB/s
- Testing the compression performance of the KAEzip library
1./kaezip_perf -m 8 -l 10240 -n 1000
Command output:1 2 3
kaezip perf parameter: multi process 8, stream length: 10240(KB), loop times: 1000 kaezip compress perf result: time used: 10631524 us, speed = 7.348 GB/s
It shows that the compression speed rises from 0.233 GB/s to 7.348 GB/s.
- Testing the compression performance of the zip library
- Test the decompression performance.
- Testing the decompression performance of the zip library
1./zip_perf -d -m 8 -f itemdata.zlib -n 1000
Command output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
kaezip perf parameter: multi process 8, stream length: 1024(KB), loop times: 1000, windowBits : 15, level : 6 g_kae_device_num 2 uncompress filename : itemdata.zlib input_size is 3539153B [169064]uncompress_size is 7316868B = 6.978MB [169063]uncompress_size is 7316868B = 6.978MB [169061]uncompress_size is 7316868B = 6.978MB [169062]uncompress_size is 7316868B = 6.978MB [169060]uncompress_size is 7316868B = 6.978MB [169058]uncompress_size is 7316868B = 6.978MB [169059]uncompress_size is 7316868B = 6.978MB [169065]uncompress_size is 7316868B = 6.978MB 8 multi process kaezip decompress perf result: time used: 36786657 us, speed = 1.482 GB/s
- Testing the decompression performance of the KAEzip library
1./kaezip_perf -d -m 8 -f itemdata.zlib -n 1000
Command output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
kaezip perf parameter: multi process 8, stream length: 1024(KB), loop times: 1000, windowBits : 15, level : 6 g_kae_device_num 2 uncompress filename : itemdata.zlib input_size is 3539153B [168826]uncompress_size is 7316868B = 6.978MB [168825]uncompress_size is 7316868B = 6.978MB [168830]uncompress_size is 7316868B = 6.978MB [168827]uncompress_size is 7316868B = 6.978MB [168823]uncompress_size is 7316868B = 6.978MB [168829]uncompress_size is 7316868B = 6.978MB [168828]uncompress_size is 7316868B = 6.978MB [168824]uncompress_size is 7316868B = 6.978MB 8 multi process kaezip decompress perf result: time used: 5785818 us, speed = 9.422 GB/s
It shows that the decompression speed rises from 1.482 GB/s to 9.422 GB/s.
In the decompression command, itemdata.zlib indicates the compressed file, which is generated by adding -o itemdata.zlib to the compression command.
- Testing the decompression performance of the zip library
- Set the environment variable LD_LIBRARY_PATH and enable the KAEZlib library.
- Optional: If the KAEGzip tool is installed, perform the following operations to verify its functions and performance:
- Obtain help information.
1/usr/local/kaegzip/gzip -hCommand output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Usage: gzip [OPTION]... [FILE]... Compress or uncompress FILEs using Kunpeng Accelerator Engine (by default, compress FILES in-place). Mandatory arguments to long options are mandatory for short options too. -c, --stdout write on standard output, keep original files unchanged -d, --decompress decompress -f, --force force overwrite of output file and compress links -h, --help give this help -k, --keep keep (don't delete) input files -l, --list list compressed file contents -q, --quiet suppress all warnings -r, --recursive operate recursively on directories -S, --suffix=SUF use suffix SUF on compressed files -t, --test test compressed file integrity -v, --verbose verbose mode -V, --version display version number With no FILE, or when FILE is -, read standard input. Report bugs to <https://gitee.com/kunpengcompute/KAE>
- Test its functions.
- Use KAEGzip to compress the itemdata file into itemdata.gz while retaining the source file itemdata.
1/usr/local/kaegzip/gzip -k itemdata
- Rename the source file itemdata to itemdata.orig.
1mv itemdata itemdata.orig
- Use KAEGzip to decompress the itemdata.gz file.
1/usr/local/kaegzip/gzip -d itemdata.gz
- Compare the file generated after decompression with the source file itemdata.orig.
1diff itemdata itemdata.orig
If no command output is displayed, KAEGzip has correctly compressed and decompressed the file.
- Use KAEGzip to compress the itemdata file into itemdata.gz while retaining the source file itemdata.
- Test the compression performance.
- Using the Gzip tool
time gzip itemdata
Command output:real 0m0.348s user 0m0.343s sys 0m0.004s
- Using KAEGzip
time /usr/local/kaegzip/gzip itemdata
Command output:
real 0m0.016s user 0m0.005s sys 0m0.010s
Compared with Gzip, the compression time of KAEGzip is significantly reduced.
- Using the Gzip tool
- Test the decompression performance.
- Using the Gzip tool
time gzip -d itemdata.gz
Command output:
real 0m0.038s user 0m0.031s sys 0m0.008s
- Using KAEGzip
time /usr/local/kaegzip/gzip -d itemdata.gz
- Command output:
real 0m0.017s user 0m0.004s sys 0m0.012s
Compared with Gzip, the decompression time of KAEGzip is significantly reduced.
- Using the Gzip tool
- Obtain help information.