Enabled debug logs in frequency module

Related-To: LOCI-3471

Signed-off-by: Singh, Prasoon <prasoon.singh@intel.com>
This commit is contained in:
Singh, Prasoon
2022-11-24 09:41:25 +00:00
committed by Compute-Runtime-Automation
parent 6255361fcf
commit 6254dd057d
2 changed files with 94 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2022 Intel Corporation
* Copyright (C) 2020-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -7,6 +7,8 @@
#include "level_zero/tools/source/sysman/frequency/linux/os_frequency_imp.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "sysman/linux/os_sysman_imp.h"
#include <cmath>
@@ -23,6 +25,8 @@ ze_result_t LinuxFrequencyImp::osFrequencyGetProperties(zes_freq_properties_t &p
ze_result_t result2 = getMaxVal(properties.max);
// If can't figure out the valid range, then can't control it.
if (ZE_RESULT_SUCCESS != result1 || ZE_RESULT_SUCCESS != result2) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <getMinVal returned: 0x%x, getMaxVal returned: 0x%x> <setting min = 0.0, max = 0.0>\n", __func__, result1, result2);
properties.canControl = false;
properties.min = 0.0;
properties.max = 0.0;
@@ -40,11 +44,15 @@ double LinuxFrequencyImp::osFrequencyGetStepSize() {
ze_result_t LinuxFrequencyImp::osFrequencyGetRange(zes_freq_range_t *pLimits) {
ze_result_t result = getMax(pLimits->max);
if (ZE_RESULT_SUCCESS != result) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <getMax returned 0x%x setting max = -1>\n", __func__, result);
pLimits->max = -1;
}
result = getMin(pLimits->min);
if (ZE_RESULT_SUCCESS != result) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <getMin returned 0x%x setting min = -1>\n", __func__, result);
pLimits->min = -1;
}
return ZE_RESULT_SUCCESS;
@@ -61,6 +69,8 @@ ze_result_t LinuxFrequencyImp::osFrequencySetRange(const zes_freq_range_t *pLimi
if (result1 == ZE_RESULT_SUCCESS && result2 == ZE_RESULT_SUCCESS) {
result = setMax(maxDefault);
if (ZE_RESULT_SUCCESS != result) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <setMax(maxDefault) returned 0x%x>\n", __func__, result);
return result;
}
return setMin(minDefault);
@@ -69,12 +79,16 @@ ze_result_t LinuxFrequencyImp::osFrequencySetRange(const zes_freq_range_t *pLimi
double currentMax = 0.0;
ze_result_t result = getMax(currentMax);
if (ZE_RESULT_SUCCESS != result) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <getMax returned 0x%x>\n", __func__, result);
return result;
}
if (newMin > currentMax) {
// set the max first
ze_result_t result = setMax(newMax);
if (ZE_RESULT_SUCCESS != result) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <setMax(newMax) returned 0x%x>\n", __func__, result);
return result;
}
return setMin(newMin);
@@ -83,6 +97,8 @@ ze_result_t LinuxFrequencyImp::osFrequencySetRange(const zes_freq_range_t *pLimi
// set the min first
result = setMin(newMin);
if (ZE_RESULT_SUCCESS != result) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <setMin returned 0x%x>\n", __func__, result);
return result;
}
return setMax(newMax);
@@ -94,6 +110,8 @@ bool LinuxFrequencyImp::getThrottleReasonStatus(void) {
if (ZE_RESULT_SUCCESS == result) {
return (val == 0 ? false : true);
} else {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <failed to read file %s> <result: 0x%x>\n", __func__, throttleReasonStatusFile.c_str(), result);
return false;
}
}
@@ -103,21 +121,29 @@ ze_result_t LinuxFrequencyImp::osFrequencyGetState(zes_freq_state_t *pState) {
result = getRequest(pState->request);
if (ZE_RESULT_SUCCESS != result) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <getRequest returned 0x%x>\n", __func__, result);
pState->request = -1;
}
result = getTdp(pState->tdp);
if (ZE_RESULT_SUCCESS != result) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <getTdp returned 0x%x>\n", __func__, result);
pState->tdp = -1;
}
result = getEfficient(pState->efficient);
if (ZE_RESULT_SUCCESS != result) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <getEfficient returned 0x%x>\n", __func__, result);
pState->efficient = -1;
}
result = getActual(pState->actual);
if (ZE_RESULT_SUCCESS != result) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <getActual returned 0x%x>\n", __func__, result);
pState->actual = -1;
}
@@ -203,6 +229,8 @@ ze_result_t LinuxFrequencyImp::getMin(double &min) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <failed to read file %s> <result: 0x%x>\n", __func__, minFreqFile.c_str(), result);
return result;
}
min = intval;
@@ -215,6 +243,8 @@ ze_result_t LinuxFrequencyImp::setMin(double min) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <failed to write file %s> <result: 0x%x>\n", __func__, minFreqFile.c_str(), result);
return result;
}
return ZE_RESULT_SUCCESS;
@@ -228,6 +258,8 @@ ze_result_t LinuxFrequencyImp::getMax(double &max) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <failed to read file %s> <result: 0x%x>\n", __func__, maxFreqFile.c_str(), result);
return result;
}
max = intval;
@@ -240,6 +272,8 @@ ze_result_t LinuxFrequencyImp::setMax(double max) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <failed to write file %s> <result: 0x%x>\n", __func__, maxFreqFile.c_str(), result);
return result;
}
return pSysfsAccess->write(boostFreqFile, max);
@@ -253,6 +287,8 @@ ze_result_t LinuxFrequencyImp::getRequest(double &request) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <failed to read file %s> <result: 0x%x>\n", __func__, requestFreqFile.c_str(), result);
return result;
}
request = intval;
@@ -267,6 +303,8 @@ ze_result_t LinuxFrequencyImp::getTdp(double &tdp) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <failed to read file %s> <result: 0x%x>\n", __func__, tdpFreqFile.c_str(), result);
return result;
}
tdp = intval;
@@ -281,6 +319,8 @@ ze_result_t LinuxFrequencyImp::getActual(double &actual) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <failed to read file %s> <result: 0x%x>\n", __func__, actualFreqFile.c_str(), result);
return result;
}
actual = intval;
@@ -295,6 +335,8 @@ ze_result_t LinuxFrequencyImp::getEfficient(double &efficient) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <failed to read file %s> <result: 0x%x>\n", __func__, efficientFreqFile.c_str(), result);
return result;
}
efficient = intval;
@@ -309,6 +351,8 @@ ze_result_t LinuxFrequencyImp::getMaxVal(double &maxVal) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <failed to read file %s> <result: 0x%x>\n", __func__, maxValFreqFile.c_str(), result);
return result;
}
maxVal = intval;
@@ -323,6 +367,8 @@ ze_result_t LinuxFrequencyImp::getMinVal(double &minVal) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <failed to read file %s> <result: 0x%x>\n", __func__, minValFreqFile.c_str(), result);
return result;
}
minVal = intval;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 Intel Corporation
* Copyright (C) 2022-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -7,6 +7,8 @@
#include "level_zero/tools/source/sysman/frequency/linux/os_frequency_imp_prelim.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "igfxfmid.h"
#include "sysman/linux/os_sysman_imp.h"
@@ -24,6 +26,8 @@ ze_result_t LinuxFrequencyImp::osFrequencyGetProperties(zes_freq_properties_t &p
ze_result_t result2 = getMaxVal(properties.max);
// If can't figure out the valid range, then can't control it.
if (ZE_RESULT_SUCCESS != result1 || ZE_RESULT_SUCCESS != result2) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <getMinVal returned: 0x%x, getMaxVal returned: 0x%x> <setting min = 0.0, max = 0.0>\n", __func__, result1, result2);
properties.canControl = false;
properties.min = 0.0;
properties.max = 0.0;
@@ -48,11 +52,15 @@ double LinuxFrequencyImp::osFrequencyGetStepSize() {
ze_result_t LinuxFrequencyImp::osFrequencyGetRange(zes_freq_range_t *pLimits) {
ze_result_t result = getMax(pLimits->max);
if (ZE_RESULT_SUCCESS != result) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <getMax returned 0x%x setting max = -1>\n", __func__, result);
pLimits->max = -1;
}
result = getMin(pLimits->min);
if (ZE_RESULT_SUCCESS != result) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <getMin returned 0x%x setting min = -1>\n", __func__, result);
pLimits->min = -1;
}
return ZE_RESULT_SUCCESS;
@@ -69,6 +77,8 @@ ze_result_t LinuxFrequencyImp::osFrequencySetRange(const zes_freq_range_t *pLimi
if (result1 == ZE_RESULT_SUCCESS && result2 == ZE_RESULT_SUCCESS) {
result = setMax(maxDefault);
if (ZE_RESULT_SUCCESS != result) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <setMax(maxDefault) returned 0x%x>\n", __func__, result);
return result;
}
return setMin(minDefault);
@@ -77,12 +87,16 @@ ze_result_t LinuxFrequencyImp::osFrequencySetRange(const zes_freq_range_t *pLimi
double currentMax = 0.0;
ze_result_t result = getMax(currentMax);
if (ZE_RESULT_SUCCESS != result) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <getMax returned 0x%x>\n", __func__, result);
return result;
}
if (newMin > currentMax) {
// set the max first
ze_result_t result = setMax(newMax);
if (ZE_RESULT_SUCCESS != result) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <setMax(newMax) returned 0x%x>\n", __func__, result);
return result;
}
return setMin(newMin);
@@ -91,6 +105,8 @@ ze_result_t LinuxFrequencyImp::osFrequencySetRange(const zes_freq_range_t *pLimi
// set the min first
result = setMin(newMin);
if (ZE_RESULT_SUCCESS != result) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <setMin returned 0x%x>\n", __func__, result);
return result;
}
return setMax(newMax);
@@ -101,6 +117,8 @@ bool LinuxFrequencyImp::getThrottleReasonStatus(void) {
if (ZE_RESULT_SUCCESS == result) {
return (val == 0 ? false : true);
} else {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <failed to read file %s> <result: 0x%x>\n", __func__, throttleReasonStatusFile.c_str(), result);
return false;
}
}
@@ -110,21 +128,29 @@ ze_result_t LinuxFrequencyImp::osFrequencyGetState(zes_freq_state_t *pState) {
result = getRequest(pState->request);
if (ZE_RESULT_SUCCESS != result) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <getRequest returned 0x%x>\n", __func__, result);
pState->request = -1;
}
result = getTdp(pState->tdp);
if (ZE_RESULT_SUCCESS != result) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <getTdp returned 0x%x>\n", __func__, result);
pState->tdp = -1;
}
result = getEfficient(pState->efficient);
if (ZE_RESULT_SUCCESS != result) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <getEfficient returned 0x%x>\n", __func__, result);
pState->efficient = -1;
}
result = getActual(pState->actual);
if (ZE_RESULT_SUCCESS != result) {
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <getActual returned 0x%x>\n", __func__, result);
pState->actual = -1;
}
@@ -209,6 +235,8 @@ ze_result_t LinuxFrequencyImp::getMin(double &min) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <failed to read file %s> <result: 0x%x>\n", __func__, minFreqFile.c_str(), result);
return result;
}
min = intval;
@@ -221,6 +249,8 @@ ze_result_t LinuxFrequencyImp::setMin(double min) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <failed to write file %s> <result: 0x%x>\n", __func__, minFreqFile.c_str(), result);
return result;
}
return ZE_RESULT_SUCCESS;
@@ -233,6 +263,8 @@ ze_result_t LinuxFrequencyImp::getMax(double &max) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <failed to read file %s> <result: 0x%x>\n", __func__, maxFreqFile.c_str(), result);
return result;
}
max = intval;
@@ -245,6 +277,8 @@ ze_result_t LinuxFrequencyImp::setMax(double max) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <failed to write file %s> <result: 0x%x>\n", __func__, maxFreqFile.c_str(), result);
return result;
}
return pSysfsAccess->write(boostFreqFile, max);
@@ -258,6 +292,8 @@ ze_result_t LinuxFrequencyImp::getRequest(double &request) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <failed to read file %s> <result: 0x%x>\n", __func__, requestFreqFile.c_str(), result);
return result;
}
request = intval;
@@ -272,6 +308,8 @@ ze_result_t LinuxFrequencyImp::getTdp(double &tdp) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <failed to read file %s> <result: 0x%x>\n", __func__, tdpFreqFile.c_str(), result);
return result;
}
tdp = intval;
@@ -286,6 +324,8 @@ ze_result_t LinuxFrequencyImp::getActual(double &actual) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <failed to read file %s> <result: 0x%x>\n", __func__, actualFreqFile.c_str(), result);
return result;
}
actual = intval;
@@ -300,6 +340,8 @@ ze_result_t LinuxFrequencyImp::getEfficient(double &efficient) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <failed to read file %s> <result: 0x%x>\n", __func__, efficientFreqFile.c_str(), result);
return result;
}
efficient = intval;
@@ -314,6 +356,8 @@ ze_result_t LinuxFrequencyImp::getMaxVal(double &maxVal) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <failed to read file %s> <result: 0x%x>\n", __func__, maxValFreqFile.c_str(), result);
return result;
}
maxVal = intval;
@@ -328,6 +372,8 @@ ze_result_t LinuxFrequencyImp::getMinVal(double &minVal) {
if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) {
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
"error@<%s> <failed to read file %s> <result: 0x%x>\n", __func__, minValFreqFile.c_str(), result);
return result;
}
minVal = intval;