From d6583cad0a92a7c9074fbb638caa7dfaedbd2bc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Botond=20D=C3=A9nes?= Date: Tue, 14 Mar 2023 11:16:09 -0400 Subject: [PATCH] reader_concurrency_semaphore: do_dump_reader_permit_diagnostics(): print the stats Print the semaphore stats below the permit listing and remove the currently redundant "Total: " line. Some of the stats printed here are already exported as metrics, but instead of trying to cherry-pick and risk some metrics falling through the cracks, just print everything, there aren't that many anyway. --- reader_concurrency_semaphore.cc | 47 ++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/reader_concurrency_semaphore.cc b/reader_concurrency_semaphore.cc index 1901c17361..7dbbcc8508 100644 --- a/reader_concurrency_semaphore.cc +++ b/reader_concurrency_semaphore.cc @@ -725,7 +725,52 @@ static void do_dump_reader_permit_diagnostics(std::ostream& os, const reader_con problem); total += do_dump_reader_permit_diagnostics(os, permits, max_lines); fmt::print(os, "\n"); - fmt::print(os, "Total: {} permits with {} count and {} memory resources\n", total.permits, total.resources.count, utils::to_hr_size(total.resources.memory)); + const auto& stats = semaphore.get_stats(); + fmt::print(os, "Stats:\n" + "permit_based_evictions: {}\n" + "time_based_evictions: {}\n" + "inactive_reads: {}\n" + "total_successful_reads: {}\n" + "total_failed_reads: {}\n" + "total_reads_shed_due_to_overload: {}\n" + "total_reads_killed_due_to_kill_limit: {}\n" + "reads_admitted: {}\n" + "reads_enqueued_for_admission: {}\n" + "reads_enqueued_for_memory: {}\n" + "reads_admitted_immediately: {}\n" + "reads_queued_because_ready_list: {}\n" + "reads_queued_because_used_permits: {}\n" + "reads_queued_because_memory_resources: {}\n" + "reads_queued_because_count_resources: {}\n" + "reads_queued_with_eviction: {}\n" + "total_permits: {}\n" + "current_permits: {}\n" + "used_permits: {}\n" + "blocked_permits: {}\n" + "disk_reads: {}\n" + "sstables_read: {}", + stats.permit_based_evictions, + stats.time_based_evictions, + stats.inactive_reads, + stats.total_successful_reads, + stats.total_failed_reads, + stats.total_reads_shed_due_to_overload, + stats.total_reads_killed_due_to_kill_limit, + stats.reads_admitted, + stats.reads_enqueued_for_admission, + stats.reads_enqueued_for_memory, + stats.reads_admitted_immediately, + stats.reads_queued_because_ready_list, + stats.reads_queued_because_used_permits, + stats.reads_queued_because_memory_resources, + stats.reads_queued_because_count_resources, + stats.reads_queued_with_eviction, + stats.total_permits, + stats.current_permits, + stats.used_permits, + stats.blocked_permits, + stats.disk_reads, + stats.sstables_read); } void maybe_dump_reader_permit_diagnostics(const reader_concurrency_semaphore& semaphore, std::string_view problem) noexcept {