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