test-compress-benchmark.c revision 3f2b585466f73031dfbd25c0cbe5972b41fb689c
/***
This file is part of systemd
Copyright 2014 Zbigniew Jędrzejewski-Szmek
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "compress.h"
#include "util.h"
#include "macro.h"
char *buf;
size_t i;
for (i = 0; i < count; i++)
return buf;
}
static void test_compress_decompress(const char* label,
float dt;
uint64_t buf2_allocated = 0;
n = now(CLOCK_MONOTONIC);
uint64_t j = 0, k = 0;
int r;
/* assume compresion must be succesful except for small inputs */
/* check for overwrites */
if (r != 0) {
skipped += i;
continue;
}
assert(j > 0);
if (j >= i)
assert(r == 0);
assert(buf2_allocated >= k);
assert(k == i);
total += i;
compressed += j;
break;
}
log_info("%s: compressed & decompressed %zu bytes in %.2fs (%.2fMiB/s), "
"mean compresion %.2f%%, skipped %zu bytes",
skipped);
}
#ifdef HAVE_XZ
#endif
#ifdef HAVE_LZ4
#endif
return 0;
}