refactor: use appropriate debug macros

Related-To: NEO-11034


Signed-off-by: Joshua Santosh Ranjan <joshua.santosh.ranjan@intel.com>
This commit is contained in:
Joshua Santosh Ranjan
2024-08-09 07:40:59 +00:00
committed by Compute-Runtime-Automation
parent 9652eae461
commit ef779165ec
4 changed files with 19 additions and 31 deletions

View File

@@ -114,8 +114,9 @@ ze_result_t MetricIpSamplingLinuxImp::stopMeasurement() {
ze_result_t MetricIpSamplingLinuxImp::readData(uint8_t *pRawData, size_t *pRawDataSize) {
ssize_t ret = NEO::SysCalls::read(stream, pRawData, *pRawDataSize);
PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get() && (ret < 0), stderr, "read() failed errno = %d | ret = %d \n",
errno, ret);
if (ret < 0) {
METRICS_LOG_ERR("read() failed errno = %d | ret = %d", errno, ret);
}
if (ret >= 0) {
*pRawDataSize = ret;
@@ -154,8 +155,9 @@ bool MetricIpSamplingLinuxImp::isNReportsAvailable() {
pollParams.events = POLLIN;
int32_t pollResult = NEO::SysCalls::poll(&pollParams, 1, 0u);
PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get() && (pollResult < 0), stderr, "poll() failed errno = %d | pollResult = %d \n",
errno, pollResult);
if (pollResult < 0) {
METRICS_LOG_ERR("poll() failed errno = %d | pollResult = %d", errno, pollResult);
}
if (pollResult > 0) {
return true;
@@ -186,8 +188,7 @@ ze_result_t MetricIpSamplingLinuxImp::getMetricsTimerResolution(uint64_t &timerR
if (ret < 0 || gpuTimeStampfrequency == 0) {
timerResolution = 0;
result = ZE_RESULT_ERROR_UNKNOWN;
PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "getTimestampFrequency() failed errno = %d | ret = %d \n",
errno, ret);
METRICS_LOG_ERR("getTimestampFrequency() failed errno = %d | ret = %d", errno, ret);
} else {
timerResolution = static_cast<uint64_t>(gpuTimeStampfrequency);
}

View File

@@ -96,8 +96,7 @@ ze_result_t MetricOALinuxImp::getMetricsTimerResolution(uint64_t &timerResolutio
if (ret < 0 || timestampFrequency == 0) {
timerResolution = 0;
result = ZE_RESULT_ERROR_UNKNOWN;
PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr, "getOATimestampFrequenc() failed errno = %d | ret = %d \n",
errno, ret);
METRICS_LOG_ERR("getOATimestampFrequenc() failed errno = %d | ret = %d", errno, ret);
} else {
timerResolution = static_cast<uint64_t>(timestampFrequency);
}

View File

@@ -354,10 +354,8 @@ ze_result_t MetricOaExporter01::getDeltaFunction(zet_intel_metric_df_gpu_delta_f
};
if (deltaFunctionMap.find(mdDeltaFunction.FunctionType) == deltaFunctionMap.end()) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
"Error: Unknown Delta Function Type 0x%x at %s():%d returning 0x%x\n",
static_cast<uint32_t>(mdDeltaFunction.FunctionType),
__FUNCTION__, __LINE__, ZE_RESULT_ERROR_UNSUPPORTED_VERSION);
METRICS_LOG_ERR("Error: Unknown Delta Function Type 0x%x returning 0x%x",
static_cast<uint32_t>(mdDeltaFunction.FunctionType), ZE_RESULT_ERROR_UNSUPPORTED_VERSION);
return ZE_RESULT_ERROR_UNSUPPORTED_VERSION;
}
assignUnaligned(&deltaFunction.bitsCount, &mdDeltaFunction.BitsCount);
@@ -377,10 +375,8 @@ ze_result_t MetricOaExporter01::getInformationType(zet_intel_metric_df_gpu_infor
{MetricsDiscovery::INFORMATION_TYPE_GPU_NODE, ZET_INTEL_METRIC_DF_INFORMATION_TYPE_GPU_NODE}};
if (informationTypeMap.find(mdInfoType) == informationTypeMap.end()) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
"Error: Unknown Information Type 0x%x at %s():%d returning 0x%x\n",
static_cast<uint32_t>(mdInfoType),
__FUNCTION__, __LINE__, ZE_RESULT_ERROR_UNSUPPORTED_VERSION);
METRICS_LOG_ERR("Error: Unknown Information Type 0x%x returning 0x%x",
static_cast<uint32_t>(mdInfoType), ZE_RESULT_ERROR_UNSUPPORTED_VERSION);
return ZE_RESULT_ERROR_UNSUPPORTED_VERSION;
}
@@ -502,10 +498,8 @@ ze_result_t MetricOaExporter01::getMetricType(zet_intel_metric_df_gpu_metric_typ
};
if (metricTypeMap.find(mdMetricType) == metricTypeMap.end()) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
"Error: Unknown Metric Type 0x%x at %s():%d returning 0x%x\n",
static_cast<uint32_t>(mdMetricType),
__FUNCTION__, __LINE__, ZE_RESULT_ERROR_UNSUPPORTED_VERSION);
METRICS_LOG_ERR("Error: Unknown Metric Type 0x%x returning 0x%x",
static_cast<uint32_t>(mdMetricType), ZE_RESULT_ERROR_UNSUPPORTED_VERSION);
return ZE_RESULT_ERROR_UNSUPPORTED_VERSION;
}
@@ -522,10 +516,8 @@ ze_result_t MetricOaExporter01::getMetricResultType(zet_intel_metric_df_gpu_metr
};
if (resultTypeMap.find(mdResultType) == resultTypeMap.end()) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
"Error: Unknown Metric Result Type 0x%x at %s():%d returning 0x%x\n",
static_cast<uint32_t>(mdResultType),
__FUNCTION__, __LINE__, ZE_RESULT_ERROR_UNSUPPORTED_VERSION);
METRICS_LOG_ERR("Error: Unknown Metric Result Type 0x%x returning 0x%x",
static_cast<uint32_t>(mdResultType), ZE_RESULT_ERROR_UNSUPPORTED_VERSION);
return ZE_RESULT_ERROR_UNSUPPORTED_VERSION;
}
@@ -751,9 +743,7 @@ ze_result_t OaMetricGroupImp::getExportData(const uint8_t *pRawData,
}
if (*pExportDataSize < expectedExportDataSize) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
"Error:Incorrect Size Passed at %s():%d returning 0x%x\n",
__FUNCTION__, __LINE__, ZE_RESULT_ERROR_INVALID_SIZE);
METRICS_LOG_ERR("Error:Incorrect Size Passed returning 0x%x", ZE_RESULT_ERROR_INVALID_SIZE);
return ZE_RESULT_ERROR_INVALID_SIZE;
}
@@ -771,9 +761,7 @@ ze_result_t OaMetricGroupImp::getExportData(const uint8_t *pRawData,
// read and update the export data
status = exporter01.getExportData(&exportData->format01.oaData);
if (status != ZE_RESULT_SUCCESS) {
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
"Error: ExportData_0_1 Failed at %s():%d returning 0x%x\n",
__FUNCTION__, __LINE__, status);
METRICS_LOG_ERR("Error: ExportData_0_1 Failed returning 0x%x", status);
return status;
}

View File

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