summaryrefslogtreecommitdiff
path: root/include/sqfs/block_writer.h
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-02-10 21:06:00 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-02-10 21:06:00 +0100
commit94a0b2783aa58b646260232ecfa3ff93f9b97d6d (patch)
treee0f356e7df1c2894fdbf15162d8467b42a062b21 /include/sqfs/block_writer.h
parent6a7a7aaa4c7c715577d9649657412f99c06e1a95 (diff)
Add run time statistics to the block writer and processor
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include/sqfs/block_writer.h')
-rw-r--r--include/sqfs/block_writer.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/include/sqfs/block_writer.h b/include/sqfs/block_writer.h
index b4d804c..421f8bd 100644
--- a/include/sqfs/block_writer.h
+++ b/include/sqfs/block_writer.h
@@ -140,6 +140,46 @@ struct sqfs_block_hooks_t {
void (*prepare_padding)(void *user, sqfs_u8 *block, size_t count);
};
+/**
+ * @struct sqfs_block_writer_stats_t
+ *
+ * @brief Collects run time statistics of the @ref sqfs_block_writer_t
+ */
+struct sqfs_block_writer_stats_t {
+ /**
+ * @brief Holds the size of the structure.
+ *
+ * If a later version of libsquashfs expands this structure, the value
+ * of this field can be used to check at runtime whether the newer
+ * fields are avaialable or not.
+ */
+ size_t size;
+
+ /**
+ * @brief Total number of bytes submitted, including blocks that were
+ * removed by deduplication and not counting any padding.
+ */
+ sqfs_u64 bytes_submitted;
+
+ /**
+ * @brief Actual number of bytes written to disk, excluding deduplicated
+ * blocks and including padding.
+ */
+ sqfs_u64 bytes_written;
+
+ /**
+ * @brief Total number of submitted blocks, including ones later
+ * removed by deduplication.
+ */
+ sqfs_u64 blocks_submitted;
+
+ /**
+ * @brief Total number of blocks actually written, excluding
+ * deduplicated blocks.
+ */
+ sqfs_u64 blocks_written;
+};
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -158,6 +198,9 @@ SQFS_API int sqfs_block_writer_write(sqfs_block_writer_t *wr,
sqfs_block_t *block,
sqfs_u64 *location);
+SQFS_API const sqfs_block_writer_stats_t
+*sqfs_block_writer_get_stats(const sqfs_block_writer_t *wr);
+
#ifdef __cplusplus
}
#endif