Seastar
High performance C++ framework for concurrent servers
Public Types | Public Member Functions | List of all members
seastar::inheriting_concrete_execution_stage< ReturnType, Args > Class Template Referencefinal

Detailed Description

template<typename ReturnType, typename... Args>
class seastar::inheriting_concrete_execution_stage< ReturnType, Args >

Concrete execution stage class, with support for automatic scheduling_group inheritance.

A variation of concrete_execution_stage that inherits the scheduling_group from the caller. Each call (of operator()) can be in its own scheduling group.

Template Parameters
ReturnTypereturn type of the function object
Argsargument pack containing arguments to the function object, needs to have move constructor that doesn't throw

#include <seastar/core/execution_stage.hh>

Inheritance diagram for seastar::inheriting_concrete_execution_stage< ReturnType, Args >:
seastar::inheriting_execution_stage

Public Types

using stats = boost::container::static_vector< per_scheduling_group_stats, max_scheduling_groups()>
 

Public Member Functions

 inheriting_concrete_execution_stage (const sstring &name, noncopyable_function< ReturnType(Args...)> f)
 
return_type operator() (typename internal::wrap_for_es< Args >::type... args)
 
inheriting_execution_stage::stats get_stats () const noexcept
 

Constructor & Destructor Documentation

◆ inheriting_concrete_execution_stage()

template<typename ReturnType , typename... Args>
seastar::inheriting_concrete_execution_stage< ReturnType, Args >::inheriting_concrete_execution_stage ( const sstring &  name,
noncopyable_function< ReturnType(Args...)>  f 
)
inline

Construct an inheriting concrete execution stage.

Parameters
nameA name for the execution stage; must be unique
fFunction to be called in response to operator(). The function call will be deferred and batched with similar calls to increase instruction cache hit rate.

Member Function Documentation

◆ get_stats()

template<typename ReturnType , typename... Args>
inheriting_execution_stage::stats seastar::inheriting_concrete_execution_stage< ReturnType, Args >::get_stats ( ) const
inlinenoexcept

Returns summary of individual execution stage usage statistics

Returns
a vector of the stats of the individual per-scheduling group executation stages. Each element in the vector is a pair composed of the scheduling group and the stats for the respective execution stage. Scheduling groups that have had no respective calls enqueued yet are omitted.

◆ operator()()

template<typename ReturnType , typename... Args>
return_type seastar::inheriting_concrete_execution_stage< ReturnType, Args >::operator() ( typename internal::wrap_for_es< Args >::type...  args)
inline

Enqueues a call to the stage's function

Adds a function call to the queue. Objects passed by value are moved, rvalue references are decayed and the objects are moved, lvalue references need to be explicitly wrapped using seastar::ref().

The caller's scheduling_group will be preserved across the call.

Usage example:

void do_something(int);
thread_local auto stage = seastar::inheriting_concrete_execution_stage<int>("execution-stage", do_something);
future<> func(int x) {
return stage(x);
}
Concrete execution stage class, with support for automatic scheduling_group inheritance.
Definition: execution_stage.hh:325
Parameters
argsarguments passed to the stage's function
Returns
future containing the result of the call to the stage's function

The documentation for this class was generated from the following file: