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());
85 sum += c.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()
void setName(const std::string &name)
Set the name of the module.
void setType(const std::string &type)
Set the module type.
Class to collect call statistics for all modules.
Abstract base class for different kinds of events.