diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-05-28 20:54:21 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-05-29 03:39:57 +0200 |
commit | 23e06428674750c59c17ae2a22d17ecd42056b02 (patch) | |
tree | 62fd92a66a10f169b2f9e7e8bcdb72b11bb68027 /lib/common | |
parent | 179e4848f2e107c288829b699b7f0a2e7af69c41 (diff) |
cleanup: libsqfs: eliminate block writer statistics
- the "bytes submitted" can be moved over to the block processor
- the number of blocks submitted are already there (implcitily, by
adding the data block count to the fragment block count)
- actual data bytes written can be computed from the super block
- the remaining block count can be changed to simple counter that
can be obtained through a function.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/common')
-rw-r--r-- | lib/common/statistics.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/common/statistics.c b/lib/common/statistics.c index 2f729cb..079c1b1 100644 --- a/lib/common/statistics.c +++ b/lib/common/statistics.c @@ -13,22 +13,23 @@ void sqfs_print_statistics(const sqfs_super_t *super, const sqfs_block_writer_t *wr) { const sqfs_block_processor_stats_t *proc_stats; - const sqfs_block_writer_stats_t *wr_stats; + sqfs_u64 bytes_written, blocks_written; char read_sz[32], written_sz[32]; size_t ratio; proc_stats = sqfs_block_processor_get_stats(blk); - wr_stats = sqfs_block_writer_get_stats(wr); + blocks_written = sqfs_block_writer_get_block_count(wr); + + bytes_written = super->inode_table_start - sizeof(*super); if (proc_stats->input_bytes_read > 0) { - ratio = (100 * wr_stats->bytes_written) / - proc_stats->input_bytes_read; + ratio = (100 * bytes_written) / proc_stats->input_bytes_read; } else { ratio = 100; } print_size(proc_stats->input_bytes_read, read_sz, false); - print_size(wr_stats->bytes_written, written_sz, false); + print_size(bytes_written, written_sz, false); fputs("---------------------------------------------------\n", stdout); printf("Data bytes read: %s\n", read_sz); @@ -36,11 +37,14 @@ void sqfs_print_statistics(const sqfs_super_t *super, printf("Data compression ratio: " PRI_SZ "%%\n", ratio); fputc('\n', stdout); - printf("Data blocks written: " PRI_U64 "\n", wr_stats->blocks_written); + printf("Data blocks written: " PRI_U64 "\n", blocks_written); printf("Out of which where fragment blocks: " PRI_U64 "\n", proc_stats->frag_block_count); + printf("Duplicate blocks omitted: " PRI_U64 "\n", - wr_stats->blocks_submitted - wr_stats->blocks_written); + proc_stats->data_block_count + proc_stats->frag_block_count - + blocks_written); + printf("Sparse blocks omitted: " PRI_U64 "\n", proc_stats->sparse_block_count); fputc('\n', stdout); |