SST 12.1.0
Structural Simulation Toolkit
coreTest_MemPoolTest.h
1// Copyright 2009-2022 NTESS. Under the terms
2// of Contract DE-NA0003525 with NTESS, the U.S.
3// Government retains certain rights in this software.
4//
5// Copyright (c) 2009-2022, NTESS
6// All rights reserved.
7//
8// Portions are copyright of other developers:
9// See the file CONTRIBUTORS.TXT in the top level directory
10// the distribution for more information.
11//
12// This file is part of the SST software package. For license
13// information, see the LICENSE file in the top level directory of the
14// distribution.
15
16#ifndef SST_CORE_CORETEST_MEMPOOLTEST_H
17#define SST_CORE_CORETEST_MEMPOOLTEST_H
18
19#include "sst/core/component.h"
20#include "sst/core/link.h"
21
22#include <vector>
23
24namespace SST {
25namespace CoreTestMemPoolTest {
26
27
28// We'll have 4 different sized events
29
31{
32public:
34
35 void serialize_order(SST::Core::Serialization::serializer& ser) override
36 {
37 Event::serialize_order(ser);
38 ser& array;
39 }
40
42
43private:
44 uint64_t array[1];
45};
46
48{
49public:
51
52 void serialize_order(SST::Core::Serialization::serializer& ser) override
53 {
54 Event::serialize_order(ser);
55 ser& array;
56 }
57
59
60private:
61 uint64_t array[2];
62};
63
65{
66public:
68
69 void serialize_order(SST::Core::Serialization::serializer& ser) override
70 {
71 Event::serialize_order(ser);
72 ser& array;
73 }
74
76
77private:
78 uint64_t array[3];
79};
80
82{
83public:
85
86 void serialize_order(SST::Core::Serialization::serializer& ser) override
87 {
88 Event::serialize_order(ser);
89 ser& array;
90 }
91
93
94private:
95 uint64_t array[4];
96};
97
99{
100public:
102
103 double rate;
104
105 // No need to actually serialize the data because it isn't used.
106 void serialize_order(SST::Core::Serialization::serializer& ser) override
107 {
108 Event::serialize_order(ser);
109 ser& rate;
110 }
111
113};
114
115
116// Class will just send messages to other side of link. They can be
117// configured to send different size events to test the mempool
118// overflow feature
120{
121public:
122 SST_ELI_REGISTER_COMPONENT(
124 "coreTestElement",
125 "memPoolTestComponent",
126 SST_ELI_ELEMENT_VERSION(1,0,0),
127 "Test MemPool overflow",
128 COMPONENT_CATEGORY_UNCATEGORIZED
129 )
130
131 SST_ELI_DOCUMENT_PARAMS(
132 { "event_size", "Size of event to sent (valid sizes: 1-4).", "1" },
133 { "initial_events", "Number of events to send to each other component", "256" }
134 )
135
136 SST_ELI_DOCUMENT_PORTS(
137 {"port%d", "Links to other test components", { "CoreTestMemPoolTest.MemPoolTestEvent", "" } }
138 )
139
140 SST_ELI_DOCUMENT_ATTRIBUTES(
141 { "test_element", "true" }
142 )
143
144 MemPoolTestComponent(ComponentId_t id, Params& params);
146
147 void eventHandler(Event* ev, int port);
148 void setup(void) override;
149 void finish(void) override;
150 void complete(unsigned int phase) override;
151
152private:
153 int event_size;
154 std::vector<Link*> links;
155 int events_sent;
156 int events_recv;
157 int initial_events;
158 double event_rate;
159
160 Event* createEvent();
161};
162
163
164} // namespace CoreTestMemPoolTest
165} // namespace SST
166
167#endif // SST_CORE_CORETEST_COMPONENT_H
Main component object for the simulation.
Definition: component.h:31
Definition: coreTest_MemPoolTest.h:120
void finish(void) override
Called after complete phase, but before objects are destroyed.
Definition: coreTest_MemPoolTest.cc:114
void setup(void) override
Called after all components have been constructed and initialization has completed,...
Definition: coreTest_MemPoolTest.cc:77
Definition: coreTest_MemPoolTest.h:31
Definition: coreTest_MemPoolTest.h:48
Definition: coreTest_MemPoolTest.h:65
Definition: coreTest_MemPoolTest.h:82
Definition: coreTest_MemPoolTest.h:99
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:35
Base class for Events - Items sent across links to communicate between components.
Definition: event.h:35
Parameter store.
Definition: params.h:56