Adding current voltage feature & gtest.

Signed-off-by: Divya Shikre <DivyaUday.Shikre@amd.com>
Change-Id: Ic555a3af265e603419e2875d1989a366abc82596


[ROCm/amdsmi commit: 2805ed16a4]
Этот коммит содержится в:
Divya Shikre
2020-06-08 11:54:01 -04:00
родитель f15c90545d
Коммит 50c41fc401
11 изменённых файлов: 486 добавлений и 7 удалений
+3
Просмотреть файл
@@ -445,6 +445,9 @@ int main() {
CHK_RSMI_RET(ret)
std::cout << "\t**Temperature: " << val_i64/1000 << "C" << std::endl;
ret = rsmi_dev_volt_metric_get(i, RSMI_VOLT_TYPE_VDDGFX, RSMI_VOLT_CURRENT, &val_i64);
CHK_RSMI_RET(ret)
std::cout << "\t**Voltage: " << val_i64 << "mV" << std::endl;
ret = rsmi_dev_fan_speed_get(i, 0, &val_i64);
CHK_RSMI_RET(ret)
+67
Просмотреть файл
@@ -363,6 +363,39 @@ typedef enum {
RSMI_TEMP_TYPE_INVALID = 0xFFFFFFFF //!< Invalid type
} rsmi_temperature_type_t;
/**
* @brief Voltage Metrics. This enum is used to identify various
* Volatge metrics. Corresponding values will be in millivolt.
*
*/
typedef enum {
RSMI_VOLT_CURRENT = 0x0, //!< Voltage current value.
RSMI_VOLT_FIRST = RSMI_VOLT_CURRENT,
RSMI_VOLT_MAX, //!< Voltage max value.
RSMI_VOLT_MIN_CRIT, //!< Voltage critical min value.
RSMI_VOLT_MIN, //!< Voltage min value.
RSMI_VOLT_MAX_CRIT, //!< Voltage critical max value.
RSMI_VOLT_AVERAGE, //!< Average voltage.
RSMI_VOLT_LOWEST, //!< Historical minimum voltage.
RSMI_VOLT_HIGHEST, //!< Historical maximum voltage.
RSMI_VOLT_LAST = RSMI_VOLT_HIGHEST
} rsmi_voltage_metric_t;
/**
* @brief This ennumeration is used to indicate which type of
* voltage reading should be obtained.
*/
typedef enum {
RSMI_VOLT_TYPE_FIRST = 0,
RSMI_VOLT_TYPE_VDDGFX = RSMI_VOLT_TYPE_FIRST, //!< Vddgfx GPU
//!< voltage
RSMI_VOLT_TYPE_LAST = RSMI_VOLT_TYPE_VDDGFX,
RSMI_VOLT_TYPE_INVALID = 0xFFFFFFFF //!< Invalid type
} rsmi_voltage_type_t;
/**
* @brief Pre-set Profile Selections. These bitmasks can be AND'd with the
* ::rsmi_power_profile_status_t.available_profiles returned from
@@ -1736,6 +1769,40 @@ rsmi_status_t rsmi_dev_temp_metric_get(uint32_t dv_ind, uint32_t sensor_type,
rsmi_temperature_metric_t metric, int64_t *temperature);
/** @} */ // end of PhysQuer
/**
* @brief Get the voltage metric value for the specified metric, from the
* specified voltage sensor on the specified device.
*
* @details Given a device index @p dv_ind, a sensor type @p sensor_type, a
* ::rsmi_voltage_metric_t @p metric and a pointer to an int64_t @p
* voltage, this function will write the value of the metric indicated by
* @p metric and @p sensor_type to the memory location @p voltage.
*
* @param[in] dv_ind a device index
*
* @param[in] sensor_type part of device from which voltage should be
* obtained. This should come from the enum ::rsmi_voltage_type_t
*
* @param[in] metric enum indicated which voltage value should be
* retrieved
*
* @param[inout] voltage a pointer to int64_t to which the voltage
* will be written, in millivolts.
* If this parameter is nullptr, this function will return
* ::RSMI_STATUS_INVALID_ARGS if the function is supported with the provided,
* arguments and ::RSMI_STATUS_NOT_SUPPORTED if it is not supported with the
* provided arguments.
*
* @retval ::RSMI_STATUS_SUCCESS call was successful
* @retval ::RSMI_STATUS_NOT_SUPPORTED installed software or hardware does not
* support this function with the given arguments
* @retval ::RSMI_STATUS_INVALID_ARGS the provided arguments are not valid
*
*/
rsmi_status_t rsmi_dev_volt_metric_get(uint32_t dv_ind, rsmi_voltage_type_t sensor_type,
rsmi_voltage_metric_t metric, int64_t *voltage);
/** @} */ // end of PhysQuer
/*****************************************************************************/
/** @defgroup PhysCont Physical State Control
* These functions provide control over the physical state of a device.
+15 -1
Просмотреть файл
@@ -80,6 +80,15 @@ enum MonitorTypes {
kMonTempLowest,
kMonTempHighest,
kMonTempLabel,
kMonVolt,
kMonVoltMax,
kMonVoltMinCrit,
kMonVoltMin,
kMonVoltMaxCrit,
kMonVoltAverage,
kMonVoltLowest,
kMonVoltHighest,
kMonVoltLabel,
kMonInvalid = 0xFFFFFFFF,
};
@@ -92,9 +101,12 @@ class Monitor {
const std::string path(void) const {return path_;}
int readMonitor(MonitorTypes type, uint32_t sensor_ind, std::string *val);
int writeMonitor(MonitorTypes type, uint32_t sensor_ind, std::string val);
uint32_t setSensorLabelMap(void);
uint32_t setTempSensorLabelMap(void);
uint32_t getTempSensorIndex(rsmi_temperature_type_t type);
rsmi_temperature_type_t getTempSensorEnum(uint64_t ind);
uint32_t setVoltSensorLabelMap(void);
uint32_t getVoltSensorIndex(rsmi_voltage_type_t type);
rsmi_voltage_type_t getVoltSensorEnum(uint64_t ind);
void fillSupportedFuncs(SupportedFuncMap *supported_funcs);
private:
@@ -111,6 +123,8 @@ class Monitor {
// a 64b value. Also, if we need to encode anything else, 64b will give
// us more room to do so, without excessive changes.
std::map<uint64_t, rsmi_temperature_type_t> index_temp_type_map_;
std::map<rsmi_voltage_type_t, uint32_t> volt_type_index_map_;
std::map<uint64_t, rsmi_voltage_type_t> index_volt_type_map_;
};
} // namespace smi
+57
Просмотреть файл
@@ -1987,6 +1987,7 @@ rsmi_dev_temp_metric_get(uint32_t dv_ind, uint32_t sensor_type,
uint32_t sensor_index =
m->getTempSensorIndex(static_cast<rsmi_temperature_type_t>(sensor_type));
CHK_API_SUPPORT_ONLY(temperature, metric, sensor_index)
ret = get_dev_mon_value(mon_type, dv_ind, sensor_index, temperature);
@@ -1995,6 +1996,62 @@ rsmi_dev_temp_metric_get(uint32_t dv_ind, uint32_t sensor_type,
CATCH
}
rsmi_status_t
rsmi_dev_volt_metric_get(uint32_t dv_ind, rsmi_voltage_type_t sensor_type,
rsmi_voltage_metric_t metric, int64_t *voltage) {
TRY
rsmi_status_t ret;
amd::smi::MonitorTypes mon_type;
switch (metric) {
case RSMI_VOLT_CURRENT:
mon_type = amd::smi::kMonVolt;
break;
case RSMI_VOLT_MIN:
mon_type = amd::smi::kMonVoltMin;
break;
case RSMI_VOLT_MIN_CRIT:
mon_type = amd::smi::kMonVoltMinCrit;
break;
case RSMI_VOLT_MAX:
mon_type = amd::smi::kMonVoltMax;
break;
case RSMI_VOLT_MAX_CRIT:
mon_type = amd::smi::kMonVoltMaxCrit;
break;
case RSMI_VOLT_AVERAGE:
mon_type = amd::smi::kMonVoltAverage;
break;
case RSMI_VOLT_LOWEST:
mon_type = amd::smi::kMonVoltLowest;
break;
case RSMI_VOLT_HIGHEST:
mon_type = amd::smi::kMonVoltHighest;
break;
default:
mon_type = amd::smi::kMonInvalid;
}
DEVICE_MUTEX
GET_DEV_FROM_INDX
assert(dev->monitor() != nullptr);
std::shared_ptr<amd::smi::Monitor> m = dev->monitor();
// getVoltSensorIndex will throw an out of range exception if sensor_type is
// not found
uint32_t sensor_index =
m->getVoltSensorIndex(sensor_type);
CHK_API_SUPPORT_ONLY(voltage, metric, sensor_index)
ret = get_dev_mon_value(mon_type, dv_ind, sensor_index, voltage);
return ret;
CATCH
}
rsmi_status_t
rsmi_dev_fan_speed_get(uint32_t dv_ind, uint32_t sensor_ind, int64_t *speed) {
TRY
+2 -1
Просмотреть файл
@@ -508,7 +508,8 @@ uint32_t RocmSMI::DiscoverAMDMonitors(void) {
if (amd_monitor_types_.find(mon_type) != amd_monitor_types_.end()) {
std::shared_ptr<Monitor> m =
std::shared_ptr<Monitor>(new Monitor(mon_name, &env_vars_));
m->setSensorLabelMap();
m->setTempSensorLabelMap();
m->setVoltSensorLabelMap();
monitors_.push_back(m);
}
}
+106 -4
Просмотреть файл
@@ -91,11 +91,23 @@ static const char *kMonTempOffsetName = "temp#_offset";
static const char *kMonTempLowestName = "temp#_lowest";
static const char *kMonTempHighestName = "temp#_highest";
static const char *kMonTempLabelName = "temp#_label";
static const char *kMonVoltFName = "in#_input";
static const char *kMonVoltMinName = "in#_min";
static const char *kMonVoltMinCritName = "in#_lcrit";
static const char *kMonVoltMaxName = "in#_max";
static const char *kMonVoltMaxCritName = "in#_crit";
static const char *kMonVoltAverageName = "in#_average";
static const char *kMonVoltLowestName = "in#_lowest";
static const char *kMonVoltHighestName = "in#_highest";
static const char *kMonVoltLabelName = "in#_label";
static const char *kTempSensorTypeMemoryName = "mem";
static const char *kTempSensorTypeJunctionName = "junction";
static const char *kTempSensorTypeEdgeName = "edge";
static const char *kTempSensorTypeVddgfxName = "vddgfx";
static const std::map<std::string, rsmi_temperature_type_t>
kTempSensorNameMap = {
{kTempSensorTypeMemoryName, RSMI_TEMP_TYPE_MEMORY},
@@ -103,6 +115,11 @@ static const std::map<std::string, rsmi_temperature_type_t>
{kTempSensorTypeEdgeName, RSMI_TEMP_TYPE_EDGE},
};
static const std::map<std::string, rsmi_voltage_type_t>
kVoltSensorNameMap = {
{kTempSensorTypeVddgfxName, RSMI_VOLT_TYPE_VDDGFX},
};
static const std::map<MonitorTypes, const char *> kMonitorNameMap = {
{kMonName, kMonNameFName},
{kMonTemp, kMonTempFName},
@@ -128,6 +145,15 @@ static const std::map<MonitorTypes, const char *> kMonitorNameMap = {
{kMonTempLowest, kMonTempLowestName},
{kMonTempHighest, kMonTempHighestName},
{kMonTempLabel, kMonTempLabelName},
{kMonVolt, kMonVoltFName},
{kMonVoltMin, kMonVoltMinName},
{kMonVoltMinCrit, kMonVoltMinCritName},
{kMonVoltMax, kMonVoltMaxName},
{kMonVoltMaxCrit, kMonVoltMaxCritName},
{kMonVoltAverage, kMonVoltAverageName},
{kMonVoltLowest, kMonVoltLowestName},
{kMonVoltHighest, kMonVoltHighestName},
{kMonVoltLabel, kMonVoltLabelName},
};
static std::map<MonitorTypes, uint64_t> kMonInfoVarTypeToRSMIVariant = {
@@ -147,6 +173,15 @@ static std::map<MonitorTypes, uint64_t> kMonInfoVarTypeToRSMIVariant = {
{kMonTempLowest, RSMI_TEMP_LOWEST},
{kMonTempHighest, RSMI_TEMP_HIGHEST},
{kMonInvalid, RSMI_DEFAULT_VARIANT},
// rsmi_voltage_metric_t
{kMonVolt, RSMI_VOLT_CURRENT},
{kMonVoltMin, RSMI_VOLT_MIN},
{kMonVoltMinCrit, RSMI_VOLT_MIN_CRIT},
{kMonVoltMax, RSMI_VOLT_MAX},
{kMonVoltMaxCrit, RSMI_VOLT_MAX_CRIT},
{kMonVoltAverage, RSMI_VOLT_AVERAGE},
{kMonVoltLowest, RSMI_VOLT_LOWEST},
{kMonVoltHighest, RSMI_VOLT_HIGHEST},
};
typedef struct {
@@ -221,6 +256,19 @@ static const std::map<const char *, monitor_depends_t> kMonFuncDependsMap = {
.variants = {kMonInvalid},
}
},
{"rsmi_dev_volt_metric_get", { .mandatory_depends =
{kMonVoltLabelName},
.variants = {kMonVolt,
kMonVoltMin,
kMonVoltMinCrit,
kMonVoltMax,
kMonVoltMaxCrit,
kMonVoltAverage,
kMonVoltLowest,
kMonVoltHighest,
},
}
},
};
Monitor::Monitor(std::string path, RocmSMI_env_vars const *e) :
@@ -266,7 +314,7 @@ int Monitor::readMonitor(MonitorTypes type, uint32_t sensor_id,
}
uint32_t
Monitor::setSensorLabelMap(void) {
Monitor::setTempSensorLabelMap(void) {
std::string type_str;
int ret;
@@ -291,7 +339,7 @@ Monitor::setSensorLabelMap(void) {
return 0;
};
for (uint32_t i = 1; i <= 3; ++i) {
for (uint32_t i = 1; i <= RSMI_TEMP_TYPE_LAST + 1; ++i) {
ret = add_temp_sensor_entry(i);
if (ret) {
return ret;
@@ -300,6 +348,40 @@ Monitor::setSensorLabelMap(void) {
return 0;
}
uint32_t
Monitor::setVoltSensorLabelMap(void) {
std::string type_str;
int ret;
if (volt_type_index_map_.size() > 0) {
return 0; // We've already filled in the map
}
auto add_volt_sensor_entry = [&](uint32_t file_index) {
ret = readMonitor(kMonVoltLabel, file_index, &type_str);
rsmi_voltage_type_t t_type = kVoltSensorNameMap.at(type_str);
// If readMonitor fails, there is no label file for the file_index.
// In that case, map the type to file index 0, which is not supported
// and will fail appropriately later when we check for support.
if (ret) {
volt_type_index_map_.insert({t_type, 0});
index_volt_type_map_.insert({file_index, RSMI_VOLT_TYPE_INVALID});
} else {
volt_type_index_map_.insert({t_type, file_index});
index_volt_type_map_.insert({file_index, t_type});
}
index_volt_type_map_.insert({file_index, t_type});
return 0;
};
for (uint32_t i = 0; i < RSMI_VOLT_TYPE_LAST + 1; ++i) {
ret = add_volt_sensor_entry(i);
if (ret) {
return ret;
}
}
return 0;
}
static int get_supported_sensors(std::string dir_path, std::string fn_reg_ex,
std::vector<uint64_t> *sensors) {
auto hwmon_dir = opendir(dir_path.c_str());
@@ -365,6 +447,16 @@ Monitor::getTempSensorEnum(uint64_t ind) {
return index_temp_type_map_.at(ind);
}
uint32_t
Monitor::getVoltSensorIndex(rsmi_voltage_type_t type) {
return volt_type_index_map_.at(type);
}
rsmi_voltage_type_t
Monitor::getVoltSensorEnum(uint64_t ind) {
return index_volt_type_map_.at(ind);
}
static std::vector<uint64_t> get_intersection(std::vector<uint64_t> *v1,
std::vector<uint64_t> *v2) {
assert(v1 != nullptr);
@@ -387,6 +479,7 @@ static std::vector<uint64_t> get_intersection(std::vector<uint64_t> *v1,
typedef enum {
eDefaultMonitor = 0,
eTempMonitor,
eVoltMonitor,
} monitor_types;
static monitor_types getFuncType(std::string f_name) {
@@ -395,6 +488,9 @@ static monitor_types getFuncType(std::string f_name) {
if (f_name.compare("rsmi_dev_temp_metric_get") == 0) {
ret = eTempMonitor;
}
if (f_name.compare("rsmi_dev_volt_metric_get") == 0) {
ret = eVoltMonitor;
}
return ret;
}
@@ -495,15 +591,21 @@ void Monitor::fillSupportedFuncs(SupportedFuncMap *supported_funcs) {
}
if (supported_monitors.size() > 0) {
for (uint32_t i = 0; i < supported_monitors.size(); ++i) {
assert(supported_monitors[i] > 0);
if (m_type == eDefaultMonitor) {
assert(supported_monitors[i] > 0);
supported_monitors[i] |=
(supported_monitors[i] - 1) << MONITOR_TYPE_BIT_POSITION;
} else if (m_type == eTempMonitor) {
// Temp sensor file names are 1-based
assert(supported_monitors[i] > 0);
supported_monitors[i] |=
static_cast<uint64_t>(getTempSensorEnum(supported_monitors[i]))
<< MONITOR_TYPE_BIT_POSITION;
} else if (m_type == eVoltMonitor) {
// Voltage sensor file names are 0-based
supported_monitors[i] |=
static_cast<uint64_t>(getVoltSensorEnum(supported_monitors[i]))
<< MONITOR_TYPE_BIT_POSITION;
} else {
assert(!"Unexpected monitor type");
}
+150
Просмотреть файл
@@ -0,0 +1,150 @@
/*
* =============================================================================
* ROC Runtime Conformance Release License
* =============================================================================
* The University of Illinois/NCSA
* Open Source License (NCSA)
*
* Copyright (c) 2019, Advanced Micro Devices, Inc.
* All rights reserved.
*
* Developed by:
*
* AMD Research and AMD ROC Software Development
*
* Advanced Micro Devices, Inc.
*
* www.amd.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal with the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimers.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimers in
* the documentation and/or other materials provided with the distribution.
* - Neither the names of <Name of Development Group, Name of Institution>,
* nor the names of its contributors may be used to endorse or promote
* products derived from this Software without specific prior written
* permission.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS WITH THE SOFTWARE.
*
*/
#include <stdint.h>
#include <stddef.h>
#include <iostream>
#include <string>
#include <map>
#include "gtest/gtest.h"
#include "rocm_smi/rocm_smi.h"
#include "rocm_smi_test/functional/volt_read.h"
#include "rocm_smi_test/test_common.h"
TestVoltRead::TestVoltRead() : TestBase() {
set_title("RSMI Volt Read Test");
set_description("The Voltage Read tests verifies that the voltage "
"monitors can be read properly.");
}
TestVoltRead::~TestVoltRead(void) {
}
void TestVoltRead::SetUp(void) {
TestBase::SetUp();
return;
}
void TestVoltRead::DisplayTestInfo(void) {
TestBase::DisplayTestInfo();
}
void TestVoltRead::DisplayResults(void) const {
TestBase::DisplayResults();
return;
}
void TestVoltRead::Close() {
// This will close handles opened within rsmitst utility calls and call
// rsmi_shut_down(), so it should be done after other hsa cleanup
TestBase::Close();
}
void TestVoltRead::Run(void) {
rsmi_status_t err;
int64_t val_i64;
TestBase::Run();
if (setup_failed_) {
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
return;
}
rsmi_voltage_type_t type = RSMI_VOLT_TYPE_VDDGFX;
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
PrintDeviceHeader(i);
auto print_volt_metric = [&](rsmi_voltage_metric_t met,
std::string label) {
err = rsmi_dev_volt_metric_get(i, type, met, &val_i64);
if (err != RSMI_STATUS_SUCCESS) {
if (err == RSMI_STATUS_NOT_SUPPORTED) {
IF_VERB(STANDARD) {
std::cout << "\t**" << label << ": " <<
"Not supported on this machine" << std::endl;
// Verify api support checking functionality is working
err = rsmi_dev_volt_metric_get(i, type, met, nullptr);
ASSERT_EQ(err, RSMI_STATUS_NOT_SUPPORTED);
return;
}
} else {
CHK_ERR_ASRT(err)
}
}
// Verify api support checking functionality is working
err = rsmi_dev_volt_metric_get(i, type, met, nullptr);
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
IF_VERB(STANDARD) {
std::cout << "\t**" << label << ": " << val_i64 <<
"mV" << std::endl;
}
};
for (uint32_t i = RSMI_VOLT_TYPE_FIRST; i <= RSMI_VOLT_TYPE_LAST; ++i) {
IF_VERB(STANDARD) {
std::cout << "\t** **********" << GetVoltSensorNameStr(static_cast<rsmi_voltage_type_t>(i)) <<
" Voltage **********" << std::endl;
}
print_volt_metric(RSMI_VOLT_CURRENT, "Current Voltage");
print_volt_metric(RSMI_VOLT_MAX, "Voltage max value");
print_volt_metric(RSMI_VOLT_MIN, "Voltage min value");
print_volt_metric(RSMI_VOLT_MAX_CRIT,
"Voltage critical max value");
print_volt_metric(RSMI_VOLT_MIN_CRIT,
"Voltage critical min value");
print_volt_metric(RSMI_VOLT_AVERAGE, "Voltage critical max value");
print_volt_metric(RSMI_VOLT_LOWEST, "Historical minimum temperature");
print_volt_metric(RSMI_VOLT_HIGHEST, "Historical maximum temperature");
}
}
}
+73
Просмотреть файл
@@ -0,0 +1,73 @@
/*
* =============================================================================
* ROC Runtime Conformance Release License
* =============================================================================
* The University of Illinois/NCSA
* Open Source License (NCSA)
*
* Copyright (c) 2019, Advanced Micro Devices, Inc.
* All rights reserved.
*
* Developed by:
*
* AMD Research and AMD ROC Software Development
*
* Advanced Micro Devices, Inc.
*
* www.amd.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal with the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimers.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimers in
* the documentation and/or other materials provided with the distribution.
* - Neither the names of <Name of Development Group, Name of Institution>,
* nor the names of its contributors may be used to endorse or promote
* products derived from this Software without specific prior written
* permission.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS WITH THE SOFTWARE.
*
*/
#ifndef TESTS_ROCM_SMI_TEST_FUNCTIONAL_VOLT_READ_H_
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_VOLT_READ_H_
#include "rocm_smi_test/test_base.h"
class TestVoltRead : public TestBase {
public:
TestVoltRead();
// @Brief: Destructor for test case of TestVOltRead
virtual ~TestVoltRead();
// @Brief: Setup the environment for measurement
virtual void SetUp();
// @Brief: Core measurement execution
virtual void Run();
// @Brief: Clean up and retrive the resource
virtual void Close();
// @Brief: Display results
virtual void DisplayResults() const;
// @Brief: Display information about what this test does
virtual void DisplayTestInfo(void);
};
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_VOLT_READ_H_
+5
Просмотреть файл
@@ -55,6 +55,7 @@
#include "functional/fan_read.h"
#include "functional/fan_read_write.h"
#include "functional/temp_read.h"
#include "functional/volt_read.h"
#include "functional/volt_freq_curv_read.h"
#include "functional/perf_level_read.h"
#include "functional/overdrive_read.h"
@@ -143,6 +144,10 @@ TEST(rsmitstReadOnly, TempRead) {
TestTempRead tst;
RunGenericTest(&tst);
}
TEST(rsmitstReadOnly, VoltRead) {
TestVoltRead tst;
RunGenericTest(&tst);
}
TEST(rsmitstReadOnly, TestVoltCurvRead) {
TestVoltCurvRead tst;
RunGenericTest(&tst);
+7 -1
Просмотреть файл
@@ -119,6 +119,10 @@ static const struct option long_options[] = {
};
static const char* short_options = "i:v:m:fr";
static const std::map<uint32_t, std::string> kVoltSensorNameMap = {
{RSMI_VOLT_TYPE_VDDGFX, "Vddgfx"},
};
static void PrintHelp(void) {
std::cout <<
"Optional rsmitst Arguments:\n"
@@ -184,7 +188,9 @@ const char *GetBlockNameStr(rsmi_gpu_block_t id) {
const char *GetErrStateNameStr(rsmi_ras_err_state_t st) {
return kErrStateNameMap.at(st);
}
const std::string GetVoltSensorNameStr(rsmi_voltage_type_t st) {
return kVoltSensorNameMap.at(st);
}
const char *FreqEnumToStr(rsmi_clk_type rsmi_clk) {
static_assert(RSMI_CLK_TYPE_LAST == RSMI_CLK_TYPE_MEM,
"FreqEnumToStr() needs to be updated");
+1
Просмотреть файл
@@ -65,6 +65,7 @@ void PrintTestHeader(uint32_t dv_ind);
const char *GetBlockNameStr(rsmi_gpu_block_t id);
const char *GetErrStateNameStr(rsmi_ras_err_state_t st);
const char *FreqEnumToStr(rsmi_clk_type rsmi_clk);
const std::string GetVoltSensorNameStr(rsmi_voltage_type_t st);
#if ENABLE_SMI
void DumpMonitorInfo(const TestBase *test);