13 #ifndef _H_SST_CORE_ACCUMULATOR_STATISTIC_
14 #define _H_SST_CORE_ACCUMULATOR_STATISTIC_
16 #include <sst/core/sst_types.h>
18 #include <sst/core/statapi/statbase.h>
21 namespace Statistics {
41 template <
typename NumberBase>
67 m_sum_sq += (value * value);
84 NumberBase getSumSquared()
93 NumberBase getArithmeticMean()
95 uint64_t count = getCount();
96 return (count > 0) ? (m_sum / (NumberBase) count) : 0;
103 NumberBase getVariance()
105 uint64_t count = getCount();
106 return (count > 0) ? (m_sum_sq * count) - (m_sum * m_sum) : 0;
113 NumberBase getStandardDeviation()
115 return (NumberBase) std::sqrt( (
double) getVariance() );
127 void clearStatisticData()
134 void registerOutputFields(StatisticOutput* statOutput)
136 Field1 = statOutput->registerField<NumberBase>(
"Sum");
137 Field2 = statOutput->registerField<NumberBase>(
"SumSQ");
138 Field3 = statOutput->registerField<uint64_t> (
"Count");
141 void outputStatisticData(StatisticOutput* statOutput,
bool EndOfSimFlag)
143 statOutput->outputField(Field1, m_sum);
144 statOutput->outputField(Field2, m_sum_sq);
145 statOutput->outputField(Field3, getCount());
150 if (mode == StatisticBase::STAT_MODE_COUNT) {
153 if (mode == StatisticBase::STAT_MODE_PERIODIC) {
163 StatisticOutput::fieldHandle_t Field1, Field2, Field3;
Main component object for the simulation.
Definition: component.h:56
void setStatisticTypeName(const char *typeName)
Set an optional Statistic Type Name.
Definition: statbase.h:177
Allows the online gathering of statistical information about a single quantity.
Definition: stataccumulator.h:42
uint64_t getCollectionCount() const
Return the current collection count.
Definition: statbase.h:120
Forms the template defined base class for statistics gathering within SST.
Definition: statbase.h:263
StatMode_t
Statistic collection mode.
Definition: statbase.h:40
Parameter store.
Definition: params.h:44
virtual void setCollectionCount(uint64_t newCount)
Set the current collection count to a defined value.
Definition: statbase.cc:41
void addData_impl(NumberBase value)
Present a new value to the class to be included in the statistics.
Definition: stataccumulator.h:64