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());
35 a.stopModule(
nullptr, ModuleStatistics::c_Event);
36 a.stopGlobal(ModuleStatistics::c_Init);
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)
55 a.stopGlobal(ModuleStatistics::c_Init);
57 a.stopModule(
nullptr, ModuleStatistics::c_Event);
60 b.stopGlobal(ModuleStatistics::c_Init);
62 b.stopModule(
nullptr, ModuleStatistics::c_Event);
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());
81 c.stopGlobal(ModuleStatistics::c_Init);
83 c.stopModule(&dummyMod, ModuleStatistics::c_Event);
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());
Class to collect call statistics for all modules.
TEST(TestgetDetectorRegion, TestgetDetectorRegion)
Test Constructors.
Abstract base class for different kinds of events.