Lazy evaluate arguments of printDebugStrings(...) function

Change-Id: Ie44e109fd9235c5df32fb90b9e6fc6058e558a99
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2020-09-25 11:24:15 +02:00
committed by sys_ocldev
parent 7d532f4f98
commit 55bd544402
26 changed files with 88 additions and 84 deletions

View File

@@ -210,14 +210,14 @@ bool MetricContext::isMetricApiAvailable() {
// Check Metrics Discovery availability.
library.reset(NEO::OsLibrary::load(MetricEnumeration::getMetricsDiscoveryFilename()));
if (library == nullptr) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Unable to find metrics discovery %s\n", MetricEnumeration::getMetricsDiscoveryFilename());
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Unable to find metrics discovery %s\n", MetricEnumeration::getMetricsDiscoveryFilename());
return false;
}
// Check Metrics Library availability.
library.reset(NEO::OsLibrary::load(MetricsLibrary::getFilename()));
if (library == nullptr) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Unable to find metrics library %s\n", MetricsLibrary::getFilename());
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Unable to find metrics library %s\n", MetricsLibrary::getFilename());
return false;
}

View File

@@ -91,7 +91,7 @@ ze_result_t MetricEnumeration::loadMetricsDiscovery() {
if (openMetricsDevice == nullptr || closeMetricsDevice == nullptr ||
openMetricsDeviceFromFile == nullptr) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "cannot load %s exported functions\n", MetricEnumeration::getMetricsDiscoveryFilename());
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "cannot load %s exported functions\n", MetricEnumeration::getMetricsDiscoveryFilename());
cleanupMetricsDiscovery();
return ZE_RESULT_ERROR_UNKNOWN;
}

View File

@@ -192,7 +192,7 @@ bool MetricsLibrary::load() {
}
if (contextCreateFunction == nullptr || contextDeleteFunction == nullptr) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "cannot load %s exported functions\n", MetricsLibrary::getFilename());
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "cannot load %s exported functions\n", MetricsLibrary::getFilename());
return false;
}

View File

@@ -23,21 +23,21 @@ ze_result_t PinContext::init() {
hGtPinLibrary.reset(NEO::OsLibrary::load(gtPinLibraryFilename.c_str()));
if (hGtPinLibrary.get() == nullptr) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Unable to find gtpin library %s\n", gtPinLibraryFilename.c_str());
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Unable to find gtpin library %s\n", gtPinLibraryFilename.c_str());
return ZE_RESULT_ERROR_UNKNOWN;
}
OpenGTPin_fn openGTPin = reinterpret_cast<OpenGTPin_fn>(hGtPinLibrary.get()->getProcAddress(gtPinOpenFunctionName.c_str()));
if (openGTPin == nullptr) {
hGtPinLibrary.reset(nullptr);
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Unable to find gtpin library open function symbol %s\n", gtPinOpenFunctionName.c_str());
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "Unable to find gtpin library open function symbol %s\n", gtPinOpenFunctionName.c_str());
return ZE_RESULT_ERROR_UNKNOWN;
}
uint32_t openResult = openGTPin(nullptr);
if (openResult != 0) {
hGtPinLibrary.reset(nullptr);
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "gtpin library open %s failed with status %u\n", gtPinOpenFunctionName.c_str(), openResult);
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr, "gtpin library open %s failed with status %u\n", gtPinOpenFunctionName.c_str(), openResult);
return ZE_RESULT_ERROR_UNKNOWN;
}