isa-l/igzip/igzip_build_hash_table_perf.c
Zhiyuan Zhu f430953f0a igzip: cleanup perf test related code
This patch addresses some cppcheck issues.
And some minor changes to maintain code consistency.

- Cleanup cppcheck issues.
  [log][igzip/igzip_perf.c] (error) Shifting signed 32-bit value by 31 bits is undefined behaviour
  [log][igzip/igzip_hist_perf.c:132]: (error) Memory leak: outbuf

- Some minor changes to maintain code consistency.
  igzip/igzip_build_hash_table_perf.c
  igzip/igzip_hist_perf.c
  igzip/igzip_semi_dyn_file_perf.c

- delete unused variable
  outbuf and outbuf_size from igzip/igzip_hist_perf.c

Change-Id: Icbbd8f70de689931c8a844d89e457af8d97c6793
Signed-off-by: Zhiyuan Zhu <zhiyuan.zhu@arm.com>
2019-12-06 15:33:20 +08:00

39 lines
796 B
C

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <getopt.h>
#include "igzip_lib.h"
#include "test.h"
#define DICT_LEN 32*1024
extern void isal_deflate_hash(struct isal_zstream *stream, uint8_t * dict, int dict_len);
void create_rand_data(uint8_t * data, uint32_t size)
{
int i;
for (i = 0; i < size; i++) {
data[i] = rand() % 256;
}
}
int main(int argc, char *argv[])
{
int time = BENCHMARK_TIME;
struct isal_zstream stream;
uint8_t dict[DICT_LEN];
uint32_t dict_len = DICT_LEN;
stream.level = 0;
create_rand_data(dict, dict_len);
struct perf start;
BENCHMARK(&start, time, isal_deflate_hash(&stream, dict, dict_len));
printf("igzip_build_hash_table_perf: in_size=%u ", dict_len);
perf_print(start, (long long)dict_len);
return 0;
}