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