mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 21:18:24 +08:00
Add option to log allocations to std out
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
205e2e1957
commit
35f6cd00ee
@@ -29,6 +29,7 @@ FileLogger<DebugLevel>::FileLogger(std::string filename, const DebugVariables &f
|
||||
logApiCalls = flags.LogApiCalls.get();
|
||||
logAllocationMemoryPool = flags.LogAllocationMemoryPool.get();
|
||||
logAllocationType = flags.LogAllocationType.get();
|
||||
logAllocationStdout = flags.LogAllocationStdout.get();
|
||||
}
|
||||
|
||||
template <DebugFunctionalityLevel DebugLevel>
|
||||
@@ -84,14 +85,10 @@ void FileLogger<DebugLevel>::logAllocation(GraphicsAllocation const *graphicsAll
|
||||
printDebugString(true, stdout, "Created Graphics Allocation of type %s\n", getAllocationTypeString(graphicsAllocation));
|
||||
}
|
||||
|
||||
if (false == enabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::stringstream ss;
|
||||
if (logAllocationMemoryPool || logAllocationType) {
|
||||
std::thread::id thisThread = std::this_thread::get_id();
|
||||
|
||||
std::stringstream ss;
|
||||
ss << " ThreadID: " << thisThread;
|
||||
ss << " AllocationType: " << getAllocationTypeString(graphicsAllocation);
|
||||
ss << " MemoryPool: " << graphicsAllocation->getMemoryPool();
|
||||
@@ -100,9 +97,19 @@ void FileLogger<DebugLevel>::logAllocation(GraphicsAllocation const *graphicsAll
|
||||
|
||||
ss << graphicsAllocation->getAllocationInfoString();
|
||||
ss << std::endl;
|
||||
}
|
||||
auto str = ss.str();
|
||||
|
||||
auto str = ss.str();
|
||||
if (logAllocationStdout) {
|
||||
printf("%s", str.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (false == enabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (logAllocationMemoryPool || logAllocationType) {
|
||||
writeToFile(logFileName, str.c_str(), str.size(), std::ios::app);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,6 +142,7 @@ class FileLogger {
|
||||
bool logApiCalls = false;
|
||||
bool logAllocationMemoryPool = false;
|
||||
bool logAllocationType = false;
|
||||
bool logAllocationStdout = false;
|
||||
|
||||
// Required for variadic template with 0 args passed
|
||||
void printInputs(std::stringstream &ss) {}
|
||||
|
||||
Reference in New Issue
Block a user