mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-31 20:16:43 +00:00
reader_concurrency_semaphore: add permit-stats
Which stores permit related stats. For now only total number of permits is maintained which is useful to determine whether the semaphore was used already or not.
This commit is contained in:
@@ -168,6 +168,7 @@ struct reader_concurrency_semaphore::permit_list {
|
||||
using list_type = boost::intrusive::list<reader_permit::impl, boost::intrusive::constant_time_size<false>>;
|
||||
|
||||
list_type permits;
|
||||
permit_stats stats;
|
||||
};
|
||||
|
||||
reader_permit::reader_permit(reader_concurrency_semaphore& semaphore, const schema* const schema, std::string_view op_name)
|
||||
@@ -605,6 +606,7 @@ future<reader_permit::resource_units> reader_concurrency_semaphore::do_wait_admi
|
||||
void reader_concurrency_semaphore::on_permit_created(reader_permit::impl& permit) {
|
||||
_permit_gate.enter();
|
||||
_permit_list->permits.push_back(permit);
|
||||
++_permit_list->stats.total_permits;
|
||||
}
|
||||
|
||||
void reader_concurrency_semaphore::on_permit_destroyed(reader_permit::impl& permit) noexcept {
|
||||
@@ -612,6 +614,10 @@ void reader_concurrency_semaphore::on_permit_destroyed(reader_permit::impl& perm
|
||||
_permit_gate.leave();
|
||||
}
|
||||
|
||||
reader_concurrency_semaphore::permit_stats reader_concurrency_semaphore::get_permit_stats() const {
|
||||
return _permit_list->stats;
|
||||
}
|
||||
|
||||
reader_permit reader_concurrency_semaphore::make_permit(const schema* const schema, const char* const op_name) {
|
||||
return reader_permit(*this, schema, std::string_view(op_name));
|
||||
}
|
||||
|
||||
@@ -79,6 +79,10 @@ public:
|
||||
// Total number of reads rejected because the admission queue reached its max capacity
|
||||
uint64_t total_reads_shed_due_to_overload = 0;
|
||||
};
|
||||
struct permit_stats {
|
||||
// Total number of permits created so far.
|
||||
uint64_t total_permits = 0;
|
||||
};
|
||||
|
||||
struct permit_list;
|
||||
|
||||
@@ -282,6 +286,9 @@ public:
|
||||
return _stats;
|
||||
}
|
||||
|
||||
/// Return stats about the currently existing permits.
|
||||
permit_stats get_permit_stats() const;
|
||||
|
||||
/// Make a permit
|
||||
///
|
||||
/// The permit is associated with a schema, which is the schema of the table
|
||||
|
||||
Reference in New Issue
Block a user