Fix issue #10.
This commit is contained in:
parent
41b036adac
commit
cbc0c84b12
3 changed files with 22 additions and 14 deletions
|
@ -84,11 +84,15 @@ void
|
||||||
adapt_stats(int show)
|
adapt_stats(int show)
|
||||||
{
|
{
|
||||||
if (show) {
|
if (show) {
|
||||||
|
if (bzip2_count > 0 || bsc_count > 0 || ppmd_count > 0 || lzma_count > 0) {
|
||||||
fprintf(stderr, "Adaptive mode stats:\n");
|
fprintf(stderr, "Adaptive mode stats:\n");
|
||||||
fprintf(stderr, " BZIP2 chunk count: %u\n", bzip2_count);
|
fprintf(stderr, " BZIP2 chunk count: %u\n", bzip2_count);
|
||||||
fprintf(stderr, " LIBBSC chunk count: %u\n", bsc_count);
|
fprintf(stderr, " LIBBSC chunk count: %u\n", bsc_count);
|
||||||
fprintf(stderr, " PPMd chunk count: %u\n", ppmd_count);
|
fprintf(stderr, " PPMd chunk count: %u\n", ppmd_count);
|
||||||
fprintf(stderr, " LZMA chunk count: %u\n\n", lzma_count);
|
fprintf(stderr, " LZMA chunk count: %u\n\n", lzma_count);
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
lzma_count = 0;
|
lzma_count = 0;
|
||||||
bzip2_count = 0;
|
bzip2_count = 0;
|
||||||
|
|
|
@ -96,8 +96,8 @@ libbsc_init(void **data, int *level, int nthreads, uint64_t chunksize,
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
if (chunksize > BSC_MAX_CHUNK) {
|
if (chunksize > BSC_MAX_CHUNK) {
|
||||||
fprintf(stderr, "Max allowed chunk size for LIBBSC is: %ld \n",
|
fprintf(stderr, "Max allowed chunk size for LIBBSC is: %s \n",
|
||||||
BSC_MAX_CHUNK);
|
bytes_to_size(BSC_MAX_CHUNK));
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
bscdat = slab_alloc(NULL, sizeof (struct libbsc_params));
|
bscdat = slab_alloc(NULL, sizeof (struct libbsc_params));
|
||||||
|
|
4
main.c
4
main.c
|
@ -200,6 +200,9 @@ show_compression_stats(uint64_t chunksize)
|
||||||
fprintf(stderr, "\nCompression Statistics\n");
|
fprintf(stderr, "\nCompression Statistics\n");
|
||||||
fprintf(stderr, "======================\n");
|
fprintf(stderr, "======================\n");
|
||||||
fprintf(stderr, "Total chunks : %u\n", chunk_num);
|
fprintf(stderr, "Total chunks : %u\n", chunk_num);
|
||||||
|
if (chunk_num == 0) {
|
||||||
|
fprintf(stderr, "No statistics to display.\n");
|
||||||
|
} else {
|
||||||
fprintf(stderr, "Best compressed chunk : %s(%.2f%%)\n",
|
fprintf(stderr, "Best compressed chunk : %s(%.2f%%)\n",
|
||||||
bytes_to_size(smallest_chunk), (double)smallest_chunk/(double)chunksize*100);
|
bytes_to_size(smallest_chunk), (double)smallest_chunk/(double)chunksize*100);
|
||||||
fprintf(stderr, "Worst compressed chunk : %s(%.2f%%)\n",
|
fprintf(stderr, "Worst compressed chunk : %s(%.2f%%)\n",
|
||||||
|
@ -208,6 +211,7 @@ show_compression_stats(uint64_t chunksize)
|
||||||
fprintf(stderr, "Avg compressed chunk : %s(%.2f%%)\n\n",
|
fprintf(stderr, "Avg compressed chunk : %s(%.2f%%)\n\n",
|
||||||
bytes_to_size(avg_chunk), (double)avg_chunk/(double)chunksize*100);
|
bytes_to_size(avg_chunk), (double)avg_chunk/(double)chunksize*100);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Int_Handler(int signo)
|
Int_Handler(int signo)
|
||||||
|
|
Loading…
Reference in a new issue