Merge "Docs., error checking and test improvements" into amd-master
[ROCm/amdsmi commit: 4ebb436893]
Цей коміт міститься в:
@@ -2636,6 +2636,12 @@ rsmi_dev_xgmi_error_reset(uint32_t dv_ind);
|
||||
* iterator handle to the caller-provided memory pointed to by @p handle. This
|
||||
* handle can be used to iterate through all the supported functions.
|
||||
*
|
||||
* Note that although this function takes in @p dv_ind as an argument,
|
||||
* ::rsmi_dev_supported_func_iterator_open itself will not be among the
|
||||
* functions listed as supported. This is because
|
||||
* ::rsmi_dev_supported_func_iterator_open does not depend on hardware or
|
||||
* driver support and should always be supported.
|
||||
*
|
||||
* @param[in] dv_ind a device index of device for which support information is
|
||||
* requested
|
||||
*
|
||||
|
||||
@@ -69,6 +69,8 @@ int isRegularFile(std::string fname, bool *is_reg);
|
||||
int ReadSysfsStr(std::string path, std::string *retStr);
|
||||
int WriteSysfsStr(std::string path, std::string val);
|
||||
|
||||
bool IsInteger(const std::string & n_str);
|
||||
|
||||
struct pthread_wrap {
|
||||
public:
|
||||
explicit pthread_wrap(pthread_mutex_t &p_mut) : mutex_(p_mut) {}
|
||||
|
||||
@@ -408,6 +408,12 @@ static rsmi_status_t get_dev_mon_value(amd::smi::MonitorTypes type,
|
||||
return errno_to_rsmi_status(ret);
|
||||
}
|
||||
|
||||
if (!amd::smi::IsInteger(val_str)) {
|
||||
std::cerr << "Expected integer value, but got \"" << val_str << "\"" <<
|
||||
std::endl;
|
||||
}
|
||||
assert(amd::smi::IsInteger(val_str));
|
||||
|
||||
*val = std::stoul(val_str);
|
||||
|
||||
return RSMI_STATUS_SUCCESS;
|
||||
|
||||
@@ -140,5 +140,17 @@ int ReadSysfsStr(std::string path, std::string *retStr) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool IsInteger(const std::string & n_str)
|
||||
{
|
||||
if(n_str.empty() || ((!isdigit(n_str[0])) && (n_str[0] != '-')
|
||||
&& (n_str[0] != '+'))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
char * tmp;
|
||||
strtol(n_str.c_str(), &tmp, 10);
|
||||
|
||||
return (*tmp == 0);
|
||||
}
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
|
||||
@@ -89,6 +89,7 @@ void TestFanReadWrite::Run(void) {
|
||||
int64_t orig_speed;
|
||||
int64_t new_speed;
|
||||
int64_t cur_speed;
|
||||
uint64_t max_speed;
|
||||
|
||||
TestBase::Run();
|
||||
|
||||
@@ -107,8 +108,18 @@ void TestFanReadWrite::Run(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
ret = rsmi_dev_fan_speed_max_get(dv_ind, 0, &max_speed);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
new_speed = 1.1 * orig_speed;
|
||||
|
||||
if (new_speed > static_cast<int64_t>(max_speed)) {
|
||||
std::cout <<
|
||||
"***System fan speed value is close to max. Will not adjust upward." <<
|
||||
std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Setting fan speed to " << new_speed << std::endl;
|
||||
}
|
||||
|
||||
Посилання в новій задачі
Заблокувати користувача