Inactive cores stats in stats-builder-like form.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
Michal Mielewczyk 2019-09-12 09:25:35 -04:00
parent 39a3d04c93
commit 078a31fbf2

View File

@ -39,11 +39,11 @@
#define UNIT_REQUESTS "Requests" #define UNIT_REQUESTS "Requests"
#define UNIT_BLOCKS "4KiB blocks" #define UNIT_BLOCKS "4KiB blocks"
static inline float percentage(uint64_t numerator, uint64_t denominator) static inline float fraction(uint64_t numerator, uint64_t denominator)
{ {
float result; float result;
if (denominator) { if (denominator) {
result = 100.0 * numerator / denominator; result = 10000.0 * numerator / denominator;
} else { } else {
result = 0; result = 0;
} }
@ -416,27 +416,14 @@ void cache_stats_inactive_usage(int ctrl_fd, const struct kcas_cache_info *cache
"%", "[Units]"); "%", "[Units]");
print_val_perc_table_row(outfile, "Inactive Occupancy", UNIT_BLOCKS, print_val_perc_table_row(outfile, "Inactive Occupancy", UNIT_BLOCKS,
percentage(cache_info->info.inactive.occupancy, cache_info->info.inactive.occupancy.fraction, "%lu",
cache_info->info.size), cache_info->info.inactive.occupancy.value);
"%lu",
cache_line_in_4k(cache_info->info.inactive.occupancy,
cache_info->info.cache_line_size / KiB));
print_val_perc_table_row(outfile, "Inactive Clean", UNIT_BLOCKS, print_val_perc_table_row(outfile, "Inactive Clean", UNIT_BLOCKS,
percentage(cache_info->info.inactive.occupancy - cache_info->info.inactive.clean.fraction, "%lu",
cache_info->info.inactive.dirty, cache_info->info.inactive.clean.value);
cache_info->info.occupancy),
"%lu",
cache_line_in_4k(cache_info->info.inactive.occupancy -
cache_info->info.inactive.dirty,
cache_info->info.cache_line_size / KiB));
print_val_perc_table_row(outfile, "Inactive Dirty", UNIT_BLOCKS, print_val_perc_table_row(outfile, "Inactive Dirty", UNIT_BLOCKS,
percentage(cache_info->info.inactive.dirty, cache_info->info.inactive.dirty.fraction, "%lu",
cache_info->info.occupancy), cache_info->info.inactive.dirty.value);
"%lu",
cache_line_in_4k(cache_info->info.inactive.dirty,
cache_info->info.cache_line_size / KiB));
} }
/** /**