SST  13.0.0
StructuralSimulationToolkit
statbase.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_STATAPI_STATBASE_H
13 #define SST_CORE_STATAPI_STATBASE_H
14 
15 #include "sst/core/eli/elementinfo.h"
16 #include "sst/core/oneshot.h"
17 #include "sst/core/params.h"
18 #include "sst/core/serialization/serializable.h"
19 #include "sst/core/sst_types.h"
20 #include "sst/core/statapi/statfieldinfo.h"
21 #include "sst/core/warnmacros.h"
22 
23 #include <string>
24 
25 namespace SST {
26 class BaseComponent;
27 class Factory;
28 
29 namespace Statistics {
30 class StatisticOutput;
31 class StatisticFieldsOutput;
32 class StatisticProcessingEngine;
33 class StatisticGroup;
34 
36 {
37 public:
38  std::string name;
39  Params params;
40 
41  StatisticInfo(const std::string& name) : name(name) {}
42  StatisticInfo(const std::string& name, const Params& params) : name(name), params(params) {}
43  StatisticInfo() {} /* DO NOT USE: For serialization */
44 
45  void serialize_order(SST::Core::Serialization::serializer& ser) override
46  {
47  ser& name;
48  ser& params;
49  }
50 
51  ImplementSerializable(SST::Statistics::StatisticInfo)
52 };
53 
54 /**
55  \class StatisticBase
56 
57  Forms the base class for statistics gathering within SST. Statistics are
58  gathered and processed into various (extensible) output forms. Statistics
59  are expected to be named so that they can be located in the simulation
60  output files.
61 */
62 
64 {
65 public:
66  /** Statistic collection mode */
67  typedef enum { STAT_MODE_UNDEFINED, STAT_MODE_COUNT, STAT_MODE_PERIODIC, STAT_MODE_DUMP_AT_END } StatMode_t;
68 
69  // Enable/Disable of Statistic
70  /** Enable Statistic for collections */
71  void enable() { m_statEnabled = true; }
72 
73  /** Disable Statistic for collections */
74  void disable() { m_statEnabled = false; }
75 
76  // Handling of Collection Counts and Data
77  /** Inform the Statistic to clear its data */
78  virtual void clearStatisticData() {}
79 
80  /** Set the current collection count to 0 */
81  virtual void resetCollectionCount();
82 
83  /** Increment current collection count */
84  virtual void incrementCollectionCount(uint64_t increment);
85 
86  /** Set the current collection count to a defined value */
87  virtual void setCollectionCount(uint64_t newCount);
88 
89  /** Set the collection count limit to a defined value */
90  virtual void setCollectionCountLimit(uint64_t newLimit);
91 
92  // Control Statistic Operation Flags
93  /** Set the Reset Count On Output flag.
94  * If Set, the collection count will be reset when statistic is output.
95  */
96  void setFlagResetCountOnOutput(bool flag) { m_resetCountOnOutput = flag; }
97 
98  static const std::vector<ElementInfoParam>& ELI_getParams();
99 
100  /** Set the Clear Data On Output flag.
101  * If Set, the data in the statistic will be cleared by calling
102  * clearStatisticData().
103  */
104  void setFlagClearDataOnOutput(bool flag) { m_clearDataOnOutput = flag; }
105 
106  /** Set the Output At End Of Sim flag.
107  * If Set, the statistic will perform an output at the end of simulation.
108  */
109  void setFlagOutputAtEndOfSim(bool flag) { m_outputAtEndOfSim = flag; }
110 
111  // Get Data & Information on Statistic
112  /** Return the Component Name */
113  const std::string& getCompName() const;
114 
115  /** Return the Statistic Name */
116  inline const std::string& getStatName() const { return m_statName; }
117 
118  /** Return the Statistic SubId */
119  inline const std::string& getStatSubId() const { return m_statSubId; }
120 
121  /** Return the full Statistic name of Component.StatName.SubId */
122  inline const std::string& getFullStatName() const { return m_statFullName; } // Return compName.statName.subId
123 
124  /** Return the Statistic type name */
125  inline const std::string& getStatTypeName() const { return m_statTypeName; }
126 
127  /** Return the Statistic data type */
128  inline const StatisticFieldInfo::fieldType_t& getStatDataType() const { return m_statDataType; }
129 
130  /** Return the Statistic data type */
131  inline const char* getStatDataTypeShortName() const
132  {
133  return StatisticFieldInfo::getFieldTypeShortName(m_statDataType);
134  }
135 
136  /** Return the Statistic data type */
137  inline const char* getStatDataTypeFullName() const
138  {
139  return StatisticFieldInfo::getFieldTypeFullName(m_statDataType);
140  }
141 
142  /** Return a pointer to the parent Component */
143  BaseComponent* getComponent() const { return m_component; }
144 
145  /** Return the enable status of the Statistic */
146  bool isEnabled() const { return m_statEnabled; }
147 
148  /** Return the enable status of the Statistic's ability to output data */
149  bool isOutputEnabled() const { return m_outputEnabled; }
150 
151  /** Return the collection count limit */
152  uint64_t getCollectionCountLimit() const { return m_collectionCountLimit; }
153 
154  /** Return the current collection count */
155  uint64_t getCollectionCount() const { return m_currentCollectionCount; }
156 
157  /** Return the ResetCountOnOutput flag value */
158  bool getFlagResetCountOnOutput() const { return m_resetCountOnOutput; }
159 
160  /** Return the ClearDataOnOutput flag value */
161  bool getFlagClearDataOnOutput() const { return m_clearDataOnOutput; }
162 
163  /** Return the OutputAtEndOfSim flag value */
164  bool getFlagOutputAtEndOfSim() const { return m_outputAtEndOfSim; }
165 
166  /** Return the collection mode that is registered */
167  StatMode_t getRegisteredCollectionMode() const { return m_registeredCollectionMode; }
168 
169  // Delay Methods (Uses OneShot to disable Statistic or Collection)
170  /** Delay the statistic from outputting data for a specified delay time
171  * @param delayTime - Value in UnitAlgebra format for delay (i.e. 10ns).
172  */
173  void delayOutput(const char* delayTime);
174 
175  /** Delay the statistic from collecting data for a specified delay time.
176  * @param delayTime - Value in UnitAlgebra format for delay (i.e. 10ns).
177  */
178  void delayCollection(const char* delayTime);
179 
180  // Status of Statistic
181  /** Indicate that the Statistic is Ready to be used */
182  virtual bool isReady() const { return true; }
183 
184  /** Indicate if the Statistic is a NullStatistic */
185  virtual bool isNullStatistic() const { return false; }
186 
187 protected:
190  friend class SST::Statistics::StatisticGroup;
192 
193  /** Construct a StatisticBase
194  * @param comp - Pointer to the parent constructor.
195  * @param statName - Name of the statistic to be registered. This name must
196  * match the name in the ElementInfoStatistic.
197  * @param statSubId - Additional name of the statistic
198  * @param statParams - The parameters for this statistic
199  */
200  // Constructors:
201  StatisticBase(BaseComponent* comp, const std::string& statName, const std::string& statSubId, Params& statParams);
202 
203  // Destructor
204  virtual ~StatisticBase() {}
205 
206  /** Return the Statistic Parameters */
207  Params& getParams() { return m_statParams; }
208 
209  /** Set the Statistic Data Type */
210  void setStatisticDataType(const StatisticFieldInfo::fieldType_t dataType) { m_statDataType = dataType; }
211 
212  /** Set an optional Statistic Type Name */
213  void setStatisticTypeName(const char* typeName) { m_statTypeName = typeName; }
214 
215 private:
216  friend class SST::BaseComponent;
217 
218  /** Set the Registered Collection Mode */
219  void setRegisteredCollectionMode(StatMode_t mode) { m_registeredCollectionMode = mode; }
220 
221  /** Construct a full name of the statistic */
222  static std::string buildStatisticFullName(const char* compName, const char* statName, const char* statSubId);
223  static std::string
224  buildStatisticFullName(const std::string& compName, const std::string& statName, const std::string& statSubId);
225 
226  // Required Virtual Methods:
227  /** Called by the system to tell the Statistic to register its output fields.
228  * by calling statOutput->registerField(...)
229  * @param statOutput - Pointer to the statistic output
230  */
231  virtual void registerOutputFields(StatisticFieldsOutput* statOutput) = 0;
232 
233  /** Called by the system to tell the Statistic to send its data to the
234  * StatisticOutput to be output.
235  * @param statOutput - Pointer to the statistic output
236  * @param EndOfSimFlag - Indicates that the output is occurring at the end of simulation.
237  */
238  virtual void outputStatisticFields(StatisticFieldsOutput* statOutput, bool EndOfSimFlag) = 0;
239 
240  /** Indicate if the Statistic Mode is supported.
241  * This allows Statistics to support STAT_MODE_COUNT and STAT_MODE_PERIODIC modes.
242  * by default, both modes are supported.
243  * @param mode - Mode to test
244  */
245  virtual bool isStatModeSupported(StatMode_t UNUSED(mode)) const { return true; } // Default is to accept all modes
246 
247  /** Verify that the statistic names match */
248  bool operator==(StatisticBase& checkStat);
249 
250  // Support Routines
251  void initializeStatName(const char* compName, const char* statName, const char* statSubId);
252  void initializeStatName(const std::string& compName, const std::string& statName, const std::string& statSubId);
253 
254  void initializeProperties();
255  void checkEventForOutput();
256 
257  // OneShot Callbacks:
258  void delayOutputExpiredHandler(); // Enable Output in handler
259  void delayCollectionExpiredHandler(); // Enable Collection in Handler
260 
261  const StatisticGroup* getGroup() const { return m_group; }
262  void setGroup(const StatisticGroup* group) { m_group = group; }
263 
264 protected:
265  StatisticBase(); // For serialization only
266 
267 private:
268  BaseComponent* m_component;
269  std::string m_statName;
270  std::string m_statSubId;
271  std::string m_statFullName;
272  std::string m_statTypeName;
273  Params m_statParams;
274  StatMode_t m_registeredCollectionMode;
275  uint64_t m_currentCollectionCount;
276  uint64_t m_outputCollectionCount;
277  uint64_t m_collectionCountLimit;
278  StatisticFieldInfo::fieldType_t m_statDataType;
279 
280  bool m_statEnabled;
281  bool m_outputEnabled;
282  bool m_resetCountOnOutput;
283  bool m_clearDataOnOutput;
284  bool m_outputAtEndOfSim;
285 
286  bool m_outputDelayed;
287  bool m_collectionDelayed;
288  bool m_savedStatEnabled;
289  bool m_savedOutputEnabled;
290  OneShot::HandlerBase* m_outputDelayedHandler;
291  OneShot::HandlerBase* m_collectionDelayedHandler;
292  const StatisticGroup* m_group;
293 };
294 
295 /**
296  \class StatisticCollector
297  * Base type that creates the virtual addData(...) interface
298  * Used for distinguishing fundamental types (collected by value)
299  * and composite struct types (collected by reference)
300  */
301 template <class T, bool F = std::is_fundamental<T>::value>
303 {};
304 
305 template <class T>
306 struct StatisticCollector<T, true>
307 {
308  virtual void addData_impl(T data) = 0;
309 
310  /**
311  * @brief addData_impl_Ntimes Add the same data N times in a row
312  * By default, this just calls the addData function N times
313  * @param N The number of consecutive times
314  * @param args The arguments to pass in
315  */
316  virtual void addData_impl_Ntimes(uint64_t N, T data)
317  {
318  for ( uint64_t i = 0; i < N; ++i ) {
319  addData_impl(data);
320  }
321  }
322 };
323 
324 template <class... Args>
325 struct StatisticCollector<std::tuple<Args...>, false>
326 {
327  virtual void addData_impl(Args... args) = 0;
328 
329  /**
330  * @brief addData_impl_Ntimes Add the same data N times in a row
331  * By default, this just calls the addData function N times
332  * @param N The number of consecutive times
333  * @param args The arguments to pass in
334  */
335  virtual void addData_impl_Ntimes(uint64_t N, Args... args)
336  {
337  for ( uint64_t i = 0; i < N; ++i ) {
338  addData_impl(args...);
339  }
340  }
341 
342  template <class... InArgs>
343  void addData(InArgs&&... args)
344  {
345  addData_impl(std::make_tuple(std::forward<InArgs>(args)...));
346  }
347 };
348 
349 ////////////////////////////////////////////////////////////////////////////////
350 
351 /**
352  \class Statistic
353 
354  Forms the template defined base class for statistics gathering within SST.
355 
356  @tparam T A template for the basic numerical data stored by this Statistic
357 */
358 
359 template <typename T>
360 class Statistic : public StatisticBase, public StatisticCollector<T>
361 {
362 public:
363  SST_ELI_DECLARE_BASE(Statistic)
364  SST_ELI_DECLARE_INFO(
365  ELI::ProvidesInterface,
366  ELI::ProvidesParams)
367  SST_ELI_DECLARE_CTOR(BaseComponent*, const std::string&, const std::string&, SST::Params&)
368 
369  using Datum = T;
370  using StatisticCollector<T>::addData_impl;
371  // The main method to add data to the statistic
372  /** Add data to the Statistic
373  * This will call the addData_impl() routine in the derived Statistic.
374  */
375  template <class... InArgs> // use a universal reference here
376  void addData(InArgs&&... args)
377  {
378  // Call the Derived Statistic's implementation
379  // of addData and increment the count
380  if ( isEnabled() ) {
381  addData_impl(std::forward<InArgs>(args)...);
383  }
384  }
385 
386  template <class... InArgs> // use a universal reference here
387  void addDataNTimes(uint64_t N, InArgs&&... args)
388  {
389  // Call the Derived Statistic's implementation
390  // of addData and increment the count
391  if ( isEnabled() ) {
392  addData_impl_Ntimes(N, std::forward<InArgs>(args)...);
394  }
395  }
396 
397  static fieldType_t fieldId() { return StatisticFieldType<T>::id(); }
398 
399 protected:
400  friend class SST::Factory;
401  friend class SST::BaseComponent;
402  /** Construct a Statistic
403  * @param comp - Pointer to the parent constructor.
404  * @param statName - Name of the statistic to be registered. This name must
405  * match the name in the ElementInfoStatistic.
406  * @param statSubId - Additional name of the statistic
407  * @param statParams - The parameters for this statistic
408  */
409 
410  Statistic(BaseComponent* comp, const std::string& statName, const std::string& statSubId, Params& statParams) :
411  StatisticBase(comp, statName, statSubId, statParams)
412  {
413  setStatisticDataType(StatisticFieldInfo::getFieldTypeFromTemplate<T>());
414  }
415 
416  virtual ~Statistic() {}
417 
418 private:
419  Statistic() {} // For serialization only
420 };
421 
422 /**
423  * void Statistic has special meaning in that it does not collect fields
424  * in the usual way through the addData function. It has to use custom functions.
425  */
426 template <>
427 class Statistic<void> : public StatisticBase
428 {
429 public:
430  SST_ELI_DECLARE_BASE(Statistic)
431  SST_ELI_DECLARE_INFO(
434  SST_ELI_DECLARE_CTOR(BaseComponent*, const std::string&, const std::string&, SST::Params&)
435 
436  void registerOutputFields(StatisticFieldsOutput* statOutput) override;
437 
438  void outputStatisticFields(StatisticFieldsOutput* statOutput, bool EndOfSimFlag) override;
439 
440 protected:
441  friend class SST::Factory;
442  friend class SST::BaseComponent;
443  /** Construct a Statistic
444  * @param comp - Pointer to the parent constructor.
445  * @param statName - Name of the statistic to be registered. This name must
446  * match the name in the ElementInfoStatistic.
447  * @param statSubId - Additional name of the statistic
448  * @param statParams - The parameters for this statistic
449  */
450 
451  Statistic(BaseComponent* comp, const std::string& statName, const std::string& statSubId, Params& statParams) :
452  StatisticBase(comp, statName, statSubId, statParams)
453  {}
454 
455  virtual ~Statistic() {}
456 
457 private:
458  Statistic() {} // For serialization only
459 };
460 
461 using CustomStatistic = Statistic<void>;
462 
463 template <class... Args>
464 using MultiStatistic = Statistic<std::tuple<Args...>>;
465 
467 {
468 public:
469  std::string toString() const;
470 
471  Statistics::fieldType_t fieldId() const { return field_; }
472 
473  const char* fieldName() const { return field_name_; }
474 
475  const char* fieldShortName() const { return short_name_; }
476 
477 protected:
478  template <class T>
479  ImplementsStatFields(T* UNUSED(t)) :
480  field_name_(T::ELI_fieldName()),
481  short_name_(T::ELI_fieldShortName()),
482  field_(T::ELI_registerField(T::ELI_fieldName(), T::ELI_fieldShortName()))
483  {}
484 
485 private:
486  const char* field_name_;
487  const char* short_name_;
488  Statistics::fieldType_t field_;
489 };
490 
491 #define SST_ELI_DECLARE_STATISTIC_TEMPLATE(cls, lib, name, version, desc, interface) \
492  SST_ELI_DEFAULT_INFO(lib, name, ELI_FORWARD_AS_ONE(version), desc) \
493  SST_ELI_INTERFACE_INFO(interface)
494 
495 #define SST_ELI_REGISTER_CUSTOM_STATISTIC(cls, lib, name, version, desc) \
496  SST_ELI_REGISTER_DERIVED(SST::Statistics::CustomStatistic,cls,lib,name,ELI_FORWARD_AS_ONE(version),desc) \
497  SST_ELI_INTERFACE_INFO("CustomStatistic")
498 
499 #define SST_ELI_DECLARE_STATISTIC(cls, field, lib, name, version, desc, interface) \
500  static bool ELI_isLoaded() \
501  { \
502  return SST::Statistics::Statistic<field>::template addDerivedInfo<cls>(lib, name) && \
503  SST::Statistics::Statistic<field>::template addDerivedBuilder<cls>(lib, name) && \
504  SST::Statistics::Statistic<field>::template addDerivedInfo<SST::Statistics::NullStatistic<field>>( \
505  lib, name) && \
506  SST::Statistics::Statistic<field>::template addDerivedBuilder<SST::Statistics::NullStatistic<field>>( \
507  lib, name); \
508  } \
509  SST_ELI_DEFAULT_INFO(lib, name, ELI_FORWARD_AS_ONE(version), desc) \
510  SST_ELI_INTERFACE_INFO(interface) \
511  static const char* ELI_fieldName() { return #field; } \
512  static const char* ELI_fieldShortName() { return #field; }
513 
514 #ifdef __INTEL_COMPILER
515 #define SST_ELI_INSTANTIATE_STATISTIC(cls, field) \
516  bool force_instantiate_##cls##_##field = \
517  SST::ELI::InstantiateBuilderInfo<SST::Statistics::Statistic<field>, cls<field>>::isLoaded() && \
518  SST::ELI::InstantiateBuilder<SST::Statistics::Statistic<field>, cls<field>>::isLoaded() && \
519  SST::ELI::InstantiateBuilderInfo< \
520  SST::Statistics::Statistic<field>, SST::Statistics::NullStatistic<field>>::isLoaded() && \
521  SST::ELI::InstantiateBuilder< \
522  SST::Statistics::Statistic<field>, SST::Statistics::NullStatistic<field>>::isLoaded();
523 #else
524 #define SST_ELI_INSTANTIATE_STATISTIC(cls, field) \
525  struct cls##_##field##_##shortName : public cls<field> \
526  { \
527  cls##_##field##_##shortName( \
528  SST::BaseComponent* bc, const std::string& sn, const std::string& si, SST::Params& p) : \
529  cls<field>(bc, sn, si, p) \
530  {} \
531  static bool ELI_isLoaded() \
532  { \
533  return SST::ELI::InstantiateBuilderInfo< \
534  SST::Statistics::Statistic<field>, cls##_##field##_##shortName>::isLoaded() && \
535  SST::ELI::InstantiateBuilder< \
536  SST::Statistics::Statistic<field>, cls##_##field##_##shortName>::isLoaded() && \
537  SST::ELI::InstantiateBuilderInfo< \
538  SST::Statistics::Statistic<field>, SST::Statistics::NullStatistic<field>>::isLoaded() && \
539  SST::ELI::InstantiateBuilder< \
540  SST::Statistics::Statistic<field>, SST::Statistics::NullStatistic<field>>::isLoaded(); \
541  } \
542  };
543 #endif
544 
545 #define PP_NARG(...) PP_NARG_(__VA_ARGS__, PP_NSEQ())
546 #define PP_NARG_(...) PP_ARG_N(__VA_ARGS__)
547 #define PP_ARG_N(_1, _2, _3, _4, _5, N, ...) N
548 #define PP_NSEQ() 5, 4, 3, 2, 1, 0
549 
550 #define PP_GLUE(X, Y) PP_GLUE_I(X, Y)
551 #define PP_GLUE_I(X, Y) X##Y
552 
553 #define STAT_NAME1(base, a) base##a
554 #define STAT_NAME2(base, a, b) base##a##b
555 #define STAT_NAME3(base, a, b, c) base##a##b##c
556 #define STAT_NAME4(base, a, b, c, d) base##a##b##c##d
557 
558 #define STAT_GLUE_NAME(base, ...) PP_GLUE(STAT_NAME, PP_NARG(__VA_ARGS__))(base, __VA_ARGS__)
559 #define STAT_TUPLE(...) std::tuple<__VA_ARGS__>
560 
561 #ifdef __INTEL_COMPILER
562 #define MAKE_MULTI_STATISTIC(cls, name, tuple, ...) \
563  bool force_instantiate_stat_name = \
564  SST::ELI::InstantiateBuilderInfo<SST::Statistics::Statistic<tuple>, cls<__VA_ARGS__>>::isLoaded() && \
565  SST::ELI::InstantiateBuilder<SST::Statistics::Statistic<tuple>, cls<__VA_ARGS__>>::isLoaded() && \
566  SST::ELI::InstantiateBuilderInfo< \
567  SST::Statistics::Statistic<tuple>, SST::Statistics::NullStatistic<tuple>>::isLoaded() && \
568  SST::ELI::InstantiateBuilder< \
569  SST::Statistics::Statistic<tuple>, SST::Statistics::NullStatistic<tuple>>::isLoaded(); \
570  } \
571  } \
572  ;
573 #else
574 #define MAKE_MULTI_STATISTIC(cls, name, tuple, ...) \
575  struct name : public cls<__VA_ARGS__> \
576  { \
577  name(SST::BaseComponent* bc, const std::string& sn, const std::string& si, SST::Params& p) : \
578  cls<__VA_ARGS__>(bc, sn, si, p) \
579  {} \
580  bool ELI_isLoaded() const \
581  { \
582  return SST::ELI::InstantiateBuilderInfo<SST::Statistics::Statistic<tuple>, name>::isLoaded() && \
583  SST::ELI::InstantiateBuilder<SST::Statistics::Statistic<tuple>, name>::isLoaded() && \
584  SST::ELI::InstantiateBuilderInfo< \
585  SST::Statistics::Statistic<tuple>, SST::Statistics::NullStatistic<tuple>>::isLoaded() && \
586  SST::ELI::InstantiateBuilder< \
587  SST::Statistics::Statistic<tuple>, SST::Statistics::NullStatistic<tuple>>::isLoaded(); \
588  } \
589  };
590 #endif
591 
592 #define SST_ELI_INSTANTIATE_MULTI_STATISTIC(cls, ...) \
593  MAKE_MULTI_STATISTIC(cls, STAT_GLUE_NAME(cls, __VA_ARGS__), STAT_TUPLE(__VA_ARGS__), __VA_ARGS__)
594 
595 } // namespace Statistics
596 } // namespace SST
597 
598 // we need to make sure null stats are instantiated for whatever types we use
599 #include "sst/core/statapi/statnull.h"
600 
601 #endif // SST_CORE_STATAPI_STATBASE_H
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:34
void setFlagOutputAtEndOfSim(bool flag)
Set the Output At End Of Sim flag.
Definition: statbase.h:109
virtual void setCollectionCountLimit(uint64_t newLimit)
Set the collection count limit to a defined value.
Definition: statbase.cc:94
bool isOutputEnabled() const
Return the enable status of the Statistic&#39;s ability to output data.
Definition: statbase.h:149
void delayCollection(const char *delayTime)
Delay the statistic from collecting data for a specified delay time.
Definition: statbase.cc:175
void setFlagClearDataOnOutput(bool flag)
Set the Clear Data On Output flag.
Definition: statbase.h:104
Forms the base class for statistics output generation within the SST core.
Definition: statoutput.h:49
void addData(InArgs &&... args)
Add data to the Statistic This will call the addData_impl() routine in the derived Statistic...
Definition: statbase.h:376
const StatisticFieldInfo::fieldType_t & getStatDataType() const
Return the Statistic data type.
Definition: statbase.h:128
Forms the base class for statistics gathering within SST.
Definition: statbase.h:63
virtual void addData_impl_Ntimes(uint64_t N, T data)
addData_impl_Ntimes Add the same data N times in a row By default, this just calls the addData functi...
Definition: statbase.h:316
const std::string & getStatName() const
Return the Statistic Name.
Definition: statbase.h:116
void setStatisticTypeName(const char *typeName)
Set an optional Statistic Type Name.
Definition: statbase.h:213
const char * getStatDataTypeFullName() const
Return the Statistic data type.
Definition: statbase.h:137
Definition: action.cc:18
void enable()
Enable Statistic for collections.
Definition: statbase.h:71
bool getFlagResetCountOnOutput() const
Return the ResetCountOnOutput flag value.
Definition: statbase.h:158
void delayOutput(const char *delayTime)
Delay the statistic from outputting data for a specified delay time.
Definition: statbase.cc:160
Forms the template defined base class for statistics gathering within SST.
Definition: elementinfo.h:44
SSTHandlerBaseNoArgs< void > HandlerBase
Base handler for OneShot callbacks.
Definition: oneshot.h:38
Statistic(BaseComponent *comp, const std::string &statName, const std::string &statSubId, Params &statParams)
Construct a Statistic.
Definition: statbase.h:451
const std::string & getCompName() const
Return the Component Name.
Definition: statbase.cc:50
Definition: serializable.h:118
bool getFlagClearDataOnOutput() const
Return the ClearDataOnOutput flag value.
Definition: statbase.h:161
uint64_t getCollectionCountLimit() const
Return the collection count limit.
Definition: statbase.h:152
BaseComponent * getComponent() const
Return a pointer to the parent Component.
Definition: statbase.h:143
virtual void resetCollectionCount()
Set the current collection count to 0.
Definition: statbase.cc:88
Base type that creates the virtual addData(...) interface Used for distinguishing fundamental types...
Definition: statbase.h:302
bool getFlagOutputAtEndOfSim() const
Return the OutputAtEndOfSim flag value.
Definition: statbase.h:164
Statistic(BaseComponent *comp, const std::string &statName, const std::string &statSubId, Params &statParams)
Construct a Statistic.
Definition: statbase.h:410
Definition: paramsInfo.h:40
const char * getStatDataTypeShortName() const
Return the Statistic data type.
Definition: statbase.h:131
virtual void incrementCollectionCount(uint64_t increment)
Increment current collection count.
Definition: statbase.cc:72
Definition: statoutput.h:142
virtual bool isNullStatistic() const
Indicate if the Statistic is a NullStatistic.
Definition: statbase.h:185
bool isEnabled() const
Return the enable status of the Statistic.
Definition: statbase.h:146
Main component object for the simulation.
Definition: baseComponent.h:51
void disable()
Disable Statistic for collections.
Definition: statbase.h:74
const std::string & getStatTypeName() const
Return the Statistic type name.
Definition: statbase.h:125
Definition: statbase.h:466
StatMode_t
Statistic collection mode.
Definition: statbase.h:67
virtual void clearStatisticData()
Inform the Statistic to clear its data.
Definition: statbase.h:78
virtual void addData_impl_Ntimes(uint64_t N, Args... args)
addData_impl_Ntimes Add the same data N times in a row By default, this just calls the addData functi...
Definition: statbase.h:335
const std::string & getStatSubId() const
Return the Statistic SubId.
Definition: statbase.h:119
void setFlagResetCountOnOutput(bool flag)
Set the Reset Count On Output flag.
Definition: statbase.h:96
Parameter store.
Definition: params.h:55
Definition: statbase.h:35
Class for instantiating Components, Links and the like out of element libraries.
Definition: factory.h:43
virtual void setCollectionCount(uint64_t newCount)
Set the current collection count to a defined value.
Definition: statbase.cc:80
void setStatisticDataType(const StatisticFieldInfo::fieldType_t dataType)
Set the Statistic Data Type.
Definition: statbase.h:210
StatMode_t getRegisteredCollectionMode() const
Return the collection mode that is registered.
Definition: statbase.h:167
An SST core component that handles timing and event processing informing all registered Statistics to...
Definition: statengine.h:51
Definition: statgroup.h:28
Params & getParams()
Return the Statistic Parameters.
Definition: statbase.h:207
Definition: interfaceInfo.h:18
virtual bool isReady() const
Indicate that the Statistic is Ready to be used.
Definition: statbase.h:182
StatisticBase(BaseComponent *comp, const std::string &statName, const std::string &statSubId, Params &statParams)
Construct a StatisticBase.
Definition: statbase.cc:29
const std::string & getFullStatName() const
Return the full Statistic name of Component.StatName.SubId.
Definition: statbase.h:122
uint64_t getCollectionCount() const
Return the current collection count.
Definition: statbase.h:155