diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-02-10 21:06:00 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-02-10 21:06:00 +0100 |
commit | 94a0b2783aa58b646260232ecfa3ff93f9b97d6d (patch) | |
tree | e0f356e7df1c2894fdbf15162d8467b42a062b21 /lib/sqfs/block_processor/common.c | |
parent | 6a7a7aaa4c7c715577d9649657412f99c06e1a95 (diff) |
Add run time statistics to the block writer and processor
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/block_processor/common.c')
-rw-r--r-- | lib/sqfs/block_processor/common.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/sqfs/block_processor/common.c b/lib/sqfs/block_processor/common.c index fe9773e..bedc923 100644 --- a/lib/sqfs/block_processor/common.c +++ b/lib/sqfs/block_processor/common.c @@ -29,6 +29,9 @@ int block_processor_init(sqfs_block_processor_t *proc, size_t max_block_size, proc->cmp = cmp; proc->frag_tbl = tbl; proc->wr = wr; + + memset(&proc->stats, 0, sizeof(proc->stats)); + proc->stats.size = sizeof(proc->stats); return 0; } @@ -149,6 +152,7 @@ int process_completed_fragment(sqfs_block_processor_t *proc, sqfs_block_t *frag, proc->frag_block->index = index; proc->frag_block->flags = SQFS_BLK_FRAGMENT_BLOCK; + proc->stats.frag_block_count += 1; } err = sqfs_frag_table_add_tail_end(proc->frag_tbl, @@ -170,6 +174,7 @@ int process_completed_fragment(sqfs_block_processor_t *proc, sqfs_block_t *frag, proc->frag_block->flags |= (frag->flags & SQFS_BLK_DONT_COMPRESS); proc->frag_block->size += frag->size; + proc->stats.actual_frag_count += 1; return 0; fail: free(*blk_out); @@ -184,3 +189,9 @@ out_duplicate: } return 0; } + +const sqfs_block_processor_stats_t +*sqfs_block_processor_get_stats(const sqfs_block_processor_t *proc) +{ + return &proc->stats; +} |