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/threadsafe.h"
18#include "sst/core/timeVortex.h"
20#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 propability"
35 SST_ELI_DOCUMENT_PARAMS(
36 {
"drop_prob",
"Probability to drop event",
"0.01" },
37 {
"drop_on_send",
"Controls whether to drop packetes 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 explicit RandomDrop(
Params& params);
45 RandomDrop() =
default;
78 double drop_prob_ = 0.01;
79 bool verbose_ =
false;
80 bool drop_on_send_ =
false;
85 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:45
Base class for Events - Items sent across links to communicate between components.
Definition event.h:35
Definition randomDrop.h:25
bool installOnSend() override
Called to determine if the PortModule should be installed on sends.
Definition randomDrop.h:70
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:51
uintptr_t registerLinkAttachTool(const AttachPointMetaData &mdata) override
Function that will be called when a PortModule is registered on sends (i.e.
Definition randomDrop.cc:40
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:77
bool installOnReceive() override
Called to determine if the PortModule should be installed on receives.
Definition randomDrop.h:60
uintptr_t registerHandlerIntercept(const AttachPointMetaData &mdata) override
Function that will be called when a handler is registered with recieves (i.e.
Definition randomDrop.cc:66
Parameter store.
Definition params.h:58
PortModules are modules that can be attached to the send and/or receive side of ports.
Definition portModule.h:46
Implements a random number generator using the Marsaglia method.
Definition marsaglia.h:40