SST 12.1.0
Structural Simulation Toolkit
coreTest_MessageGeneratorComponent.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_MESSAGEGENERATORCOMPONENT_H
17#define SST_CORE_CORETEST_MESSAGEGENERATORCOMPONENT_H
18
19#include "sst/core/component.h"
20#include "sst/core/link.h"
21
22namespace SST {
23namespace CoreTestMessageGeneratorComponent {
24
26{
27public:
28 // REGISTER THIS COMPONENT INTO THE ELEMENT LIBRARY
29 SST_ELI_REGISTER_COMPONENT(
31 "coreTestElement",
32 "coreTestMessageGeneratorComponent",
33 SST_ELI_ELEMENT_VERSION(1,0,0),
34 "Messaging rate benchmark component",
35 COMPONENT_CATEGORY_NETWORK
36 )
37
38 SST_ELI_DOCUMENT_PARAMS(
39 { "printStats", "Prints the statistics from the component", "0"},
40 { "clock", "Sets the clock for the message generator", "1GHz" },
41 { "sendcount", "Sets the number of sends in the simulation.", "1000" },
42 { "outputinfo", "Sets the level of output information", "1" }
43 )
44
45 // Optional since there is nothing to document
46 SST_ELI_DOCUMENT_STATISTICS(
47 )
48
49 SST_ELI_DOCUMENT_PORTS(
50 { "remoteComponent", "Sets the link for the message component, message components talk to each other exchanging coreTest messages", { "coreTestMessageGeneratorComponent.coreTestMessage", "" } }
51 )
52
53 // Optional since there is nothing to document
54 SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS(
55 )
56
57 coreTestMessageGeneratorComponent(SST::ComponentId_t id, SST::Params& params);
58 void setup() {}
59 void finish()
60 {
61 fprintf(stdout, "Component completed at: %" PRIu64 " milliseconds\n", (uint64_t)getCurrentSimTimeMilli());
62 }
63
64private:
65 coreTestMessageGeneratorComponent(); // for serialization only
67 void operator=(const coreTestMessageGeneratorComponent&); // do not implement
68
69 void handleEvent(SST::Event* ev);
70 virtual bool tick(SST::Cycle_t);
71
72 std::string clock_frequency_str;
73 int message_counter_sent;
74 int message_counter_recv;
75 int total_message_send_count;
76 int output_message_info;
77
78 SST::Link* remote_component;
79};
80
81} // namespace CoreTestMessageGeneratorComponent
82} // namespace SST
83
84#endif // SST_CORE_CORETEST_MESSAGEGENERATORCOMPONENT_H
SimTime_t getCurrentSimTimeMilli() const
Utility function to return the time since the simulation began in milliseconds.
Definition: baseComponent.cc:507
Main component object for the simulation.
Definition: component.h:31
Definition: coreTest_MessageGeneratorComponent.h:26
void finish()
Called after complete phase, but before objects are destroyed.
Definition: coreTest_MessageGeneratorComponent.h:59
void setup()
Called after all components have been constructed and initialization has completed,...
Definition: coreTest_MessageGeneratorComponent.h:58
Base class for Events - Items sent across links to communicate between components.
Definition: event.h:35
Parameter store.
Definition: params.h:56