stat: move unified=both mixed allocation and calculation to new helper
authorNiklas Cassel <niklas.cassel@wdc.com>
Mon, 17 Jan 2022 15:50:54 +0000 (15:50 +0000)
committerJens Axboe <axboe@kernel.dk>
Mon, 17 Jan 2022 23:21:36 +0000 (16:21 -0700)
commitb182f07738d39f7969c3376375131dd2d3d7016a
tree2446df6661711434f9bbf5feee3af40b5e7a5f87
parent53d966f8177e0ada3bf52930f75f7b30817ea8c2
stat: move unified=both mixed allocation and calculation to new helper

When using unified_rw_reporting=both, we need to print both the
per ddir stats, as well as the mixed stats.

In order to print both, the regular printing functions are responsible
for printing the per ddir stats from the unmodified struct thread_stat,
and show_mixed_ddir_status(), show_mixed_ddir_status_terse()
or add_mixed_ddir_status_json() is responsible for calculating and
printing the mixed stats.

In order to keep the original struct thread_stat intact, these three
functions have to allocate a new local thread_stat, where the mixed ddir
result can be stored before printing.

Move the allocation and calculation of this new struct thread_stat to a
new helper function, so that the code is easier to follow.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Link: https://lore.kernel.org/r/20220117155045.311453-3-Niklas.Cassel@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
stat.c