igzip: Allow performance check with small input buffers
Add the SMALL_IN_BUFFER compile time condition to igzip_file_perf to perform perfomance checking when data is separated into small input buffers. Change-Id: Ic7a6451f23a46773e100b17ce86f84e41e4df48a Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
This commit is contained in:
parent
bda088b31a
commit
547e8e1893
@ -36,6 +36,7 @@
|
||||
|
||||
#define BUF_SIZE 1024
|
||||
#define MIN_TEST_LOOPS 8
|
||||
#define SMALL_INBUF_SIZE (4 * 1024)
|
||||
#ifndef RUN_MEM_SIZE
|
||||
# define RUN_MEM_SIZE 500000000
|
||||
#endif
|
||||
@ -122,6 +123,33 @@ int main(int argc, char *argv[])
|
||||
struct perf start, stop;
|
||||
perf_start(&start);
|
||||
|
||||
#ifdef SMALL_IN_BUFFER
|
||||
int avail_in;
|
||||
for (i = 0; i < iterations; i++) {
|
||||
isal_deflate_init(&stream);
|
||||
stream.end_of_stream = 0;
|
||||
stream.flush = NO_FLUSH;
|
||||
stream.next_out = outbuf;
|
||||
stream.avail_out = outbuf_size;
|
||||
stream.next_in = inbuf;
|
||||
avail_in = infile_size;
|
||||
|
||||
while (avail_in > 0) {
|
||||
stream.avail_in =
|
||||
avail_in >= SMALL_INBUF_SIZE ? SMALL_INBUF_SIZE : avail_in;
|
||||
avail_in -= SMALL_INBUF_SIZE;
|
||||
|
||||
if (avail_in <= 0)
|
||||
stream.end_of_stream = 1;
|
||||
|
||||
isal_deflate(&stream);
|
||||
|
||||
if (stream.avail_in != 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
for (i = 0; i < iterations; i++) {
|
||||
isal_deflate_init(&stream);
|
||||
stream.end_of_stream = 1; /* Do the entire file at once */
|
||||
@ -134,6 +162,7 @@ int main(int argc, char *argv[])
|
||||
if (stream.avail_in != 0)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
perf_stop(&stop);
|
||||
|
||||
if (stream.avail_in != 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user