@@ -596,3 +596,44 @@ TEST(MemoryPoolLogging, givenGraphicsMemoryPoolWhenConvertingToStringThenCorrect
596596 EXPECT_STREQ (result, str);
597597 }
598598}
599+
600+ TEST (CpuGpuVaLogging, givenAllocationWithCpuVaWhenLoggingAllocationThenCpuVaRangeIsLoggedToFile) {
601+ std::string testFile = " testfile" ;
602+ DebugVariables flags;
603+ flags.LogAllocationType .set (1 );
604+
605+ FullyEnabledFileLogger fileLogger (testFile, flags);
606+
607+ char buffer[4096 ];
608+ GraphicsAllocation graphicsAllocation (0 , 1u /* num gmms*/ , AllocationType::buffer, buffer, reinterpret_cast <uint64_t >(buffer), 0 , MemoryPool::system4KBPages, MemoryManager::maxOsContextCount, sizeof (buffer));
609+
610+ logAllocation (fileLogger, &graphicsAllocation, nullptr );
611+
612+ if (fileLogger.wasFileCreated (fileLogger.getLogFileName ())) {
613+ auto str = fileLogger.getFileString (fileLogger.getLogFileName ());
614+ EXPECT_TRUE (str.find (" CPU VA: 0x" ) != std::string::npos);
615+ EXPECT_FALSE (str.find (" CPU VA: NULL" ) != std::string::npos);
616+ EXPECT_TRUE (str.find (" - 0x" ) != std::string::npos);
617+ } else {
618+ EXPECT_FALSE (true );
619+ }
620+ }
621+
622+ TEST (CpuGpuVaLogging, givenAllocationWithoutCpuVaWhenLoggingAllocationThenNullIsLoggedToFile) {
623+ std::string testFile = " testfile" ;
624+ DebugVariables flags;
625+ flags.LogAllocationType .set (1 );
626+
627+ FullyEnabledFileLogger fileLogger (testFile, flags);
628+
629+ GraphicsAllocation graphicsAllocation (0 , 1u /* num gmms*/ , AllocationType::buffer, nullptr , 0x1000 , 0 , MemoryPool::localMemory, MemoryManager::maxOsContextCount, 4096 );
630+
631+ logAllocation (fileLogger, &graphicsAllocation, nullptr );
632+
633+ if (fileLogger.wasFileCreated (fileLogger.getLogFileName ())) {
634+ auto str = fileLogger.getFileString (fileLogger.getLogFileName ());
635+ EXPECT_TRUE (str.find (" CPU VA: NULL" ) != std::string::npos);
636+ } else {
637+ EXPECT_FALSE (true );
638+ }
639+ }
0 commit comments