refactor: Add GDI profiling

Resolves: NEO-9236
Related-To: NEO-10036

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2024-02-07 16:19:02 +00:00
committed by Compute-Runtime-Automation
parent ce17580b28
commit 486cc71b76
15 changed files with 193 additions and 175 deletions

View File

@@ -47,8 +47,34 @@ TEST(GdiInterface, givenGdiOverridePathWhenGdiInterfaceIsCalledThenOverridePathI
Os::gdiDllName = oldName;
}
TEST(GdiInterface, givenPrintKmdTimesWhenCallThkWrapperThenRecordTime) {
if (!GdiLogging::gdiLoggingSupport) {
GTEST_SKIP();
}
DebugManagerStateRestore dbgRestorer;
debugManager.flags.PrintKmdTimes.set(1);
auto gdi = std::make_unique<Gdi>();
EXPECT_TRUE(gdi->isInitialized());
testing::internal::CaptureStdout();
D3DKMT_OPENADAPTERFROMLUID param = {};
gdi->openAdapterFromLuid(&param);
gdi->openAdapterFromLuid(&param);
D3DKMT_CLOSEADAPTER closeAdapter = {};
closeAdapter.hAdapter = param.hAdapter;
gdi->closeAdapter(&closeAdapter);
gdi.reset();
auto output = testing::internal::GetCapturedStdout();
EXPECT_TRUE(output.find("\n--- Gdi statistics ---\n") != std::string::npos);
}
TEST(ThkWrapperTest, givenThkWrapperWhenConstructedThenmFuncIsInitialized) {
NEO::ThkWrapper<void *> wrapper;
GdiProfiler profiler{};
NEO::ThkWrapper<void *> wrapper(profiler, "nullptr", 0u);
EXPECT_EQ(nullptr, wrapper.mFunc);
}