17 TEST_CASE(
"ProfilingEventTest")
22 const char* eventName =
"EventName";
25 insts1.emplace_back(std::make_unique<WallClockTimer>());
26 Event testEvent(eventName,
33 CHECK_EQ(testEvent.GetName(),
"EventName");
39 std::this_thread::sleep_for(std::chrono::microseconds(10));
44 CHECK_GE(testEvent.GetMeasurements().front().m_Value, 10.0);
47 BackendId cpuAccBackendId(Compute::CpuAcc);
49 insts2.emplace_back(std::make_unique<WallClockTimer>());
50 Event testEvent2(eventName,
57 CHECK_EQ(&testEvent, testEvent2.GetParentEvent());
58 CHECK_EQ(profileManager.
GetProfiler(), testEvent2.GetProfiler());
59 CHECK(cpuAccBackendId == testEvent2.GetBackendId());
62 TEST_CASE(
"ProfilingEventTestOnGpuAcc")
67 const char* eventName =
"GPUEvent";
70 insts1.emplace_back(std::make_unique<WallClockTimer>());
71 Event testEvent(eventName,
78 CHECK_EQ(testEvent.GetName(),
"GPUEvent");
84 std::this_thread::sleep_for(std::chrono::microseconds(10));
89 CHECK_GE(testEvent.GetMeasurements().front().m_Value, 10.0);
92 BackendId gpuAccBackendId(Compute::GpuAcc);
94 insts2.emplace_back(std::make_unique<WallClockTimer>());
95 Event testEvent2(eventName,
102 CHECK_EQ(&testEvent, testEvent2.GetParentEvent());
103 CHECK_EQ(profileManager.
GetProfiler(), testEvent2.GetProfiler());
104 CHECK(gpuAccBackendId == testEvent2.GetBackendId());
Event class records measurements reported by BeginEvent()/EndEvent() and returns measurements when Ev...
static ProfilerManager & GetInstance()
std::vector< InstrumentPtr > Instruments
IProfiler * GetProfiler()
EmptyOptional is used to initialize the Optional class in case we want to have default value for an O...