Sen API
Sen Libraries
Loading...
Searching...
No Matches
component_api.h File Reference
#include "sen/core/base/compiler_macros.h"
#include "sen/core/base/duration.h"
#include "sen/core/base/move_only_function.h"
#include "sen/core/base/mutex_utils.h"
#include "sen/core/base/result.h"
#include "sen/core/base/span.h"
#include "sen/core/base/timestamp.h"
#include "sen/core/meta/type_registry.h"
#include "sen/core/meta/var.h"
#include "sen/core/obj/detail/work_queue.h"
#include "sen/core/obj/interest.h"
#include "sen/core/obj/object.h"
#include "sen/core/obj/object_list.h"
#include "sen/core/obj/object_source.h"
#include "sen/core/obj/subscription.h"
#include "sen/kernel/kernel.h"
#include "sen/kernel/source_info.h"
#include "sen/kernel/tracer.h"
#include "sen/kernel/transport.h"
#include "stl/sen/kernel/basic_types.stl.h"
#include "stl/sen/kernel/network_footprint.stl.h"
#include <spdlog/logger.h>
#include <spdlog/sinks/sink.h>
#include <atomic>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <filesystem>
#include <functional>
#include <memory>
#include <optional>
#include <string>
#include <string_view>
#include <type_traits>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

struct  sen::kernel::LoggerSinkRegistration
 What registering a logger sink did. More...
struct  sen::kernel::ComponentMonitoringInfo
 Runtime monitoring information about a single component runner. More...
struct  sen::kernel::KernelMonitoringInfo
 Kernel runtime monitoring information. More...
class  sen::kernel::KernelApi
 User-facing kernel functions. More...
class  sen::kernel::ConfigGetter
 Allows for fetching configuration parameters. More...
class  sen::kernel::RegistrationApi
 API for objects when registered. More...
class  sen::kernel::PreloadApi
 What can be done when preloading a component. More...
class  sen::kernel::LoadApi
 What can be done when loading a component. More...
class  sen::kernel::InitApi
 What can be done when initializing a component. More...
class  sen::kernel::RunApi
 What can be done while a component is running. More...
class  sen::kernel::UnloadApi
 What can be done when unloading a component. More...

Namespaces

namespace  sen
namespace  sen::kernel
 Strong type for the unique identifier for a transport timer.

Typedefs

using sen::kernel::FuncResult = Result<void, ExecError>
 The result of operations that are called once.
using sen::kernel::PassResult = Result<OpState, ExecError>
 The result of operations that may be called multiple times.
using sen::kernel::NetworkFootprintReporter = NetworkFootprint(Span<const BusAddress>) const
 Callable that builds a network footprint from bus addresses.

Enumerations

enum class  sen::kernel::TerminalOwnership { sen::kernel::shared , sen::kernel::owned }
 Whether the component registering a log sink owns the terminal. More...

Class Documentation

◆ sen::kernel::LoggerSinkRegistration

struct sen::kernel::LoggerSinkRegistration

What registering a logger sink did.

There is no arbitration: a sink is added, never refused, so two components that both render logs will each be handed every line, including the other's. Anything that needs exclusivity has to read registeredSinks and decide for itself.

Class Members
bool added = false false when this sink was already registered, so the call only changed its terminal ownership
bool ownsTerminal = false whether this sink now holds the terminal claim
bool terminalOwnedElsewhere = false whether a different registered sink holds the claim
size_t registeredSinks = 0 sinks registered behind the relay, this one included

◆ sen::kernel::ComponentMonitoringInfo

struct sen::kernel::ComponentMonitoringInfo

Runtime monitoring information about a single component runner.

Class Members
string name
uint32_t group = 0
bool requiresRealTime = false
optional< Duration > cycleTime
size_t objectCount = 0
optional< Duration > lastCycleExecutionCpuTime Thread CPU time, user and system, consumed by the last completed execution cycle. On Windows every CPU time here is quantised to the system clock tick, 15.6 ms by default, so for a shorter period than that these figures say very little.
optional< Duration > lastCycleComponentCpuTime The part of that spent in the component's own code: its objects' update() and its work function. Its preDrain() and preCommit(), its commit-time event handlers and its discovery callbacks run outside this and are counted with Sen's.
optional< Duration > lastCycleQueuedWorkCpuTime The part of that spent on work queued on the component: the callbacks it registered, and serving the calls other components make on its objects. Serving a call is partly the component's method and partly Sen's transport, so it is reported on its own.
optional< Duration > worstCycleExecutionCpuTime The most CPU time any one cycle has used since the component started running, leaving out its first cycle, which carries the startup. A component that runs long once in a thousand cycles rarely has it in the last one.
optional< Duration > worstCycleComponentCpuTime The component's share of that same worst cycle, so the two can be compared.
optional< Duration > lastCycleStartDelay How late the thread woke for the cycle it was waiting for. The scheduler's contribution, kept apart from the component's. Negative if it woke early. Empty for the first cycle, and unless the component runs on the kernel's real-time loop.
optional< Duration > worstStartDelay The latest the thread has ever woken. A machine that is late once in a thousand cycles rarely has it in lastCycleStartDelay.
optional< uint64_t > overrunCount Cycles whose execution used more CPU time than the period. A cycle that blocked rather than computed does not appear here, it appears in missedFrameCount. A cycle that overruns also finishes past its slot, so missedFrameCount rises with it. Empty unless the component runs on the kernel's real-time loop.
optional< uint64_t > missedFrameCount Cycles lost because the work finished after the cycle it belonged to. Every lost cycle is counted, not the run of them. Wall time, so blocking counts, and so does a clock correction that moves the schedule forward. The first cycle is not counted: the schedule starts before the component has finished its own startup. Empty unless the component runs on the kernel's real-time loop.
optional< uint64_t > oversleptCount Cycles lost because the sleep returned late, so the component was not running when it should have been. Every lost cycle is counted, not the run of them. A wake-up late by less than a period loses no cycle here and shows up in missedFrameCount, so read lastCycleStartDelay before blaming the component. Empty unless it runs on the kernel's real-time loop.

◆ sen::kernel::KernelMonitoringInfo

struct sen::kernel::KernelMonitoringInfo

Kernel runtime monitoring information.

Class Members
RunMode runMode = RunMode::realTime
TransportStats transportStats {}
vector< ComponentMonitoringInfo > components