12#ifndef SST_CORE_IMPL_PORTMODULE_RANDOMDROP_H
13#define SST_CORE_IMPL_PORTMODULE_RANDOMDROP_H
15#include "sst/core/eli/elementinfo.h"
16#include "sst/core/portModule.h"
17#include "sst/core/rng/marsaglia.h"
22namespace SST::IMPL::PortModule {
27 SST_ELI_REGISTER_PORTMODULE(
30 "portmodules.random_drop",
31 SST_ELI_ELEMENT_VERSION(0, 1, 0),
32 "Port module that will randomly drop events based on specified probability"
35 SST_ELI_DOCUMENT_PARAMS(
36 {
"drop_prob",
"Probability to drop event",
"0.01" },
37 {
"drop_on_send",
"Controls whether to drop packets during the send versus the default of on the receive",
"false" },
38 {
"rngseed",
"Set a seed for the random number generator used to control drops",
"7" },
39 {
"verbose",
"Debugging output",
"false"}
42 SST_ELI_DOCUMENT_STATISTICS(
43 {
"dropped",
"Counts number of events that are dropped",
"events", 1},
44 {
"observed",
"Counts number of events that are observed, including any dropped",
"events", 1}
47 explicit RandomDrop(
Params& params);
50 RandomDrop() =
default;
83 double drop_prob_ = 0.01;
84 bool verbose_ =
false;
85 bool drop_on_send_ =
false;
90 std::string* print_info_ =
nullptr;
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition serializer.h:43
Base class for Events - Items sent across links to communicate between components.
Definition event.h:41
Definition randomDrop.h:25
bool installOnSend() override
Called to determine if the PortModule should be installed on sends.
Definition randomDrop.h:75
void eventSent(uintptr_t key, Event *&ev) override
Function that will be called when an event is sent on a link with registered PortModules.
Definition randomDrop.cc:54
uintptr_t registerLinkAttachTool(const AttachPointMetaData &mdata) override
Function that will be called when a PortModule is registered on sends (i.e.
Definition randomDrop.cc:43
void interceptHandler(uintptr_t key, Event *&data, bool &cancel) override
Function that will be called before the event handler to let the attach point intercept the data.
Definition randomDrop.cc:81
bool installOnReceive() override
Called to determine if the PortModule should be installed on receives.
Definition randomDrop.h:65
uintptr_t registerHandlerIntercept(const AttachPointMetaData &mdata) override
Function that will be called when a handler is registered with recieves (i.e.
Definition randomDrop.cc:70
Parameter store.
Definition params.h:65
PortModules are modules that can be attached to the send and/or receive side of ports.
Definition portModule.h:54
Implements a random number generator using the Marsaglia method.
Definition marsaglia.h:41
Forms the template defined base class for statistics gathering within SST.
Definition statbase.h:369