test-compress-benchmark.c revision 9f35e8b45894f7e201878e128ca371662a9dc63d
/***
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"
#include "random-util.h"
char *buf;
size_t i;
for (i = 0; i < count; i++)
} else
assert_not_reached("here");
return buf;
}
float dt;
size_t buf2_allocated = 0;
n = now(CLOCK_MONOTONIC);
size_t j = 0, k = 0;
int r;
/* assume compression must be successful except for small inputs */
/* check for overwrites */
if (r != 0) {
skipped += i;
continue;
}
assert_se(j > 0);
if (j >= i)
assert_se(r == 0);
assert_se(buf2_allocated >= k);
assert_se(k == i);
total += i;
compressed += j;
break;
}
log_info("%s/%s: compressed & decompressed %zu bytes in %.2fs (%.2fMiB/s), "
"mean compresion %.2f%%, skipped %zu bytes",
skipped);
}
const char *i;
NULSTR_FOREACH(i, "zeros\0simple\0random\0") {
#ifdef HAVE_XZ
#endif
#ifdef HAVE_LZ4
#endif
}
return 0;
}