Fix issue #10.

This commit is contained in:
Moinak Ghosh 2013-05-12 11:54:40 +05:30
parent 41b036adac
commit cbc0c84b12
3 changed files with 22 additions and 14 deletions

View file

@ -84,11 +84,15 @@ void
adapt_stats(int show)
{
if (show) {
fprintf(stderr, "Adaptive mode stats:\n");
fprintf(stderr, " BZIP2 chunk count: %u\n", bzip2_count);
fprintf(stderr, " LIBBSC chunk count: %u\n", bsc_count);
fprintf(stderr, " PPMd chunk count: %u\n", ppmd_count);
fprintf(stderr, " LZMA chunk count: %u\n\n", lzma_count);
if (bzip2_count > 0 || bsc_count > 0 || ppmd_count > 0 || lzma_count > 0) {
fprintf(stderr, "Adaptive mode stats:\n");
fprintf(stderr, " BZIP2 chunk count: %u\n", bzip2_count);
fprintf(stderr, " LIBBSC chunk count: %u\n", bsc_count);
fprintf(stderr, " PPMd chunk count: %u\n", ppmd_count);
fprintf(stderr, " LZMA chunk count: %u\n\n", lzma_count);
} else {
fprintf(stderr, "\n");
}
}
lzma_count = 0;
bzip2_count = 0;

View file

@ -96,8 +96,8 @@ libbsc_init(void **data, int *level, int nthreads, uint64_t chunksize,
int rv;
if (chunksize > BSC_MAX_CHUNK) {
fprintf(stderr, "Max allowed chunk size for LIBBSC is: %ld \n",
BSC_MAX_CHUNK);
fprintf(stderr, "Max allowed chunk size for LIBBSC is: %s \n",
bytes_to_size(BSC_MAX_CHUNK));
return (1);
}
bscdat = slab_alloc(NULL, sizeof (struct libbsc_params));

18
main.c
View file

@ -200,13 +200,17 @@ show_compression_stats(uint64_t chunksize)
fprintf(stderr, "\nCompression Statistics\n");
fprintf(stderr, "======================\n");
fprintf(stderr, "Total chunks : %u\n", chunk_num);
fprintf(stderr, "Best compressed chunk : %s(%.2f%%)\n",
bytes_to_size(smallest_chunk), (double)smallest_chunk/(double)chunksize*100);
fprintf(stderr, "Worst compressed chunk : %s(%.2f%%)\n",
bytes_to_size(largest_chunk), (double)largest_chunk/(double)chunksize*100);
avg_chunk /= chunk_num;
fprintf(stderr, "Avg compressed chunk : %s(%.2f%%)\n\n",
bytes_to_size(avg_chunk), (double)avg_chunk/(double)chunksize*100);
if (chunk_num == 0) {
fprintf(stderr, "No statistics to display.\n");
} else {
fprintf(stderr, "Best compressed chunk : %s(%.2f%%)\n",
bytes_to_size(smallest_chunk), (double)smallest_chunk/(double)chunksize*100);
fprintf(stderr, "Worst compressed chunk : %s(%.2f%%)\n",
bytes_to_size(largest_chunk), (double)largest_chunk/(double)chunksize*100);
avg_chunk /= chunk_num;
fprintf(stderr, "Avg compressed chunk : %s(%.2f%%)\n\n",
bytes_to_size(avg_chunk), (double)avg_chunk/(double)chunksize*100);
}
}
void