Mercury Currency Engine
Public Member Functions | List of all members
mce::scheduler::measurement Struct Reference

a struct allowing comparison of scheduler workload More...

#include <scheduler.hpp>

Public Member Functions

 measurement (const measurement &rhs)
 
 measurement (measurement &&rhs)
 
 measurement (size_t enqueued, size_t scheduled)
 
measurementoperator= (const measurement &rhs)
 
measurementoperator= (measurement &&rhs)
 
bool operator== (const measurement &rhs)
 
bool operator< (const measurement &rhs)
 
bool operator<= (const measurement &rhs)
 
 operator size_t () const
 convert to a directly comparable fundamental type
 
size_t scheduled () const
 count of all scheduled coroutines, blocked or enqueued
 
size_t enqueued () const
 count of coroutines actively enqueued for execution
 
size_t blocked () const
 count of coroutines blocked on the scheduler
 

Detailed Description

a struct allowing comparison of scheduler workload

This object represents a single value of a fundamental, word sized type. In theory, it should be equally efficient to copy around as a fundamental type.

It also provides introspection and utility methods.

Constructor & Destructor Documentation

◆ measurement()

mce::scheduler::measurement::measurement ( size_t  enqueued,
size_t  scheduled 
)
inline

Perform an operation which concatenates the enqueued count with the scheduled count, such that the first half of the returned size_t will be the enqueued count while the second half is the scheduled count.

IE, enqueued task count has higher priority when determining load, but if said count is equal, the tie can be broken by the scheduled task count, which includes blocked coroutines.

This mechanism allows for sanely measuring scheduling load in the average case, while additionally protecting against edge cases without adding much processing overhead and almost no extra lock contention.


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