diff --git a/include/seastar/core/scheduling.hh b/include/seastar/core/scheduling.hh index 0405b9ba992..96a5fcfc06a 100644 --- a/include/seastar/core/scheduling.hh +++ b/include/seastar/core/scheduling.hh @@ -293,6 +293,13 @@ public: friend unsigned internal::scheduling_group_index(scheduling_group sg) noexcept; friend scheduling_group internal::scheduling_group_from_index(unsigned index) noexcept; + struct stats { + sched_clock::duration runtime; + sched_clock::duration waittime; + sched_clock::duration starvetime; + }; + stats get_stats() const noexcept; + template SEASTAR_CONCEPT( requires requires(SpecificValType specific_val, Mapper mapper, Reducer reducer, Initial initial) { {reducer(initial, mapper(specific_val))} -> std::convertible_to; diff --git a/src/core/reactor.cc b/src/core/reactor.cc index 49ed5d7d4dd..b5fb334fec7 100644 --- a/src/core/reactor.cc +++ b/src/core/reactor.cc @@ -4512,6 +4512,16 @@ scheduling_group::set_shares(float shares) noexcept { engine()._task_queues[_id]->set_shares(shares); } +scheduling_group::stats +scheduling_group::get_stats() const noexcept { + const auto * const tq = engine()._task_queues[_id].get(); + return { + .runtime = tq->_runtime, + .waittime = tq->_waittime, + .starvetime = tq->_starvetime + }; +} + future create_scheduling_group(sstring name, float shares) noexcept { auto aid = allocate_scheduling_group_id();