fix: add debug key to provide alternative directory for wddm residency logs

Related-To: NEO-8211

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2023-08-31 03:45:38 +00:00
committed by Compute-Runtime-Automation
parent b77b0e487d
commit cb641226b5
6 changed files with 96 additions and 51 deletions

View File

@@ -1236,7 +1236,7 @@ uint32_t Wddm::getRequestedEUCount() const {
void Wddm::createPagingFenceLogger() {
if (DebugManager.flags.WddmResidencyLogger.get()) {
residencyLogger = std::make_unique<WddmResidencyLogger>(device, pagingFenceAddress);
residencyLogger = std::make_unique<WddmResidencyLogger>(device, pagingFenceAddress, DebugManager.flags.WddmResidencyLoggerOutputDirectory.get());
}
}

View File

@@ -11,6 +11,7 @@
#include "shared/source/utilities/io_functions.h"
#include <chrono>
#include <cstring>
#include <sstream>
namespace NEO {
@@ -23,13 +24,23 @@ constexpr bool wddmResidencyLoggingAvailable = false;
class WddmResidencyLogger {
public:
WddmResidencyLogger(unsigned int device, void *fenceValueCpuVirtualAddress) {
WddmResidencyLogger(unsigned int device, void *fenceValueCpuVirtualAddress, std::string outDirectory) {
const char *wddmResidencyLoggerDefaultDirectory = "unk";
std::stringstream id;
id << std::hex;
id << "device-0x" << device << "_"
<< "pfencecpu-0x" << fenceValueCpuVirtualAddress;
std::stringstream filename;
if (std::strcmp(wddmResidencyLoggerDefaultDirectory, outDirectory.c_str()) != 0) {
filename << outDirectory;
if (outDirectory.back() != '\\') {
filename << "\\";
}
}
filename << "pagingfence_" << id.str() << ".log";
pagingLog = IoFunctions::fopenPtr(filename.str().c_str(), "at");
UNRECOVERABLE_IF(pagingLog == nullptr);
IoFunctions::fprintf(pagingLog, "%s\n", id.str().c_str());