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