8#include <framework/core/ProcessStatistics.h>
9#include <framework/core/Module.h>
11#include <gtest/gtest.h>
17 class DummyModule :
public Module {
26 TEST(ProcessStatisticsTest, Clear)
29 EXPECT_EQ(0, a.getGlobal().getCalls());
30 EXPECT_EQ(0, a.getStatistics(
nullptr).getCalls());
31 EXPECT_EQ(0, a.getGlobal().getTimeMean());
38 EXPECT_EQ(1, a.getGlobal().getCalls());
39 EXPECT_EQ(1, a.getStatistics(
nullptr).getCalls());
40 EXPECT_TRUE(a.getGlobal().getTimeMean() > 0);
44 EXPECT_EQ(0, a.getGlobal().getCalls());
45 EXPECT_EQ(0, a.getStatistics(
nullptr).getCalls());
46 EXPECT_EQ(0, a.getGlobal().getTimeMean());
49 TEST(ProcessStatisticsTest, Merge)
64 EXPECT_EQ(1, a.getGlobal().getCalls());
65 EXPECT_EQ(1, a.getStatistics(
nullptr).getCalls());
66 float sum = a.getGlobal().getTimeSum();
72 EXPECT_EQ(1, a.getGlobal().getCalls());
73 EXPECT_EQ(2, a.getStatistics(
nullptr).getCalls());
74 EXPECT_FLOAT_EQ(sum, a.getGlobal().getTimeSum());
88 EXPECT_EQ(2, a.getGlobal().getCalls());
89 EXPECT_EQ(2, a.getStatistics(
nullptr).getCalls());
90 EXPECT_EQ(1, a.getStatistics(&dummyMod).getCalls());
91 EXPECT_FLOAT_EQ(sum, a.getGlobal().getTimeSum());
@ c_Init
Counting time/calls in initialize()
@ c_Event
Counting time/calls in event()
value_type getTimeSum(EStatisticCounters type=c_Total) const
return the sum of all execution times for a given counter
Class to collect call statistics for all modules.
void stopGlobal(ModuleStatistics::EStatisticCounters type)
Stop global timer and add values to the statistic counter.
const ModuleStatistics & getGlobal() const
Get global statistics.
void startModule()
Start module timer.
void stopModule(const Module *module, ModuleStatistics::EStatisticCounters type)
Stop module counter and attribute values to appropriate module.
void startGlobal()
Start timer for global measurement.
Abstract base class for different kinds of events.