From b59e3aec14034516e113c986290cced2c3391698 Mon Sep 17 00:00:00 2001 From: "Milczarek, Slawomir" Date: Thu, 23 Aug 2018 17:15:33 +0200 Subject: [PATCH] AUB capture - add control to configure file name This commit adds the AUBDumpCaptureFileName control to configure from outside a file name with an optional path where to save the AUB capture into. Change-Id: Ibf2f7663e23ad9e1001896b0c5b7030f9979dae2 --- .../command_stream/aub_command_stream_receiver.cpp | 4 ++++ runtime/os_interface/DebugVariables_base.inl | 1 + .../aub_command_stream_receiver_tests.cpp | 11 +++++++++++ unit_tests/test_files/igdrcl.config | 1 + 4 files changed, 17 insertions(+) diff --git a/runtime/command_stream/aub_command_stream_receiver.cpp b/runtime/command_stream/aub_command_stream_receiver.cpp index 9ae31823da..26fbc5c823 100644 --- a/runtime/command_stream/aub_command_stream_receiver.cpp +++ b/runtime/command_stream/aub_command_stream_receiver.cpp @@ -51,6 +51,10 @@ CommandStreamReceiver *AUBCommandStreamReceiver::create(const HardwareInfo &hwIn filePath.append(Os::fileSeparator); filePath.append(fileName); + if (DebugManager.flags.AUBDumpCaptureFileName.get() != "unk") { + filePath.assign(DebugManager.flags.AUBDumpCaptureFileName.get()); + } + if (hwInfo.pPlatform->eRenderCoreFamily >= IGFX_MAX_CORE) { DEBUG_BREAK_IF(!false); return nullptr; diff --git a/runtime/os_interface/DebugVariables_base.inl b/runtime/os_interface/DebugVariables_base.inl index bc25d1d0db..09fe6a1a49 100644 --- a/runtime/os_interface/DebugVariables_base.inl +++ b/runtime/os_interface/DebugVariables_base.inl @@ -23,6 +23,7 @@ DECLARE_DEBUG_VARIABLE(std::string, TbxServer, std::string("127.0.0.1"), "TCP-IP address of TBX server") DECLARE_DEBUG_VARIABLE(std::string, ProductFamilyOverride, std::string("unk"), "Specify product for use in AUB/TBX") DECLARE_DEBUG_VARIABLE(std::string, ForceCompilerUsePlatform, std::string("unk"), "Specify product for use in compiler interface") +DECLARE_DEBUG_VARIABLE(std::string, AUBDumpCaptureFileName, std::string("unk"), "Name of file to save AUB capture into") DECLARE_DEBUG_VARIABLE(std::string, AUBDumpFilterKernelName, std::string("unk"), "Name of kernel to AUB capture") DECLARE_DEBUG_VARIABLE(std::string, AUBDumpToggleFileName, std::string("unk"), "Name of file to save AUB in toggle mode") DECLARE_DEBUG_VARIABLE(int32_t, AUBDumpSubCaptureMode, 0, "AUB dump subcapture mode (off, toggle, filter)") diff --git a/unit_tests/command_stream/aub_command_stream_receiver_tests.cpp b/unit_tests/command_stream/aub_command_stream_receiver_tests.cpp index f75ce3af1b..d674cda409 100644 --- a/unit_tests/command_stream/aub_command_stream_receiver_tests.cpp +++ b/unit_tests/command_stream/aub_command_stream_receiver_tests.cpp @@ -781,6 +781,17 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenAllocat EXPECT_FALSE(aubCsr->writeMemory(allocationView)); } +HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenAUBDumpCaptureFileNameHasBeenSpecifiedThenItShouldBeUsedToOpenTheFileWithAubCapture) { + DebugManagerStateRestore stateRestore; + DebugManager.flags.AUBDumpCaptureFileName.set("file_name.aub"); + + std::unique_ptr> aubCsr(static_cast *>(AUBCommandStreamReceiver::create(*platformDevices[0], "", true, *pDevice->executionEnvironment))); + EXPECT_NE(nullptr, aubCsr); + + EXPECT_TRUE(aubCsr->isFileOpen()); + EXPECT_STREQ(DebugManager.flags.AUBDumpCaptureFileName.get().c_str(), aubCsr->getFileName().c_str()); +} + HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptureModeWhenAubSubCaptureIsActivatedThenFileIsOpened) { DebugManagerStateRestore stateRestore; std::unique_ptr> aubCsr(new MockAubCsr(*platformDevices[0], "", false, *pDevice->executionEnvironment)); diff --git a/unit_tests/test_files/igdrcl.config b/unit_tests/test_files/igdrcl.config index 6a15fa88fa..491b079cdb 100644 --- a/unit_tests/test_files/igdrcl.config +++ b/unit_tests/test_files/igdrcl.config @@ -69,6 +69,7 @@ OverrideAubDeviceId = -1 ForceCompilerUsePlatform = unk ForceCsrFlushing = false ForceCsrReprogramming = false +AUBDumpCaptureFileName = unk AUBDumpSubCaptureMode = 0 AUBDumpToggleFileName = unk AUBDumpToggleCaptureOnOff = 0