From bd5aa7223d7dc21ca4f5a219bd5ba50aa8b0ac8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Chojnowski?= Date: Wed, 18 Dec 2024 14:23:37 +0100 Subject: [PATCH] checkpoint --- include/seastar/core/reactor.hh | 3 +++ include/seastar/util/tracer.hh | 11 +++++++---- src/core/fair_queue.cc | 2 +- src/core/io_queue.cc | 2 +- src/core/metrics.cc | 1 + src/core/reactor.cc | 10 ++++++++++ 6 files changed, 23 insertions(+), 6 deletions(-) diff --git a/include/seastar/core/reactor.hh b/include/seastar/core/reactor.hh index 9296ced12b2..a223e5080f7 100644 --- a/include/seastar/core/reactor.hh +++ b/include/seastar/core/reactor.hh @@ -68,6 +68,7 @@ #include #include #include +#include #include #include #include @@ -281,6 +282,8 @@ private: }; boost::container::static_vector, max_scheduling_groups()> _task_queues; +public: + std::vector, float>> list_groups(); internal::scheduling_group_specific_thread_local_data _scheduling_group_specific_data; int64_t _last_vruntime = 0; task_queue_list _active_task_queues; diff --git a/include/seastar/util/tracer.hh b/include/seastar/util/tracer.hh index 3fba591ff08..c46b410f2ee 100644 --- a/include/seastar/util/tracer.hh +++ b/include/seastar/util/tracer.hh @@ -15,7 +15,7 @@ struct tracer { size_t _cur_pos = 0; tracer() { - for (int i = 0; i < 80; ++i) { + for (int i = 0; i < 480; ++i) { _old.push_back(std::vector()); } _current.resize(buffer_size); @@ -72,6 +72,7 @@ enum class trace_events { IO_QUEUE, IO_DISPATCH, IO_COMPLETE, + MONITORING_SCRAPE, COUNT, }; @@ -164,14 +165,16 @@ inline void tracepoint_replenish(uint64_t new_head) { } inline void tracepoint_dispatch_queue(uint8_t id) { - auto p = reinterpret_cast(g_tracer.write(5)); - p = seastar::write_le(p, static_cast(trace_events::DISPATCH_QUEUE)); - p = seastar::write_le(p, id); + tracepoint_unary(trace_events::DISPATCH_QUEUE, id); } inline void tracepoint_dispatch_requests() { tracepoint_nullary(trace_events::DISPATCH_REQUESTS); } +inline void tracepoint_monitoring_scrape() { + tracepoint_nullary(trace_events::MONITORING_SCRAPE); +} + } // namespace seastar diff --git a/src/core/fair_queue.cc b/src/core/fair_queue.cc index 309b722e900..2be38e6c32a 100644 --- a/src/core/fair_queue.cc +++ b/src/core/fair_queue.cc @@ -340,7 +340,7 @@ void fair_queue::dispatch_requests(std::function cb) { capacity_t dispatched = 0; boost::container::small_vector preempt; - tracepoint_dispatch_requests(); + // tracepoint_dispatch_requests(); while (!_handles.empty() && (dispatched < _group.per_tick_grab_threshold())) { priority_class_data& h = *_handles.top(); tracepoint_dispatch_queue(h._id); diff --git a/src/core/io_queue.cc b/src/core/io_queue.cc index 7bdb44b2bb4..dad0cfd02d2 100644 --- a/src/core/io_queue.cc +++ b/src/core/io_queue.cc @@ -236,7 +236,7 @@ class io_desc_read_write final : public io_completion { io_log.trace("dev {} : req {} queue len {} capacity {}", _ioq.dev_id(), fmt::ptr(this), _dnl.length(), _fq_capacity); static thread_local uint64_t io_id = 0; _io_id = io_id++; - tracepoint_io_queue(_fq_capacity, dnl.rw_idx(), _io_id); + tracepoint_io_queue(dnl.rw_idx(), _fq_capacity, _io_id); } virtual void set_exception(std::exception_ptr eptr) noexcept override { diff --git a/src/core/metrics.cc b/src/core/metrics.cc index 14f1d5a53eb..5e68eb0aeb9 100644 --- a/src/core/metrics.cc +++ b/src/core/metrics.cc @@ -375,6 +375,7 @@ const value_map& get_value_map() { } foreign_ptr get_values() { + tracepoint_monitoring_scrape(); shared_ptr res_ref = ::seastar::make_shared(); auto& res = *(res_ref.get()); auto& mv = res.values; diff --git a/src/core/reactor.cc b/src/core/reactor.cc index 8f8063c2211..cd10eae7292 100644 --- a/src/core/reactor.cc +++ b/src/core/reactor.cc @@ -246,6 +246,16 @@ shard_id reactor::cpu_id() const { return _id; } +std::vector, float>> reactor::list_groups() { + std::vector, float>> result; + for (int i = 0; i < _task_queues.size(); ++i) { + if (_task_queues[i]) { + result.emplace_back(i, _task_queues[i]->_name, _task_queues[i]->_shares); + } + } + return result; +} + void reactor::update_shares_for_queues(internal::priority_class pc, uint32_t shares) { for (auto&& q : _io_queues) { q.second->update_shares_for_class(pc, shares);