From 547e8e1893698482f7fbf9a059caee4e9931a1b9 Mon Sep 17 00:00:00 2001 From: Roy Oursler Date: Wed, 7 Sep 2016 10:17:52 -0700 Subject: [PATCH] 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 --- igzip/igzip_file_perf.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/igzip/igzip_file_perf.c b/igzip/igzip_file_perf.c index b4850b0..e95feb8 100644 --- a/igzip/igzip_file_perf.c +++ b/igzip/igzip_file_perf.c @@ -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) {