SST  11.0.0
StructuralSimulationToolkit
coreTest_StatisticsComponent.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 _CORETESTSTATISTICSCOMPONENT_H
17 #define _CORETESTSTATISTICSCOMPONENT_H
18 
19 #include "sst/core/component.h"
20 #include "sst/core/rng/sstrng.h"
21 
22 using namespace SST;
23 using namespace SST::RNG;
24 using namespace SST::Statistics;
25 
26 namespace SST {
27 namespace CoreTestStatisticsComponent {
28 
30 {
31 public:
32 
33  // REGISTER THIS COMPONENT INTO THE ELEMENT LIBRARY
34  SST_ELI_REGISTER_COMPONENT(
36  "coreTestElement",
37  "coreTestStatisticsComponent",
38  SST_ELI_ELEMENT_VERSION(1,0,0),
39  "Statistics Demo Component",
40  COMPONENT_CATEGORY_UNCATEGORIZED
41  )
42 
43  SST_ELI_DOCUMENT_PARAMS(
44  { "seed_w", "The seed to use for the random number generator", "7" },
45  { "seed_z", "The seed to use for the random number generator", "5" },
46  { "seed", "The seed to use for the random number generator.", "11" },
47  { "rng", "The random number generator to use (Marsaglia or Mersenne), default is Mersenne", "Mersenne"},
48  { "count", "The number of random numbers to generate, default is 1000", "1000" }
49  )
50 
51  SST_ELI_DOCUMENT_STATISTICS(
52  { "stat1_U32", "Test Statistic 1 - Collecting U32 Data", "units", 1},
53  { "stat2_U64", "Test Statistic 2 - Collecting U64 Data", "units", 2},
54  { "stat3_I32", "Test Statistic 3 - Collecting I32 Data", "units", 3},
55  { "stat4_I64", "Test Statistic 4 - Collecting I64 Data", "units", 4},
56  { "stat5_U32", "Test Statistic 5 - Collecting U32 Data", "units", 5},
57  { "stat6_U64", "Test Statistic 6 - Collecting U64 Data", "units", 6}
58  )
59 
60  // Optional since there is nothing to document
61  SST_ELI_DOCUMENT_PORTS(
62  )
63 
64  // Optional since there is nothing to document
65  SST_ELI_DOCUMENT_SUBCOMPONENT_SLOTS(
66  )
67 
68  coreTestStatisticsComponent(ComponentId_t id, Params& params);
69  void setup() { }
70  void finish() { }
71 
72 private:
73  coreTestStatisticsComponent(); // for serialization only
74  coreTestStatisticsComponent(const coreTestStatisticsComponent&); // do not implement
75  void operator=(const coreTestStatisticsComponent&); // do not implement
76 
77  virtual bool Clock1Tick(SST::Cycle_t);
78 
79  SSTRandom* rng;
80  std::string rng_type;
81  int rng_max_count;
82  int rng_count;
83  Output& output;
84 
85  // Histogram Statistics
86  Statistic<uint32_t>* stat1_U32;
87  Statistic<uint64_t>* stat2_U64;
88  Statistic<int32_t>* stat3_I32;
89  Statistic<int64_t>* stat4_I64;
90 
91  // Accumulator Statistics
92  Statistic<uint32_t>* stat5_U32;
93  Statistic<uint64_t>* stat6_U64;
94  Statistic<uint32_t>* stat7_U32_NOTUSED;
95 
96 };
97 
98 } // namespace CoreTestStatistics
99 } // namespace SST
100 
101 #endif /* _CORETESTSTATISTICSCOMPONENT_H */
Output object provides consistent method for outputting data to stdout, stderr and/or sst debug file...
Definition: output.h:54
Definition: coreTest_StatisticsComponent.h:29
Main component object for the simulation.
Definition: component.h:31
void setup()
Called after all components have been constructed and initialization has completed, but before simulation time has begun.
Definition: coreTest_StatisticsComponent.h:69
Implements the base class for random number generators for the SST core.
Definition: sstrng.h:27
Parameter store.
Definition: params.h:44
void finish()
Called after simulation completes, but before objects are destroyed.
Definition: coreTest_StatisticsComponent.h:70