SST  10.1.0
StructuralSimulationToolkit
statbase.h
1 // Copyright 2009-2020 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-2020, 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 _H_SST_CORE_STATISTICS_BASE
13 #define _H_SST_CORE_STATISTICS_BASE
14 
15 #include <string>
16 
17 #include "sst/core/sst_types.h"
18 #include "sst/core/warnmacros.h"
19 #include "sst/core/params.h"
20 #include "sst/core/oneshot.h"
21 #include "sst/core/statapi/statfieldinfo.h"
22 #include "sst/core/eli/elementinfo.h"
23 #include "sst/core/serialization/serializable.h"
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 
35 
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  ser & name;
47  ser & params;
48  }
49 
50  ImplementSerializable(SST::Statistics::StatisticInfo)
51 };
52 
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 {
69  STAT_MODE_UNDEFINED,
70  STAT_MODE_COUNT,
71  STAT_MODE_PERIODIC,
72  STAT_MODE_DUMP_AT_END
73  } StatMode_t;
74 
75  // Enable/Disable of Statistic
76  /** Enable Statistic for collections */
77  void enable() {m_statEnabled = true;}
78 
79  /** Disable Statistic for collections */
80  void disable() {m_statEnabled = false;}
81 
82  // Handling of Collection Counts and Data
83  /** Inform the Statistic to clear its data */
84  virtual void clearStatisticData() {}
85 
86  /** Set the current collection count to 0 */
87  virtual void resetCollectionCount();
88 
89  /** Increment current collection count */
90  virtual void incrementCollectionCount(uint64_t increment);
91 
92  /** Set the current collection count to a defined value */
93  virtual void setCollectionCount(uint64_t newCount);
94 
95  /** Set the collection count limit to a defined value */
96  virtual void setCollectionCountLimit(uint64_t newLimit);
97 
98  // Control Statistic Operation Flags
99  /** Set the Reset Count On Output flag.
100  * If Set, the collection count will be reset when statistic is output.
101  */
102  void setFlagResetCountOnOutput(bool flag) {m_resetCountOnOutput = flag;}
103 
104  static const std::vector<ElementInfoParam>& ELI_getParams();
105 
106  /** Set the Clear Data On Output flag.
107  * If Set, the data in the statistic will be cleared by calling
108  * clearStatisticData().
109  */
110  void setFlagClearDataOnOutput(bool flag) {m_clearDataOnOutput = flag;}
111 
112  /** Set the Output At End Of Sim flag.
113  * If Set, the statistic will perform an output at the end of simulation.
114  */
115  void setFlagOutputAtEndOfSim(bool flag) {m_outputAtEndOfSim = flag;}
116 
117  // Get Data & Information on Statistic
118  /** Return the Component Name */
119  const std::string& getCompName() const;
120 
121  /** Return the Statistic Name */
122  inline const std::string& getStatName() const {return m_statName;}
123 
124  /** Return the Statistic SubId */
125  inline const std::string& getStatSubId() const {return m_statSubId;}
126 
127  /** Return the full Statistic name of Component.StatName.SubId */
128  inline const std::string& getFullStatName() const {return m_statFullName;} // Return compName.statName.subId
129 
130  /** Return the Statistic type name */
131  inline const std::string& getStatTypeName() const {return m_statTypeName;}
132 
133  /** Return the Statistic data type */
134  inline const StatisticFieldInfo::fieldType_t& getStatDataType() const {return m_statDataType;}
135 
136  /** Return the Statistic data type */
137  inline const char* getStatDataTypeShortName() const {return StatisticFieldInfo::getFieldTypeShortName(m_statDataType);}
138 
139  /** Return the Statistic data type */
140  inline const char* getStatDataTypeFullName() const {return StatisticFieldInfo::getFieldTypeFullName(m_statDataType);}
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,
202  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 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_collectionCountLimit;
277  StatisticFieldInfo::fieldType_t m_statDataType;
278 
279  bool m_statEnabled;
280  bool m_outputEnabled;
281  bool m_resetCountOnOutput;
282  bool m_clearDataOnOutput;
283  bool m_outputAtEndOfSim;
284 
285  bool m_outputDelayed;
286  bool m_collectionDelayed;
287  bool m_savedStatEnabled;
288  bool m_savedOutputEnabled;
289  OneShot::HandlerBase* m_outputDelayedHandler;
290  OneShot::HandlerBase* m_collectionDelayedHandler;
291  const StatisticGroup* m_group;
292 
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 template <class T>
305 struct StatisticCollector<T,true> {
306  virtual void addData_impl(T data) = 0;
307 
308  /**
309  * @brief addData_impl_Ntimes Add the same data N times in a row
310  * By default, this just calls the addData function N times
311  * @param N The number of consecutive times
312  * @param args The arguments to pass in
313  */
314  virtual void addData_impl_Ntimes(uint64_t N, T data){
315  for (uint64_t i=0; i < N; ++i){
316  addData_impl(data);
317  }
318  }
319 };
320 
321 template <class... Args>
322 struct StatisticCollector<std::tuple<Args...>,false> {
323  virtual void addData_impl(Args... args) = 0;
324 
325  /**
326  * @brief addData_impl_Ntimes Add the same data N times in a row
327  * By default, this just calls the addData function N times
328  * @param N The number of consecutive times
329  * @param args The arguments to pass in
330  */
331  virtual void addData_impl_Ntimes(uint64_t N, Args... args){
332  for (uint64_t i=0; i < N; ++i){
333  addData_impl(args...);
334  }
335  }
336 
337  template <class... InArgs>
338  void addData(InArgs&&... args){
339  addData_impl(std::make_tuple(std::forward<InArgs>(args)...));
340  }
341 
342 };
343 
344 ////////////////////////////////////////////////////////////////////////////////
345 
346 /**
347  \class Statistic
348 
349  Forms the template defined base class for statistics gathering within SST.
350 
351  @tparam T A template for the basic numerical data stored by this Statistic
352 */
353 
354 template <typename T>
355 class Statistic : public StatisticBase, public StatisticCollector<T>
356 {
357  public:
358  SST_ELI_DECLARE_BASE(Statistic)
359  SST_ELI_DECLARE_INFO(
360  ELI::ProvidesInterface,
361  ELI::ProvidesParams)
362  SST_ELI_DECLARE_CTOR(BaseComponent*,const std::string&, const std::string&, SST::Params&)
363 
364  using Datum = T;
365  using StatisticCollector<T>::addData_impl;
366  // The main method to add data to the statistic
367  /** Add data to the Statistic
368  * This will call the addData_impl() routine in the derived Statistic.
369  */
370  template <class... InArgs> //use a universal reference here
371  void addData(InArgs&&... args)
372  {
373  // Call the Derived Statistic's implementation
374  // of addData and increment the count
375  if (isEnabled()) {
376  addData_impl(std::forward<InArgs>(args)...);
378  }
379  }
380 
381  template <class... InArgs> //use a universal reference here
382  void addDataNTimes(uint64_t N, InArgs&&... args)
383  {
384  // Call the Derived Statistic's implementation
385  // of addData and increment the count
386  if (isEnabled()) {
387  addData_impl_Ntimes(N, std::forward<InArgs>(args)...);
389  }
390  }
391 
392 
393  static fieldType_t fieldId() {
394  return StatisticFieldType<T>::id();
395  }
396 
397 protected:
398  friend class SST::Factory;
399  friend class SST::BaseComponent;
400  /** Construct a Statistic
401  * @param comp - Pointer to the parent constructor.
402  * @param statName - Name of the statistic to be registered. This name must
403  * match the name in the ElementInfoStatistic.
404  * @param statSubId - Additional name of the statistic
405  * @param statParams - The parameters for this statistic
406  */
407 
408  Statistic(BaseComponent* comp, const std::string& statName,
409  const std::string& statSubId, Params& statParams) :
410  StatisticBase(comp, statName, statSubId, statParams)
411  {
412  setStatisticDataType(StatisticFieldInfo::getFieldTypeFromTemplate<T>());
413  }
414 
415  virtual ~Statistic(){}
416 
417 private:
418  Statistic(){} // For serialization only
419 
420 
421 };
422 
423 /**
424  * void Statistic has special meaning in that it does not collect fields
425  * in the usual way through the addData function. It has to use custom functions.
426  */
427 template <>
428 class Statistic<void> : public StatisticBase
429 {
430  public:
431  SST_ELI_DECLARE_BASE(Statistic)
432  SST_ELI_DECLARE_INFO(
435  SST_ELI_DECLARE_CTOR(BaseComponent*,const std::string&, const std::string&, SST::Params&)
436 
437  void registerOutputFields(StatisticFieldsOutput *statOutput) override;
438 
439  void outputStatisticFields(StatisticFieldsOutput *statOutput, bool EndOfSimFlag) override;
440 
441  protected:
442  friend class SST::Factory;
443  friend class SST::BaseComponent;
444  /** Construct a Statistic
445  * @param comp - Pointer to the parent constructor.
446  * @param statName - Name of the statistic to be registered. This name must
447  * match the name in the ElementInfoStatistic.
448  * @param statSubId - Additional name of the statistic
449  * @param statParams - The parameters for this statistic
450  */
451 
452  Statistic(BaseComponent* comp, const std::string& statName,
453  const std::string& statSubId, Params& statParams) :
454  StatisticBase(comp, statName, statSubId, statParams)
455  {
456  }
457 
458  virtual ~Statistic(){}
459 
460 private:
461  Statistic(){} // For serialization only
462 
463 };
464 
465 using CustomStatistic = Statistic<void>;
466 
467 template <class... Args>
468 using MultiStatistic = Statistic<std::tuple<Args...>>;
469 
470 
472  public:
473  std::string toString() const;
474 
475  Statistics::fieldType_t fieldId() const {
476  return field_;
477  }
478 
479  const char* fieldName() const {
480  return field_name_;
481  }
482 
483  const char* fieldShortName() const {
484  return short_name_;
485  }
486 
487  protected:
488  template <class T> ImplementsStatFields(T* UNUSED(t)) :
489  field_name_(T::ELI_fieldName()),
490  short_name_(T::ELI_fieldShortName()),
491  field_(T::ELI_registerField(T::ELI_fieldName(), T::ELI_fieldShortName()))
492  {
493  }
494 
495  private:
496  const char* field_name_;
497  const char* short_name_;
498  Statistics::fieldType_t field_;
499 
500 };
501 
502 #define SST_ELI_DECLARE_STATISTIC_TEMPLATE(cls,lib,name,version,desc,interface) \
503  SST_ELI_DEFAULT_INFO(lib,name,ELI_FORWARD_AS_ONE(version),desc) \
504  SST_ELI_INTERFACE_INFO(interface)
505 
506 #define SST_ELI_REGISTER_CUSTOM_STATISTIC(cls,lib,name,version,desc) \
507  SST_ELI_REGISTER_DERIVED(SST::Statistics::CustomStatistic,cls,lib,name,ELI_FORWARD_AS_ONE(version),desc) \
508  SST_ELI_INTERFACE_INFO("CustomStatistic")
509 
510 #define SST_ELI_DECLARE_STATISTIC(cls,field,lib,name,version,desc,interface) \
511  static bool ELI_isLoaded() { \
512  return SST::Statistics::Statistic<field>::template addDerivedInfo<cls>(lib,name) \
513  && SST::Statistics::Statistic<field>::template addDerivedBuilder<cls>(lib,name) \
514  && SST::Statistics::Statistic<field>::template addDerivedInfo<SST::Statistics::NullStatistic<field>>(lib,name) \
515  && SST::Statistics::Statistic<field>::template addDerivedBuilder<SST::Statistics::NullStatistic<field>>(lib,name); \
516  } \
517  SST_ELI_DEFAULT_INFO(lib,name,ELI_FORWARD_AS_ONE(version),desc) \
518  SST_ELI_INTERFACE_INFO(interface) \
519  static const char* ELI_fieldName(){ return #field; } \
520  static const char* ELI_fieldShortName(){ return #field; }
521 
522 
523 #ifdef __INTEL_COMPILER
524 #define SST_ELI_INSTANTIATE_STATISTIC(cls,field) \
525  bool force_instantiate_##cls##_##field = \
526  SST::ELI::InstantiateBuilderInfo< \
527  SST::Statistics::Statistic<field>,cls<field>>::isLoaded() \
528  && SST::ELI::InstantiateBuilder< \
529  SST::Statistics::Statistic<field>,cls<field>>::isLoaded() \
530  && SST::ELI::InstantiateBuilderInfo< \
531  SST::Statistics::Statistic<field>, \
532  SST::Statistics::NullStatistic<field>>::isLoaded() \
533  && SST::ELI::InstantiateBuilder< \
534  SST::Statistics::Statistic<field>, \
535  SST::Statistics::NullStatistic<field>>::isLoaded();
536 #else
537 #define SST_ELI_INSTANTIATE_STATISTIC(cls,field) \
538  struct cls##_##field##_##shortName : public cls<field> { \
539  cls##_##field##_##shortName(SST::BaseComponent* bc, const std::string& sn, \
540  const std::string& si, SST::Params& p) : \
541  cls<field>(bc,sn,si,p) {} \
542  static bool ELI_isLoaded() { \
543  return SST::ELI::InstantiateBuilderInfo< \
544  SST::Statistics::Statistic<field>,cls##_##field##_##shortName>::isLoaded() \
545  && SST::ELI::InstantiateBuilder< \
546  SST::Statistics::Statistic<field>,cls##_##field##_##shortName>::isLoaded() \
547  && SST::ELI::InstantiateBuilderInfo< \
548  SST::Statistics::Statistic<field>, \
549  SST::Statistics::NullStatistic<field>>::isLoaded() \
550  && SST::ELI::InstantiateBuilder< \
551  SST::Statistics::Statistic<field>, \
552  SST::Statistics::NullStatistic<field>>::isLoaded(); \
553  } \
554  };
555 #endif
556 
557 
558 #define PP_NARG(...) PP_NARG_(__VA_ARGS__, PP_NSEQ())
559 #define PP_NARG_(...) PP_ARG_N(__VA_ARGS__)
560 #define PP_ARG_N(_1,_2,_3,_4,_5,N,...) N
561 #define PP_NSEQ() 5,4,3,2,1,0
562 
563 #define PP_GLUE(X,Y) PP_GLUE_I(X,Y)
564 #define PP_GLUE_I(X,Y) X##Y
565 
566 #define STAT_NAME1(base,a) base##a
567 #define STAT_NAME2(base,a,b) base##a##b
568 #define STAT_NAME3(base,a,b,c) base##a##b##c
569 #define STAT_NAME4(base,a,b,c,d) base##a##b##c##d
570 
571 #define STAT_GLUE_NAME(base,...) PP_GLUE(STAT_NAME,PP_NARG(__VA_ARGS__))(base,__VA_ARGS__)
572 #define STAT_TUPLE(...) std::tuple<__VA_ARGS__>
573 
574 #ifdef __INTEL_COMPILER
575 #define MAKE_MULTI_STATISTIC(cls,name,tuple,...) \
576  bool force_instantiate_stat_name = \
577  SST::ELI::InstantiateBuilderInfo< \
578  SST::Statistics::Statistic<tuple>,cls<__VA_ARGS__>>::isLoaded() \
579  && SST::ELI::InstantiateBuilder< \
580  SST::Statistics::Statistic<tuple>,cls<__VA_ARGS__>>::isLoaded() \
581  && SST::ELI::InstantiateBuilderInfo< \
582  SST::Statistics::Statistic<tuple>, \
583  SST::Statistics::NullStatistic<tuple>>::isLoaded() \
584  && SST::ELI::InstantiateBuilder< \
585  SST::Statistics::Statistic<tuple>, \
586  SST::Statistics::NullStatistic<tuple>>::isLoaded(); \
587  } \
588  };
589 #else
590 #define MAKE_MULTI_STATISTIC(cls,name,tuple,...) \
591  struct name : public cls<__VA_ARGS__> { \
592  name(SST::BaseComponent* bc, const std::string& sn, \
593  const std::string& si, SST::Params& p) : \
594  cls<__VA_ARGS__>(bc,sn,si,p) {} \
595  bool ELI_isLoaded() const { \
596  return SST::ELI::InstantiateBuilderInfo< \
597  SST::Statistics::Statistic<tuple>,name>::isLoaded() \
598  && SST::ELI::InstantiateBuilder< \
599  SST::Statistics::Statistic<tuple>,name>::isLoaded() \
600  && SST::ELI::InstantiateBuilderInfo< \
601  SST::Statistics::Statistic<tuple>, \
602  SST::Statistics::NullStatistic<tuple>>::isLoaded() \
603  && SST::ELI::InstantiateBuilder< \
604  SST::Statistics::Statistic<tuple>, \
605  SST::Statistics::NullStatistic<tuple>>::isLoaded(); \
606  } \
607  };
608 #endif
609 
610 #define SST_ELI_INSTANTIATE_MULTI_STATISTIC(cls,...) \
611  MAKE_MULTI_STATISTIC(cls,STAT_GLUE_NAME(cls,__VA_ARGS__),STAT_TUPLE(__VA_ARGS__),__VA_ARGS__)
612 
613 
614 
615 } //namespace Statistics
616 } //namespace SST
617 
618 //we need to make sure null stats are instantiated for whatever types we use
619 #include "sst/core/statapi/statnull.h"
620 
621 #endif
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:115
virtual void setCollectionCountLimit(uint64_t newLimit)
Set the collection count limit to a defined value.
Definition: statbase.cc:89
void delayCollection(const char *delayTime)
Delay the statistic from collecting data for a specified delay time.
Definition: statbase.cc:161
void setFlagClearDataOnOutput(bool flag)
Set the Clear Data On Output flag.
Definition: statbase.h:110
Forms the base class for statistics output generation within the SST core.
Definition: statoutput.h:49
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:314
void setStatisticTypeName(const char *typeName)
Set an optional Statistic Type Name.
Definition: statbase.h:214
uint64_t getCollectionCount() const
Return the current collection count.
Definition: statbase.h:155
void enable()
Enable Statistic for collections.
Definition: statbase.h:77
void delayOutput(const char *delayTime)
Delay the statistic from outputting data for a specified delay time.
Definition: statbase.cc:147
StatMode_t getRegisteredCollectionMode() const
Return the collection mode that is registered.
Definition: statbase.h:167
Forms the template defined base class for statistics gathering within SST.
Definition: elementinfo.h:42
Statistic(BaseComponent *comp, const std::string &statName, const std::string &statSubId, Params &statParams)
Construct a Statistic.
Definition: statbase.h:452
Definition: serializable.h:109
virtual bool isNullStatistic() const
Indicate if the Statistic is a NullStatistic.
Definition: statbase.h:185
const std::string & getCompName() const
Return the Component Name.
Definition: statbase.cc:51
virtual void resetCollectionCount()
Set the current collection count to 0.
Definition: statbase.cc:84
const StatisticFieldInfo::fieldType_t & getStatDataType() const
Return the Statistic data type.
Definition: statbase.h:134
Base type that creates the virtual addData(...) interface Used for distinguishing fundamental types (...
Definition: statbase.h:302
Statistic(BaseComponent *comp, const std::string &statName, const std::string &statSubId, Params &statParams)
Construct a Statistic.
Definition: statbase.h:408
void addData(InArgs &&...args)
Add data to the Statistic This will call the addData_impl() routine in the derived Statistic...
Definition: statbase.h:371
Definition: paramsInfo.h:39
bool getFlagOutputAtEndOfSim() const
Return the OutputAtEndOfSim flag value.
Definition: statbase.h:164
bool getFlagClearDataOnOutput() const
Return the ClearDataOnOutput flag value.
Definition: statbase.h:161
virtual void incrementCollectionCount(uint64_t increment)
Increment current collection count.
Definition: statbase.cc:72
bool isEnabled() const
Return the enable status of the Statistic.
Definition: statbase.h:146
Definition: statoutput.h:144
virtual bool isReady() const
Indicate that the Statistic is Ready to be used.
Definition: statbase.h:182
Main component object for the simulation.
Definition: baseComponent.h:52
void disable()
Disable Statistic for collections.
Definition: statbase.h:80
bool isOutputEnabled() const
Return the enable status of the Statistic&#39;s ability to output data.
Definition: statbase.h:149
Definition: statbase.h:471
StatMode_t
Statistic collection mode.
Definition: statbase.h:68
virtual void clearStatisticData()
Inform the Statistic to clear its data.
Definition: statbase.h:84
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:331
void setFlagResetCountOnOutput(bool flag)
Set the Reset Count On Output flag.
Definition: statbase.h:102
Parameter store.
Definition: params.h:44
bool getFlagResetCountOnOutput() const
Return the ResetCountOnOutput flag value.
Definition: statbase.h:158
const std::string & getStatSubId() const
Return the Statistic SubId.
Definition: statbase.h:125
Definition: statbase.h:36
const char * getStatDataTypeFullName() const
Return the Statistic data type.
Definition: statbase.h:140
Class for instantiating Components, Links and the like out of element libraries.
Definition: factory.h:43
const std::string & getFullStatName() const
Return the full Statistic name of Component.StatName.SubId.
Definition: statbase.h:128
virtual void setCollectionCount(uint64_t newCount)
Set the current collection count to a defined value.
Definition: statbase.cc:78
const char * getStatDataTypeShortName() const
Return the Statistic data type.
Definition: statbase.h:137
void setStatisticDataType(const StatisticFieldInfo::fieldType_t dataType)
Set the Statistic Data Type.
Definition: statbase.h:211
An SST core component that handles timing and event processing informing all registered Statistics to...
Definition: statengine.h:52
Definition: statgroup.h:29
Params & getParams()
Return the Statistic Parameters.
Definition: statbase.h:208
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
const std::string & getStatTypeName() const
Return the Statistic type name.
Definition: statbase.h:131
const std::string & getStatName() const
Return the Statistic Name.
Definition: statbase.h:122
Definition: interfaceInfo.h:18
StatisticBase(BaseComponent *comp, const std::string &statName, const std::string &statSubId, Params &statParams)
Construct a StatisticBase.
Definition: statbase.cc:29