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"
39 SST_ELI_REGISTER_REALTIMEACTION(
ExitCleanRealTimeAction,
"sst",
"rt.exit.clean", SST_ELI_ELEMENT_VERSION(0, 1, 0),
40 "Signal handler that causes an immediate, but non-emergency shutdown. This is the default action for the "
41 "'--exit-after' option.")
44 virtual void execute()
override;
45 virtual void begin(time_t scheduled_time)
override;
53 SST_ELI_ELEMENT_VERSION(0, 1, 0),
54 "Signal handler that causes an emergency shutdown. This is the default action for SIGTERM and SIGINT.")
57 virtual void execute()
override;
65 "Signal handler that causes SST-Core to print its status. This is the default action for SIGUSR1.")
68 void execute()
override;
76 SST_ELI_ELEMENT_VERSION(0, 1, 0),
77 "Signal handler that causes SST-Core to print its status along with component status. This is the default "
78 "action for SIGUSR2.")
81 void execute()
override;
89 "Signal handler that causes SST to generate a checkpoint. This is the default action for the "
90 "'--checkpoint-wall-period' option.")
93 virtual void execute()
override;
94 virtual void begin(time_t scheduled_time)
override;
103 SST_ELI_REGISTER_REALTIMEACTION(
HeartbeatRealTimeAction,
"sst",
"rt.heartbeat", SST_ELI_ELEMENT_VERSION(0, 1, 0),
104 "Signal handler that causes SST to generate a heartbeat message (status and some resource usage information). "
105 "This is the default action for the '--heartbeat-wall-period' option.")
108 virtual void execute()
override;
109 virtual void begin(time_t scheduled_time)
override;
113 static std::atomic<uint64_t> thr_max_tv_depth_;
123 SST_ELI_ELEMENT_VERSION(0, 1, 0),
124 "Signal handler that causes SST to break into an interactive console based on the --interactive-console flag.")
127 void execute()
override;
128 bool isValidSigalrmAction()
override {
return false; }
132class RealTimeIntervalAction
135 RealTimeIntervalAction(uint32_t interval,
RealTimeAction* action);
137 void begin(time_t begin_time);
139 void execute(uint32_t elapsed);
140 uint32_t getNextAlarmTime()
const;
143 uint32_t alarm_interval_;
144 uint32_t next_alarm_time_;
151class AlrmSignalAction :
public RealTimeAction
155 void execute()
override;
156 void addIntervalAction(uint32_t interval, RealTimeAction* action);
157 virtual void begin(time_t scheduled_time)
override;
160 std::vector<RealTimeIntervalAction> interval_actions_;
164 static uint32_t elapsed_;
172 explicit RealTimeManager(
RankInfo num_ranks);
194 static void installSignalHandlers();
195 static void SimulationSigEndHandler(
int sig);
196 static void SimulationSigUsrHandler(
int sig);
197 static void SimulationSigAlrmHandler(
int sig);
200 bool getSignals(
int& sig_end,
int& sig_usr,
int& sig_alrm);
213 bool can_checkpoint_ =
false;
216 std::map<int, RealTimeAction*> signal_actions_;
218 static sig_atomic_t sig_alrm_from_os_;
219 static sig_atomic_t sig_usr_from_os_;
220 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:96
Definition serializable.h:24
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition serializer.h:45
Definition threadsafe.h:46
Definition realtime.h:101
Definition realtime.h:120
Output object provides consistent method for outputting data to stdout, stderr and/or sst debug file.
Definition output.h:54
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:170
void notifySignal()
Simulation run loop calls this when a signal has been received from the OS.
Definition realtime.cc:606
bool canInitiateCheckpoint()
Check whether or not any of the Actions registered with the manager can initiate a checkpoint.
Definition realtime.h:206
void performSignal(int signum)
This is a request to execute the handler in response to a particular signal.
Definition realtime.cc:662
void registerSignal(RealTimeAction *action, int signum)
Register actions.
Definition realtime.cc:574
void begin()
Begin monitoring signals.
Definition realtime.cc:593
Performs Unit math in full precision.
Definition unitAlgebra.h:107