Improve allocation type logging.

- allow to do this in release builds.
- allow to capture thise on stdout.

Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
This commit is contained in:
Michal Mrozek
2021-08-18 11:48:14 +00:00
committed by Compute-Runtime-Automation
parent d8a98acafd
commit b5d5784b81
5 changed files with 25 additions and 15 deletions

View File

@@ -35,6 +35,7 @@ FileLogger<DebugLevel>::FileLogger(std::string filename, const DebugVariables &f
dumpKernelArgsEnabled = flags.DumpKernelArgs.get();
logApiCalls = flags.LogApiCalls.get();
logAllocationMemoryPool = flags.LogAllocationMemoryPool.get();
logAllocationType = flags.LogAllocationType.get();
}
template <DebugFunctionalityLevel DebugLevel>
@@ -86,6 +87,10 @@ void FileLogger<DebugLevel>::logApiCall(const char *function, bool enter, int32_
template <DebugFunctionalityLevel DebugLevel>
void FileLogger<DebugLevel>::logAllocation(GraphicsAllocation const *graphicsAllocation) {
if (logAllocationType) {
printDebugString(true, stdout, "Created Graphics Allocation of type %s\n", getAllocationTypeString(graphicsAllocation));
}
if (false == enabled()) {
return;
}
@@ -244,12 +249,7 @@ void FileLogger<DebugLevel>::dumpKernelArgs(const MultiDispatchInfo *multiDispat
}
}
template <DebugFunctionalityLevel DebugLevel>
const char *FileLogger<DebugLevel>::getAllocationTypeString(GraphicsAllocation const *graphicsAllocation) {
if (false == enabled()) {
return nullptr;
}
const char *getAllocationTypeString(GraphicsAllocation const *graphicsAllocation) {
auto type = graphicsAllocation->getAllocationType();
switch (type) {

View File

@@ -20,6 +20,8 @@ namespace NEO {
class Kernel;
struct MultiDispatchInfo;
const char *getAllocationTypeString(GraphicsAllocation const *graphicsAllocation);
template <DebugFunctionalityLevel DebugLevel>
class FileLogger {
public:
@@ -137,7 +139,6 @@ class FileLogger {
logFileName = filename;
}
const char *getAllocationTypeString(GraphicsAllocation const *graphicsAllocation);
bool peekLogApiCalls() { return logApiCalls; }
protected:
@@ -147,6 +148,7 @@ class FileLogger {
bool dumpKernelArgsEnabled = false;
bool logApiCalls = false;
bool logAllocationMemoryPool = false;
bool logAllocationType = false;
// Required for variadic template with 0 args passed
void printInputs(std::stringstream &ss) {}