mirror of
https://github.com/intel/isa-l.git
synced 2025-03-02 20:30:09 +01:00
igzip: Add variable history window to perf test
Change-Id: Ia5eb10094e8c84778ed6cf3a51ddade9a19103b5 Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
This commit is contained in:
parent
1409f70c7e
commit
aa8b51930f
@ -106,7 +106,8 @@ int usage(void)
|
||||
" -b <size> input buffer size, 0 buffers all the input\n"
|
||||
" -i <iter> number of iterations (at least 1)\n"
|
||||
" -o <file> output file for compresed data\n"
|
||||
" -d <file> dictionary file used by compression\n");
|
||||
" -d <file> dictionary file used by compression\n"
|
||||
" -w <size> log base 2 size of history window, between 8 and 15\n");
|
||||
|
||||
exit(0);
|
||||
}
|
||||
@ -121,8 +122,9 @@ int main(int argc, char *argv[])
|
||||
struct isal_hufftables hufftables_custom;
|
||||
int level = 0, level_size = 0, avail_in;
|
||||
char *in_file_name = NULL, *out_file_name = NULL, *dict_file_name = NULL;
|
||||
uint32_t hist_bits = 0;
|
||||
|
||||
while ((c = getopt(argc, argv, "h0123456789i:b:o:d:")) != -1) {
|
||||
while ((c = getopt(argc, argv, "h0123456789i:b:o:d:w:")) != -1) {
|
||||
if (c >= '0' && c <= '9') {
|
||||
if (c > '0' + ISAL_DEF_MAX_LEVEL)
|
||||
usage();
|
||||
@ -148,6 +150,11 @@ int main(int argc, char *argv[])
|
||||
case 'b':
|
||||
inbuf_size = atoi(optarg);
|
||||
break;
|
||||
case 'w':
|
||||
hist_bits = atoi(optarg);
|
||||
if (hist_bits > 15 || hist_bits < 8)
|
||||
usage();
|
||||
break;
|
||||
case 'h':
|
||||
default:
|
||||
usage();
|
||||
@ -183,7 +190,14 @@ int main(int argc, char *argv[])
|
||||
printf("outfile=%s\n", dict_file_name);
|
||||
}
|
||||
|
||||
printf("Window Size: %d K\n", IGZIP_HIST_SIZE / 1024);
|
||||
if (hist_bits == 0)
|
||||
printf("Window Size: %d K\n", IGZIP_HIST_SIZE / 1024);
|
||||
|
||||
else if (hist_bits < 10)
|
||||
printf("Window Size: %.2f K\n", 1.0 * (1 << hist_bits) / 1024);
|
||||
else
|
||||
printf("Window Size: %d K\n", (1 << hist_bits) / 1024);
|
||||
|
||||
printf("igzip_file_perf: \n");
|
||||
fflush(0);
|
||||
|
||||
@ -261,6 +275,7 @@ int main(int argc, char *argv[])
|
||||
stream.next_out = outbuf;
|
||||
stream.avail_out = outbuf_size;
|
||||
stream.next_in = inbuf;
|
||||
stream.hist_bits = hist_bits;
|
||||
avail_in = infile_size;
|
||||
|
||||
while (avail_in > 0) {
|
||||
@ -304,6 +319,7 @@ int main(int argc, char *argv[])
|
||||
stream.avail_out = outbuf_size;
|
||||
stream.next_in = inbuf;
|
||||
stream.hufftables = &hufftables_custom;
|
||||
stream.hist_bits = hist_bits;
|
||||
avail_in = infile_size;
|
||||
|
||||
while (avail_in > 0) {
|
||||
|
@ -104,7 +104,8 @@ int usage(void)
|
||||
" -h help\n"
|
||||
" -X use compression level X with 0 <= X <= 2\n"
|
||||
" -i <iter> number of iterations (at least 1)\n"
|
||||
" -o <file> output file for compresed data\n");
|
||||
" -o <file> output file for compresed data\n"
|
||||
" -w <size> log base 2 size of history window, between 8 and 15\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@ -118,8 +119,9 @@ int main(int argc, char *argv[])
|
||||
struct isal_hufftables hufftables_custom;
|
||||
int level = 0, level_size = 0;
|
||||
char *in_file_name = NULL, *out_file_name = NULL;
|
||||
uint32_t hist_bits = 0;
|
||||
|
||||
while ((c = getopt(argc, argv, "h0123456789i:o:")) != -1) {
|
||||
while ((c = getopt(argc, argv, "h0123456789i:o:w:")) != -1) {
|
||||
if (c >= '0' && c <= '9') {
|
||||
if (c > '0' + ISAL_DEF_MAX_LEVEL)
|
||||
usage();
|
||||
@ -139,6 +141,11 @@ int main(int argc, char *argv[])
|
||||
if (iterations < 1)
|
||||
usage();
|
||||
break;
|
||||
case 'w':
|
||||
hist_bits = atoi(optarg);
|
||||
if (hist_bits > 15 || hist_bits < 8)
|
||||
usage();
|
||||
break;
|
||||
case 'h':
|
||||
default:
|
||||
usage();
|
||||
@ -165,7 +172,14 @@ int main(int argc, char *argv[])
|
||||
printf("outfile=%s\n", out_file_name);
|
||||
}
|
||||
|
||||
printf("Window Size: %d K\n", IGZIP_HIST_SIZE / 1024);
|
||||
if (hist_bits == 0)
|
||||
printf("Window Size: %d K\n", IGZIP_HIST_SIZE / 1024);
|
||||
|
||||
else if (hist_bits < 10)
|
||||
printf("Window Size: %.2f K\n", 1.0 * (1 << hist_bits) / 1024);
|
||||
else
|
||||
printf("Window Size: %d K\n", (1 << hist_bits) / 1024);
|
||||
|
||||
printf("igzip_file_perf: \n");
|
||||
fflush(0);
|
||||
/* Allocate space for entire input file and output
|
||||
@ -222,6 +236,7 @@ int main(int argc, char *argv[])
|
||||
stream.level = level;
|
||||
stream.level_buf = level_buf;
|
||||
stream.level_buf_size = level_size;
|
||||
stream.hist_bits = hist_bits;
|
||||
isal_deflate_stateless(&stream);
|
||||
if (stream.avail_in != 0)
|
||||
break;
|
||||
@ -253,6 +268,7 @@ int main(int argc, char *argv[])
|
||||
stream.level_buf = level_buf;
|
||||
stream.level_buf_size = level_size;
|
||||
stream.hufftables = &hufftables_custom;
|
||||
stream.hist_bits = hist_bits;
|
||||
isal_deflate_stateless(&stream);
|
||||
|
||||
printf(" ratio_custom=%3.1f%%", 100.0 * stream.total_out / infile_size);
|
||||
|
Loading…
x
Reference in New Issue
Block a user