Power Queries

Power Queries#

AMD SMI: Power Queries
Power Queries

Functions

amdsmi_status_t amdsmi_dev_get_power_ave (amdsmi_device_handle device_handle, uint32_t sensor_ind, uint64_t *power)
 Get the average power consumption of a device. More...
 
amdsmi_status_t amdsmi_dev_get_energy_count (amdsmi_device_handle device_handle, uint64_t *power, float *counter_resolution, uint64_t *timestamp)
 Get the energy accumulator counter of the device with provided device handle. More...
 

Detailed Description

These functions provide information about power usage.

Function Documentation

◆ amdsmi_dev_get_power_ave()

amdsmi_status_t amdsmi_dev_get_power_ave ( amdsmi_device_handle  device_handle,
uint32_t  sensor_ind,
uint64_t *  power 
)

Get the average power consumption of a device.

This function will write the current average power consumption (in microwatts) to the uint64_t pointed to by power, for the given device handle device_handle and a pointer to a uint64_t power

Parameters
[in]device_handlea device handle
[in]sensor_inda 0-based sensor index. Normally, this will be 0. If a device has more than one sensor, it could be greater than 0.
[in,out]powera pointer to uint64_t to which the average power consumption will be written If this parameter is nullptr, this function will return AMDSMI_STATUS_INVAL if the function is supported with the provided, arguments and AMDSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
Returns
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail

◆ amdsmi_dev_get_energy_count()

amdsmi_status_t amdsmi_dev_get_energy_count ( amdsmi_device_handle  device_handle,
uint64_t *  power,
float *  counter_resolution,
uint64_t *  timestamp 
)

Get the energy accumulator counter of the device with provided device handle.

Given a device handle device_handle, a pointer to a uint64_t power, and a pointer to a uint64_t timestamp, this function will write amount of energy consumed to the uint64_t pointed to by power, and the timestamp to the uint64_t pointed to by timestamp. The amdsmi_dev_get_power_ave() is an average of a short time. This function accumulates all energy consumed.

Parameters
[in]device_handlea device handle
[in,out]counter_resolutionresolution of the counter power in micro Joules
[in,out]powera pointer to uint64_t to which the energy counter will be written If this parameter is nullptr, this function will return AMDSMI_STATUS_INVAL if the function is supported with the provided, and AMDSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
[in,out]timestampa pointer to uint64_t to which the timestamp will be written. Resolution: 1 ns.
Returns
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail