use hmwon freq1/2 instead for amdgpu core/mem clocks

pull/58/head
FlightlessMango 4 years ago
parent 274b3e67ca
commit 857dcf7fb8

@ -115,31 +115,21 @@ void *getAmdGpuUsage(void *){
if (amdGpuCoreClockFile) {
rewind(amdGpuCoreClockFile);
fflush(amdGpuCoreClockFile);
char line[255];
while (fgets(line, sizeof(line), amdGpuCoreClockFile)){
std::string row = line;
row.erase(row.begin());
if (row.find("*") != std::string::npos){
row = std::regex_replace(row, std::regex(R"([^0-9])"), "");
amdgpu.CoreClock = stoi(row);
gpuCoreClock = amdgpu.CoreClock;
}
}
if (fscanf(amdGpuCoreClockFile, "%" PRId64, &amdgpu.CoreClock) != 1)
amdgpu.CoreClock = 0;
amdgpu.CoreClock /= 1000000;
gpuCoreClock = amdgpu.CoreClock;
}
if (amdGpuMemoryClockFile) {
rewind(amdGpuMemoryClockFile);
fflush(amdGpuMemoryClockFile);
char line[255];
while (fgets(line, sizeof(line), amdGpuMemoryClockFile)){
std::string row = line;
row.erase(row.begin());
if (row.find("*") != std::string::npos){
row = std::regex_replace(row, std::regex(R"([^0-9])"), "");
amdgpu.MemClock = stoi(row) * 2;
gpuMemClock = amdgpu.MemClock;
}
}
if (fscanf(amdGpuMemoryClockFile, "%" PRId64, &amdgpu.MemClock) != 1)
amdgpu.MemClock = 0;
amdgpu.MemClock /= 1000000;
gpuMemClock = amdgpu.MemClock;
}
pthread_detach(gpuThread);

@ -820,14 +820,14 @@ void init_gpu_stats(struct device_data *device_data)
amdGpuVramTotalFile = fopen((path + "/device/mem_info_vram_total").c_str(), "r");
if (!amdGpuVramUsedFile)
amdGpuVramUsedFile = fopen((path + "/device/mem_info_vram_used").c_str(), "r");
if (!amdGpuMemoryClockFile)
amdGpuMemoryClockFile = fopen((path + "/device/pp_dpm_mclk").c_str(), "r");
if (!amdGpuCoreClockFile)
amdGpuCoreClockFile = fopen((path + "/device/pp_dpm_sclk").c_str(), "r");
path = path + "/device/hwmon/";
string tempFolder;
if (find_folder(path, "hwmon", tempFolder)) {
if (!amdGpuCoreClockFile)
amdGpuCoreClockFile = fopen((path + tempFolder + "/freq1_input").c_str(), "r");
if (!amdGpuMemoryClockFile)
amdGpuMemoryClockFile = fopen((path + tempFolder + "/freq2_input").c_str(), "r");
path = path + tempFolder + "/temp1_input";
if (!amdTempFile)

Loading…
Cancel
Save