mirror of
https://github.com/Lurkki14/tuxclocker.git
synced 2025-02-25 18:55:24 -06:00
add AMD clock readings
This commit is contained in:
parent
5fe2690bdb
commit
7be571a94f
@ -421,6 +421,65 @@ std::vector<TreeNode<DeviceNode>> getPowerUsage(AMDGPUData data) {
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<TreeNode<DeviceNode>> getCoreClockRead(AMDGPUData data) {
|
||||||
|
auto func = [=]() -> ReadResult {
|
||||||
|
uint clock;
|
||||||
|
if (amdgpu_query_sensor_info(
|
||||||
|
data.devHandle, AMDGPU_INFO_SENSOR_GFX_SCLK, sizeof(clock), &clock) == 0)
|
||||||
|
return clock;
|
||||||
|
return ReadError::UnknownError;
|
||||||
|
};
|
||||||
|
|
||||||
|
DynamicReadable dr{func, _("MHz")};
|
||||||
|
|
||||||
|
if (hasReadableValue(func())) {
|
||||||
|
return {DeviceNode{
|
||||||
|
.name = _("Core Clock"),
|
||||||
|
.interface = dr,
|
||||||
|
.hash = md5(data.pciId + "Core Clock"),
|
||||||
|
}};
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<TreeNode<DeviceNode>> getMemoryClockRead(AMDGPUData data) {
|
||||||
|
auto func = [=]() -> ReadResult {
|
||||||
|
uint clock;
|
||||||
|
// TODO: is this actually the clock speed or memory controller clock?
|
||||||
|
if (amdgpu_query_sensor_info(
|
||||||
|
data.devHandle, AMDGPU_INFO_SENSOR_GFX_MCLK, sizeof(clock), &clock) == 0)
|
||||||
|
return clock;
|
||||||
|
return ReadError::UnknownError;
|
||||||
|
};
|
||||||
|
|
||||||
|
DynamicReadable dr{func, _("MHz")};
|
||||||
|
|
||||||
|
if (hasReadableValue(func())) {
|
||||||
|
return {DeviceNode{
|
||||||
|
.name = _("Memory Clock"),
|
||||||
|
.interface = dr,
|
||||||
|
.hash = md5(data.pciId + "Memory Clock"),
|
||||||
|
}};
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<TreeNode<DeviceNode>> getClocksRoot(AMDGPUData data) {
|
||||||
|
return {DeviceNode{
|
||||||
|
.name = _("Clocks"),
|
||||||
|
.interface = std::nullopt,
|
||||||
|
.hash = md5(data.pciId + "Clocks"),
|
||||||
|
}};
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<TreeNode<DeviceNode>> getPerformanceRoot(AMDGPUData data) {
|
||||||
|
return {DeviceNode{
|
||||||
|
.name = _("Performance"),
|
||||||
|
.interface = std::nullopt,
|
||||||
|
.hash = md5(data.pciId + "Performance"),
|
||||||
|
}};
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<TreeNode<DeviceNode>> getFanRoot(AMDGPUData data) {
|
std::vector<TreeNode<DeviceNode>> getFanRoot(AMDGPUData data) {
|
||||||
return {DeviceNode{
|
return {DeviceNode{
|
||||||
.name = _("Fans"),
|
.name = _("Fans"),
|
||||||
@ -462,6 +521,12 @@ auto gpuTree = TreeConstructor<AMDGPUData, DeviceNode>{
|
|||||||
{getPowerRoot, {
|
{getPowerRoot, {
|
||||||
{getPowerLimit, {}},
|
{getPowerLimit, {}},
|
||||||
{getPowerUsage, {}}
|
{getPowerUsage, {}}
|
||||||
|
}},
|
||||||
|
{getPerformanceRoot, {
|
||||||
|
{getClocksRoot, {
|
||||||
|
{getMemoryClockRead, {}},
|
||||||
|
{getCoreClockRead, {}}
|
||||||
|
}}
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user