compress: cstream: record the total number of bytes that pass through the endpoint across all (un)compressed sections

This commit is contained in:
2025-07-31 11:23:30 +01:00
parent ede5e72fc2
commit 17b6a02a4f
3 changed files with 69 additions and 20 deletions

View File

@@ -36,6 +36,18 @@ struct b_cstream {
enum b_compression_mode s_mode;
unsigned int s_compression_depth;
/* tracks the number of bytes read from or written to the endpoint.
* this counter is not reset at the beginning/end of each section.
*
* during compressed sections, this counter is incremented by the number
* of compressed bytes written/consumed.
*
* during uncompressed sections, this counter is incremented by the
* number of uncompressed bytes written/returned.
*
* this does not include bytes read/written while the cursor is moved.
*/
size_t s_tx_bytes;
/* tracks the number of compressed bytes that have passed through this
* stream in the current section.
*
@@ -49,7 +61,7 @@ struct b_cstream {
* endpoint while reading a compressed section due to cstream's
* read-ahead caching behaviour.
*/
size_t s_tx_compressed_bytes;
size_t s_tx_bytes_compressed;
/* tracks the number of uncompressed bytes that have passed through this
* stream in the current section.
*
@@ -59,7 +71,7 @@ struct b_cstream {
* in decompression mode, this tracks the number of bytes returned by
* b_cstream_read
*/
size_t s_tx_uncompressed_bytes;
size_t s_tx_bytes_uncompressed;
/* when the endpoint cursor is moved, the previous cursor position is
* saved here so it can be restored later */