12#ifndef SST_CORE_REAL_TIME_ALARM_MANAGER_H
13#define SST_CORE_REAL_TIME_ALARM_MANAGER_H
15#include "sst/core/realtimeAction.h"
16#include "sst/core/serialization/serializable.h"
17#include "sst/core/sst_types.h"
18#include "sst/core/threadsafe.h"
19#include "sst/core/warnmacros.h"
40 SST_ELI_REGISTER_REALTIMEACTION(
ExitCleanRealTimeAction,
"sst",
"rt.exit.clean", SST_ELI_ELEMENT_VERSION(0, 1, 0),
41 "Signal handler that causes an immediate, but non-emergency shutdown. This is the default action for the "
42 "'--exit-after' option.")
45 virtual void execute()
override;
46 virtual void begin(time_t scheduled_time)
override;
54 SST_ELI_ELEMENT_VERSION(0, 1, 0),
55 "Signal handler that causes an emergency shutdown. This is the default action for SIGTERM and SIGINT.")
58 virtual void execute()
override;
66 "Signal handler that causes SST-Core to print its status. This is the default action for SIGUSR1.")
69 void execute()
override;
77 SST_ELI_ELEMENT_VERSION(0, 1, 0),
78 "Signal handler that causes SST-Core to print its status along with component status. This is the default "
79 "action for SIGUSR2.")
82 void execute()
override;
90 "Signal handler that causes SST to generate a checkpoint. This is the default action for the "
91 "'--checkpoint-wall-period' option.")
94 virtual void execute()
override;
95 virtual void begin(time_t scheduled_time)
override;
104 SST_ELI_REGISTER_REALTIMEACTION(
HeartbeatRealTimeAction,
"sst",
"rt.heartbeat", SST_ELI_ELEMENT_VERSION(0, 1, 0),
105 "Signal handler that causes SST to generate a heartbeat message (status and some resource usage information). "
106 "This is the default action for the '--heartbeat-wall-period' option.")
109 virtual void execute()
override;
110 virtual void begin(time_t scheduled_time)
override;
114 static std::atomic<uint64_t> thr_max_tv_depth_;
124 SST_ELI_ELEMENT_VERSION(0, 1, 0),
125 "Signal handler that causes SST to break into an interactive console based on the --interactive-console flag.")
128 void execute()
override;
129 bool isValidSigalrmAction()
override {
return false; }
137class RealTimeIntervalAction
140 RealTimeIntervalAction(uint32_t interval,
RealTimeAction* action);
142 void begin(time_t begin_time);
144 void execute(uint32_t elapsed);
145 uint32_t getNextAlarmTime()
const;
148 uint32_t alarm_interval_;
149 uint32_t next_alarm_time_;
156class AlrmSignalAction :
public RealTimeAction
160 void execute()
override;
161 void addIntervalAction(uint32_t interval, RealTimeAction* action);
162 virtual void begin(time_t scheduled_time)
override;
165 std::vector<RealTimeIntervalAction> interval_actions_;
169 static uint32_t elapsed_;
177 explicit RealTimeManager(
RankInfo num_ranks);
199 static void installSignalHandlers();
200 static void SimulationSigEndHandler(
int sig);
201 static void SimulationSigUsrHandler(
int sig);
202 static void SimulationSigAlrmHandler(
int sig);
205 bool getSignals(
int& sig_end,
int& sig_usr,
int& sig_alrm);
224 bool can_checkpoint_ =
false;
225 bool can_initiate_interactive_ =
false;
229 std::map<int, RealTimeAction*> signal_actions_;
231 static sig_atomic_t sig_alrm_from_os_;
232 static sig_atomic_t sig_usr_from_os_;
233 static sig_atomic_t sig_end_from_os_;
bool canInitiateCheckpoint() override
Let's the core know if this action may trigger a checkpoint so that all the checkpoint infrastructure...
Definition realtime.h:97
Definition serializable.h:25
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition serializer.h:43
Definition threadsafe.h:50
Definition realtime.h:102
Definition realtime.h:121
bool canInitiateCheckpoint() override
Let's the core know if this action may trigger a checkpoint so that all the checkpoint infrastructure...
Definition realtime.h:132
bool canInitiateInteractive() override
Lets the core know if this action may trigger an interactive console.
Definition realtime.h:133
Output object provides consistent method for outputting data to stdout, stderr and/or sst debug file.
Definition output.h:58
An event to trigger at a real-time interval.
Definition realtimeAction.h:32
Class to manage real-time events (signals and alarms).
Definition realtime.h:175
void notifySignal()
Simulation run loop calls this when a signal has been received from the OS.
Definition realtime.cc:610
bool canInitiateCheckpoint()
Check whether or not any of the Actions registered with the manager can initiate a checkpoint.
Definition realtime.h:211
void performSignal(int signum)
This is a request to execute the handler in response to a particular signal.
Definition realtime.cc:666
void registerSignal(RealTimeAction *action, int signum)
Register actions.
Definition realtime.cc:576
bool canInitiateInteractive()
Check whether or not any of the Actions registered with the manager can initiate the interactive cons...
Definition realtime.h:217
void begin()
Begin monitoring signals.
Definition realtime.cc:597
Performs Unit math in full precision.
Definition unitAlgebra.h:107