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