From: Hao Fang fanghao11@huawei.com
1.fixes found with chechpatch. 2.code format alignment.
Signed-off-by: Hao Fang fanghao11@huawei.com Signed-off-by: Qi Tao taoqi10@huawei.com --- uadk_tool/test/comp_lib.c | 75 +++++++++--------- uadk_tool/test/comp_lib.h | 39 ++++------ uadk_tool/test/comp_main.c | 151 +++++++++++++++++++------------------ 3 files changed, 126 insertions(+), 139 deletions(-)
diff --git a/uadk_tool/test/comp_lib.c b/uadk_tool/test/comp_lib.c index 6c2062d..014aa98 100644 --- a/uadk_tool/test/comp_lib.c +++ b/uadk_tool/test/comp_lib.c @@ -343,7 +343,7 @@ void free_chunk_list(chunk_list_t *list) * Deflate a data block with compressed header. */ static int chunk_deflate(void *in, size_t in_sz, void *out, size_t *out_sz, - struct test_options *opts) + struct test_options *opts) { int alg_type = opts->alg_type; z_stream strm; @@ -405,7 +405,7 @@ static int chunk_deflate(void *in, size_t in_sz, void *out, size_t *out_sz, * produces compression header. */ static int chunk_inflate(void *in, size_t in_sz, void *out, size_t *out_sz, - struct test_options *opts) + struct test_options *opts) { z_stream strm; int ret; @@ -449,15 +449,14 @@ out: * in_list & out_list should be formated first. */ int sw_deflate(chunk_list_t *in_list, - chunk_list_t *out_list, - struct test_options *opts) + chunk_list_t *out_list, + struct test_options *opts) { chunk_list_t *p, *q; int ret = -EINVAL;
for (p = in_list, q = out_list; p && q; p = p->next, q = q->next) { - ret = chunk_deflate(p->addr, p->size, q->addr, &q->size, - opts); + ret = chunk_deflate(p->addr, p->size, q->addr, &q->size, opts); if (ret) return ret; } @@ -469,7 +468,7 @@ int sw_deflate(chunk_list_t *in_list, * in_list & out_list should be formated first. */ int sw_inflate(chunk_list_t *in_list, chunk_list_t *out_list, - struct test_options *opts) + struct test_options *opts) { chunk_list_t *p, *q; int ret = -EINVAL; @@ -488,10 +487,10 @@ int sw_inflate(chunk_list_t *in_list, chunk_list_t *out_list, * in_list & out_list should be formated first. */ int hw_deflate(handle_t h_dfl, - chunk_list_t *in_list, - chunk_list_t *out_list, - struct test_options *opts, - sem_t *sem) + chunk_list_t *in_list, + chunk_list_t *out_list, + struct test_options *opts, + sem_t *sem) { struct wd_comp_req *reqs; chunk_list_t *p = in_list, *q = out_list; @@ -549,10 +548,10 @@ out: * in_list & out_list should be formated first. */ int hw_inflate(handle_t h_ifl, - chunk_list_t *in_list, - chunk_list_t *out_list, - struct test_options *opts, - sem_t *sem) + chunk_list_t *in_list, + chunk_list_t *out_list, + struct test_options *opts, + sem_t *sem) { struct wd_comp_req *reqs; chunk_list_t *p, *q; @@ -641,7 +640,7 @@ static int create_send_tdata(struct test_options *opts, if (opts->option & TEST_THP) { ret = madvise(info->in_buf, info->in_size, MADV_HUGEPAGE); if (ret) { - COMP_TST_PRT("failed to madvise(MADV_HUGEPAGE) src_buf(%ld)!\n", info->in_size); + COMP_TST_PRT("failed to madvise(MADV_HUGEPAGE) src_buf(%zu)!\n", info->in_size); goto out_ilist; } } @@ -660,7 +659,7 @@ static int create_send_tdata(struct test_options *opts, if (opts->option & TEST_THP) { ret = madvise(tdata->dst, tdata->dst_sz, MADV_HUGEPAGE); if (ret) { - COMP_TST_PRT("failed to madvise(MADV_HUGEPAGE) dst_buf(%ld)!\n", tdata->dst_sz); + COMP_TST_PRT("failed to madvise(MADV_HUGEPAGE) dst_buf(%zu)!\n", tdata->dst_sz); goto out_dst; } } @@ -790,9 +789,9 @@ void free_threads_tdata(struct hizip_test_info *info) }
int attach_threads(struct test_options *opts, - struct hizip_test_info *info, - void *(*send_thread_func)(void *arg), - void *(*poll_thread_func)(void *arg)) + struct hizip_test_info *info, + void *(*send_thread_func)(void *arg), + void *(*poll_thread_func)(void *arg)) { int i, j, ret, num; void *tret; @@ -816,15 +815,14 @@ int attach_threads(struct test_options *opts, &info->tdatas[i]); if (ret < 0) { COMP_TST_PRT("Fail to create poll thread %d (%d)\n", - i, ret); + i, ret); goto out_poll; } } for (i = 0; i < info->poll_tnum; i++) { ret = pthread_join(info->poll_tds[i], &tret); if (ret < 0) { - COMP_TST_PRT( "Fail on poll thread with %d\n", - ret); + COMP_TST_PRT("Fail on poll thread with %d\n", ret); goto out_poll; } } @@ -832,7 +830,7 @@ int attach_threads(struct test_options *opts, for (i = 0; i < info->send_tnum; i++) { ret = pthread_join(info->send_tds[i], &tret); if (ret < 0) { - COMP_TST_PRT( "Fail on send thread with %d\n", ret); + COMP_TST_PRT("Fail on send thread with %d\n", ret); goto out_poll; } } @@ -947,7 +945,6 @@ int init_ctx_config(struct test_options *opts, void *priv, int i, j, ret = -EINVAL; int q_num = opts->q_num;
- __atomic_store_n(&sum_pend, 0, __ATOMIC_RELEASE); __atomic_store_n(&sum_thread_end, 0, __ATOMIC_RELEASE); *sched = wd_sched_rr_alloc(SCHED_POLICY_RR, 2, 2, lib_poll_func); @@ -1120,7 +1117,7 @@ int parse_common_option(int argc, char *argv[], {"thread", required_argument, 0, 13 }, {"mode", required_argument, 0, 14 }, {"sgl", no_argument, 0, 15 }, - /* still keep these proprietary cmds listd below*/ + /* still keep these proprietary cmds listd below*/ {"sformat", required_argument, 0, 20 }, {"option", required_argument, 0, 21 }, {"fork", required_argument, 0, 22 }, @@ -1138,15 +1135,14 @@ int parse_common_option(int argc, char *argv[], case 1: opts->self = 1; break; - case 2: /* input file */ + case 2: /* input file */ if (optarg) { opts->fd_in = open(optarg, O_RDONLY); if (opts->fd_in < 0) { - COMP_TST_PRT("Fail to open %s\n", - optarg); + COMP_TST_PRT("Fail to open %s\n", optarg); return 1; - } else - opts->is_file = true; + } + opts->is_file = true; } else { COMP_TST_PRT("Input file is missing!\n"); return 1; @@ -1156,18 +1152,17 @@ int parse_common_option(int argc, char *argv[], return 1; } break; - case 3: /* output file */ + case 3: /* output file */ if (optarg) { opts->fd_out = open(optarg, - O_CREAT | O_WRONLY, - S_IWUSR | S_IRGRP | - S_IROTH); + O_CREAT | O_WRONLY, + S_IWUSR | S_IRGRP | + S_IROTH); if (opts->fd_out < 0) { - COMP_TST_PRT("Fail to open %s\n", - optarg); + COMP_TST_PRT("Fail to open %s\n", optarg); return 1; - } else - opts->is_file = true; + } + opts->is_file = true; } else { COMP_TST_PRT("Output file is missing!\n"); return 1; @@ -1177,7 +1172,7 @@ int parse_common_option(int argc, char *argv[], return 1; } break; - case 4: /* env */ + case 4: /* environment variable */ opts->use_env = true; break; case 5: diff --git a/uadk_tool/test/comp_lib.h b/uadk_tool/test/comp_lib.h index eda1d59..8f61b1c 100644 --- a/uadk_tool/test/comp_lib.h +++ b/uadk_tool/test/comp_lib.h @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: Apache-2.0 +/* SPDX-License-Identifier: Apache-2.0 */ /* * Copyright 2020-2021 Huawei Technologies Co.,Ltd. All rights reserved. * Copyright 2020-2021 Linaro ltd. @@ -190,35 +190,26 @@ void init_chunk_list(chunk_list_t *list, void *buf, size_t buf_sz, size_t chunk_sz); chunk_list_t *create_chunk_list(void *buf, size_t buf_sz, size_t chunk_sz); void free_chunk_list(chunk_list_t *list); -int sw_deflate(chunk_list_t *in_list, - chunk_list_t *out_list, - struct test_options *opts); -int sw_inflate(chunk_list_t *in_list, - chunk_list_t *out_list, - struct test_options *opts); -int hw_deflate(handle_t h_dfl, - chunk_list_t *in_list, - chunk_list_t *out_list, - struct test_options *opts, - sem_t *sem); -int hw_inflate(handle_t h_ifl, - chunk_list_t *in_list, - chunk_list_t *out_list, - struct test_options *opts, - sem_t *sem); +int sw_deflate(chunk_list_t *in_list, chunk_list_t *out_list, + struct test_options *opts); +int sw_inflate(chunk_list_t *in_list, chunk_list_t *out_list, + struct test_options *opts); +int hw_deflate(handle_t h_dfl, chunk_list_t *in_list, chunk_list_t *out_list, + struct test_options *opts, sem_t *sem); +int hw_inflate(handle_t h_ifl, chunk_list_t *in_list, chunk_list_t *out_list, + struct test_options *opts, sem_t *sem);
int create_threads_tdata(struct test_options *opts, struct hizip_test_info *info); void free_threads_tdata(struct hizip_test_info *info);
int attach_threads(struct test_options *opts, - struct hizip_test_info *info, - void *(*send_thread_func)(void *arg), - void *(*poll_thread_func)(void *arg)); + struct hizip_test_info *info, + void *(*send_thread_func)(void *arg), + void *(*poll_thread_func)(void *arg));
int init_ctx_config(struct test_options *opts, void *priv, - struct wd_sched **sched - ); + struct wd_sched **sched); void uninit_config(void *priv, struct wd_sched *sched); struct uacce_dev_list *get_dev_list(struct test_options *opts, int children);
@@ -248,7 +239,7 @@ static inline int hizip_check_output(void *buf, size_t size, size_t *checked, check_output_fn check_output, void *opaque) { - static bool printed = false; + static bool printed;
if (!printed) { WD_ERR("no zlib available, output buffer won't be checked\n"); @@ -301,7 +292,7 @@ static inline int zlib_deflate(void *output, unsigned int out_size, void *input, " 'b' kills the process after bind\n" \ " 't' tries to access an unmapped buffer\n" \ " 'w' kills the process while the queue is working\n" \ - " --help command help \n\n" + " --help command help\n\n"
int parse_common_option(int argc, char *argv[], struct test_options *opts); diff --git a/uadk_tool/test/comp_main.c b/uadk_tool/test/comp_main.c index 3cf39ac..3bdfea6 100644 --- a/uadk_tool/test/comp_main.c +++ b/uadk_tool/test/comp_main.c @@ -56,14 +56,14 @@ struct hizip_stats { double v[NUM_STATS]; };
-extern int perf_event_open(struct perf_event_attr *attr, - pid_t pid, int cpu, int group_fd, - unsigned long flags); -extern int perf_event_get(const char *event_name, int **perf_fds, int *nr_fds); -extern unsigned long long perf_event_put(int *perf_fds, int nr_fds); -extern void stat_setup(struct hizip_test_info *info); -extern void stat_start(struct hizip_test_info *info); -extern void stat_end(struct hizip_test_info *info); +int perf_event_open(struct perf_event_attr *attr, + pid_t pid, int cpu, int group_fd, + unsigned long flags); +int perf_event_get(const char *event_name, int **perf_fds, int *nr_fds); +unsigned long long perf_event_put(int *perf_fds, int nr_fds); +void stat_setup(struct hizip_test_info *info); +void stat_start(struct hizip_test_info *info); +void stat_end(struct hizip_test_info *info);
static size_t count_chunk_list_sz(chunk_list_t *list) { @@ -146,8 +146,8 @@ static void *sw_dfl_hw_ifl(void *arg) } ret = cmp_md5(&tdata->md5, &final_md5); if (ret) { - COMP_TST_PRT("MD5 is unmatched (%d) at %dth times on " - "thread %d\n", ret, i, tdata->tid); + COMP_TST_PRT("MD5 is unmatched (%d) at %dth times on thread %d\n", + ret, i, tdata->tid); goto out_strm; } } @@ -157,8 +157,8 @@ static void *sw_dfl_hw_ifl(void *arg) }
/* BLOCK mode */ - setup.alg_type = opts->alg_type; - setup.op_type = WD_DIR_DECOMPRESS; + setup.alg_type = opts->alg_type; + setup.op_type = WD_DIR_DECOMPRESS;
param.type = setup.op_type; param.numa_id = 0; @@ -173,7 +173,7 @@ static void *sw_dfl_hw_ifl(void *arg) info->in_chunk_sz); for (i = 0; i < opts->compact_run_num; i++) { init_chunk_list(tlist, tbuf, tbuf_sz, - info->in_chunk_sz * EXPANSION_RATIO); + info->in_chunk_sz * EXPANSION_RATIO); init_chunk_list(tdata->out_list, tdata->dst, tdata->dst_sz, info->out_chunk_sz); ret = sw_deflate(tdata->in_list, tlist, opts); @@ -182,7 +182,7 @@ static void *sw_dfl_hw_ifl(void *arg) goto out_run; } ret = hw_inflate(h_ifl, tlist, tdata->out_list, opts, - &tdata->sem); + &tdata->sem); if (ret) { COMP_TST_PRT("Fail to inflate by HW: %d\n", ret); goto out_run; @@ -199,8 +199,8 @@ static void *sw_dfl_hw_ifl(void *arg) } ret = cmp_md5(&tdata->md5, &final_md5); if (ret) { - COMP_TST_PRT("MD5 is unmatched (%d) at %dth times on " - "thread %d\n", ret, i, tdata->tid); + COMP_TST_PRT("MD5 is unmatched (%d) at %dth times on thread %d\n", + ret, i, tdata->tid); goto out_run; } } @@ -291,8 +291,8 @@ static void *hw_dfl_sw_ifl(void *arg) } ret = cmp_md5(&tdata->md5, &final_md5); if (ret) { - COMP_TST_PRT("MD5 is unmatched (%d) at %dth times on " - "thread %d\n", ret, i, tdata->tid); + COMP_TST_PRT("MD5 is unmatched (%d) at %dth times on thread %d\n", + ret, i, tdata->tid); goto out_strm; } } @@ -302,8 +302,8 @@ static void *hw_dfl_sw_ifl(void *arg) }
/* BLOCK mode */ - setup.alg_type = opts->alg_type; - setup.op_type = WD_DIR_COMPRESS; + setup.alg_type = opts->alg_type; + setup.op_type = WD_DIR_COMPRESS; param.type = setup.op_type; param.numa_id = 0; setup.sched_param = ¶m; @@ -317,11 +317,11 @@ static void *hw_dfl_sw_ifl(void *arg) info->in_chunk_sz); for (i = 0; i < opts->compact_run_num; i++) { init_chunk_list(tlist, tbuf, tbuf_sz, - opts->block_size * EXPANSION_RATIO); + opts->block_size * EXPANSION_RATIO); init_chunk_list(tdata->out_list, tdata->dst, tdata->dst_sz, info->out_chunk_sz); ret = hw_deflate(h_dfl, tdata->in_list, tlist, opts, - &tdata->sem); + &tdata->sem); if (ret) { COMP_TST_PRT("Fail to deflate by HW: %d\n", ret); goto out_run; @@ -343,8 +343,8 @@ static void *hw_dfl_sw_ifl(void *arg) } ret = cmp_md5(&tdata->md5, &final_md5); if (ret) { - COMP_TST_PRT("MD5 is unmatched (%d) at %dth times on " - "thread %d\n", ret, i, tdata->tid); + COMP_TST_PRT("MD5 is unmatched (%d) at %dth times on thread %d\n", + ret, i, tdata->tid); goto out_run; } } @@ -426,8 +426,8 @@ static void *hw_dfl_hw_ifl(void *arg) } ret = cmp_md5(&tdata->md5, &final_md5); if (ret) { - COMP_TST_PRT("MD5 is unmatched (%d) at %dth times on " - "thread %d\n", ret, i, tdata->tid); + COMP_TST_PRT("MD5 is unmatched (%d) at %dth times on thread %d\n", + ret, i, tdata->tid); goto out; } } @@ -443,8 +443,8 @@ static void *hw_dfl_hw_ifl(void *arg) goto out; }
- setup.alg_type = opts->alg_type; - setup.op_type = WD_DIR_COMPRESS; + setup.alg_type = opts->alg_type; + setup.op_type = WD_DIR_COMPRESS; param.type = setup.op_type; param.numa_id = 0; setup.sched_param = ¶m; @@ -465,18 +465,18 @@ static void *hw_dfl_hw_ifl(void *arg)
for (i = 0; i < opts->compact_run_num; i++) { init_chunk_list(tlist, tbuf, tbuf_sz, - opts->block_size * EXPANSION_RATIO); + opts->block_size * EXPANSION_RATIO); init_chunk_list(tdata->out_list, tdata->dst, tdata->dst_sz, info->out_chunk_sz); ret = hw_deflate(h_dfl, tdata->in_list, tlist, opts, - &tdata->sem); + &tdata->sem); if (ret) { COMP_TST_PRT("Fail to deflate by HW: %d\n", ret); goto out_run; } ret = hw_inflate(h_ifl, tlist, tdata->out_list, opts, - &tdata->sem); + &tdata->sem); if (ret) { COMP_TST_PRT("Fail to inflate by HW: %d\n", ret); goto out_run; @@ -493,8 +493,8 @@ static void *hw_dfl_hw_ifl(void *arg) } ret = cmp_md5(&tdata->md5, &final_md5); if (ret) { - COMP_TST_PRT("MD5 is unmatched (%d) at %dth times on " - "thread %d\n", ret, i, tdata->tid); + COMP_TST_PRT("MD5 is unmatched (%d) at %dth times on thread %d\n", + ret, i, tdata->tid); goto out_run; } } @@ -552,8 +552,8 @@ static void *hw_dfl_perf(void *arg) return NULL; }
- setup.alg_type = opts->alg_type; - setup.op_type = WD_DIR_COMPRESS; + setup.alg_type = opts->alg_type; + setup.op_type = WD_DIR_COMPRESS; param.type = setup.op_type; param.numa_id = 0; setup.sched_param = ¶m; @@ -566,7 +566,7 @@ static void *hw_dfl_perf(void *arg) tdata->dst_sz, info->out_chunk_sz); ret = hw_deflate(h_dfl, tdata->in_list, tdata->out_list, opts, - &tdata->sem); + &tdata->sem); if (ret) { COMP_TST_PRT("Fail to deflate by HW(blk): %d\n", ret); goto out; @@ -617,8 +617,8 @@ static void *hw_ifl_perf(void *arg) return NULL; }
- setup.alg_type = opts->alg_type; - setup.op_type = WD_DIR_DECOMPRESS; + setup.alg_type = opts->alg_type; + setup.op_type = WD_DIR_DECOMPRESS; param.type = setup.op_type; param.numa_id = 0; setup.sched_param = ¶m; @@ -631,7 +631,7 @@ static void *hw_ifl_perf(void *arg) tdata->dst_sz, info->out_chunk_sz); ret = hw_inflate(h_ifl, tdata->in_list, tdata->out_list, opts, - &tdata->sem); + &tdata->sem); if (ret) { COMP_TST_PRT("Fail to inflate by HW: %d\n", ret); goto out; @@ -656,9 +656,8 @@ int load_file_data(struct hizip_test_info *info)
file_sz = read(opts->fd_in, info->in_buf, info->in_size); if (file_sz < info->in_size) { - COMP_TST_PRT("Expect to read %ld bytes. " - "But only read %ld bytes!\n", - info->in_size, file_sz); + COMP_TST_PRT("Expect to read %zu bytes, but only read %zu bytes!\n", + info->in_size, file_sz); return -EFAULT; } return (int)file_sz; @@ -678,13 +677,14 @@ int store_file(struct hizip_test_info *info, char *model) if (!opts->is_stream) { COMP_TST_PRT("Invalid, file need stream mode!\n"); return -EINVAL; - } else { - p = tdata->out_list; - file_sz = write(opts->fd_out, p->addr, p->size); - if (file_sz < p->size) - return -EFAULT; - sum = file_sz; } + + p = tdata->out_list; + file_sz = write(opts->fd_out, p->addr, p->size); + if (file_sz < p->size) + return -EFAULT; + sum = file_sz; + return (int)sum; }
@@ -719,17 +719,17 @@ static void uadk_res_uninit(struct test_options *opts, wd_free_list_accels(info->list); }
-static bool event_unavailable = false; +static bool event_unavailable;
static int prepare_src_data(struct test_options *opts, struct hizip_test_info *info, int direction) { + thread_data_t *tdata = info->tdatas; chunk_list_t *tlist = NULL; size_t tbuf_sz = 0; void *tbuf = NULL; int ret;
if (direction) { /* if is inflate, need prepare the compressed data by sw */ - thread_data_t *tdata = info->tdatas; tbuf_sz = info->in_size / EXPANSION_RATIO; tbuf = mmap_alloc(tbuf_sz); if (!tbuf) { @@ -758,7 +758,7 @@ static int prepare_src_data(struct test_options *opts, struct hizip_test_info *i }
static void perfdata_print(struct test_options *opts, struct hizip_test_info *info, - int zbuf_idx, char *zbuf, char *model) + int zbuf_idx, char *zbuf, char *model) { double ilen, usec, speed;
@@ -785,10 +785,10 @@ static void perfdata_print(struct test_options *opts, struct hizip_test_info *in
if (!strcmp(model, "hw_dfl_perf") || !strcmp(model, "hw_ifl_perf")) { COMP_TST_PRT("%s at %.2fMB/s in %f usec (BLK:%d)..\n", - zbuf, speed, usec, opts->block_size); + zbuf, speed, usec, opts->block_size); } else { COMP_TST_PRT("%s in %f usec (BLK:%d)...\n", - zbuf, usec, opts->block_size); + zbuf, usec, opts->block_size); }
} @@ -922,7 +922,7 @@ static int test_hw(struct test_options *opts, char *model) } /* A warning if the parameters might produce false positives */ if (opts->total_len > 0x54000) - COMP_TST_PRT( "NOTE: test might trash the TLB\n"); + COMP_TST_PRT("NOTE: test might trash the TLB\n"); }
stat_start(&info); @@ -1034,7 +1034,7 @@ int run_self_test(struct test_options *opts) "async-comp:8@0,async-decomp:8@0"); setenv("WD_COMP_CTX_NUM", poll_str, 1); memset(poll_str, 0, POLL_STRING_LEN); - sprintf(poll_str, "%d@0", opts->poll_num), + sprintf(poll_str, "%d@0", opts->poll_num); setenv("WD_COMP_ASYNC_POLL_NUM", poll_str, 1); } f_ret |= test_hw(opts, "sw_dfl_hw_ifl"); @@ -1127,8 +1127,7 @@ int run_cmd(struct test_options *opts) if (WIFEXITED(status)) { ret = WEXITSTATUS(status); if (ret) { - COMP_TST_PRT("child %d returned with %d\n", - pid, ret); + COMP_TST_PRT("child %d returned with %d\n", pid, ret); success = false; } } else if (WIFSIGNALED(status)) { @@ -1145,14 +1144,16 @@ int run_cmd(struct test_options *opts) if (!ret) ret = -EINVAL; } - } else + } else { ret = run_one_cmd(opts); + } + return ret; }
int perf_event_open(struct perf_event_attr *attr, - pid_t pid, int cpu, int group_fd, - unsigned long flags) + pid_t pid, int cpu, int group_fd, + unsigned long flags) { return syscall(__NR_perf_event_open, attr, pid, cpu, group_fd, flags); } @@ -1294,27 +1295,27 @@ void stat_end(struct hizip_test_info *info)
stats->v[ST_SETUP_TIME] = (info->tv.start_time.tv_sec - info->tv.setup_time.tv_sec) * 1000000000 + - info->tv.start_time.tv_nsec - - info->tv.setup_time.tv_nsec; + info->tv.start_time.tv_nsec - + info->tv.setup_time.tv_nsec; stats->v[ST_RUN_TIME] = (info->tv.end_time.tv_sec - info->tv.start_time.tv_sec) * 1000000000 + - info->tv.end_time.tv_nsec - - info->tv.start_time.tv_nsec; + info->tv.end_time.tv_nsec - + info->tv.start_time.tv_nsec;
stats->v[ST_CPU_TIME] = (info->tv.end_cputime.tv_sec - info->tv.setup_cputime.tv_sec) * 1000000000 + - info->tv.end_cputime.tv_nsec - - info->tv.setup_cputime.tv_nsec; + info->tv.end_cputime.tv_nsec - + info->tv.setup_cputime.tv_nsec; stats->v[ST_USER_TIME] = (info->tv.end_rusage.ru_utime.tv_sec - info->tv.setup_rusage.ru_utime.tv_sec) * - 1000000 + - info->tv.end_rusage.ru_utime.tv_usec - - info->tv.setup_rusage.ru_utime.tv_usec; + 1000000 + + info->tv.end_rusage.ru_utime.tv_usec - + info->tv.setup_rusage.ru_utime.tv_usec; stats->v[ST_SYSTEM_TIME] = (info->tv.end_rusage.ru_stime.tv_sec - info->tv.setup_rusage.ru_stime.tv_sec) * - 1000000 + - info->tv.end_rusage.ru_stime.tv_usec - - info->tv.setup_rusage.ru_stime.tv_usec; + 1000000 + + info->tv.end_rusage.ru_stime.tv_usec - + info->tv.setup_rusage.ru_stime.tv_usec;
stats->v[ST_MINFLT] = info->tv.end_rusage.ru_minflt - info->tv.setup_rusage.ru_minflt; @@ -1331,12 +1332,12 @@ void stat_end(struct hizip_test_info *info)
/* check last loop is enough, same as below hizip_verify_output */ stats->v[ST_COMPRESSION_RATIO] = (double)opts->total_len / - total_out * 100; + total_out * 100;
total_len = opts->total_len * opts->compact_run_num; /* ST_RUN_TIME records nanoseconds */ stats->v[ST_SPEED] = (total_len * opts->thread_num * 1000) / - (1.024 * 1.024 * stats->v[ST_RUN_TIME]); + (1.024 * 1.024 * stats->v[ST_RUN_TIME]);
stats->v[ST_TOTAL_SPEED] = (total_len * opts->thread_num * 1000) / ((stats->v[ST_RUN_TIME] + @@ -1350,7 +1351,7 @@ void stat_end(struct hizip_test_info *info) static void handle_sigbus(int sig) { COMP_TST_PRT("SIGBUS!\n"); - _exit(0); + _exit(0); }
int test_comp_entry(int argc, char *argv[])