Add support to retrieve process SDMA usage information.
Also, print SDMA usage information in TestProcInfoRead.
Change-Id: I8d19be3b8653e298c81237e5067eca75a1743e70
[ROCm/amdsmi commit: eea1ed8c3d]
This commit is contained in:
@@ -748,6 +748,7 @@ typedef struct {
|
||||
uint32_t process_id; //!< Process ID
|
||||
uint32_t pasid; //!< PASID
|
||||
uint64_t vram_usage; //!< VRAM usage
|
||||
uint64_t sdma_usage; //!< SDMA usage in microseconds
|
||||
} rsmi_process_info_t;
|
||||
|
||||
|
||||
|
||||
@@ -433,6 +433,7 @@ int GetProcessInfoForPID(uint32_t pid, rsmi_process_info_t *proc,
|
||||
proc->pasid = std::stoi(tmp);
|
||||
|
||||
proc->vram_usage = 0;
|
||||
proc->sdma_usage = 0;
|
||||
|
||||
for (itr = gpu_set->begin(); itr != gpu_set->end(); itr++) {
|
||||
uint64_t gpu_id = (*itr);
|
||||
@@ -451,6 +452,21 @@ int GetProcessInfoForPID(uint32_t pid, rsmi_process_info_t *proc,
|
||||
}
|
||||
|
||||
proc->vram_usage += std::stoi(tmp);
|
||||
|
||||
std::string sdma_str_path = proc_str_path;
|
||||
sdma_str_path += "/sdma_";
|
||||
sdma_str_path += std::to_string(gpu_id);
|
||||
|
||||
err = ReadSysfsStr(sdma_str_path, &tmp);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
||||
if (!is_number(tmp)) {
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
proc->sdma_usage += std::stoi(tmp);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -207,7 +207,10 @@ void TestProcInfoRead::Run(void) {
|
||||
ASSERT_EQ(proc_info.pasid, procs[j].pasid);
|
||||
std::cout << "\t** Process ID: " <<
|
||||
procs[j].process_id << " VRAM Usage: " <<
|
||||
proc_info.vram_usage << std::endl;
|
||||
proc_info.vram_usage <<
|
||||
" SDMA Usage: " <<
|
||||
proc_info.sdma_usage <<
|
||||
std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Referens i nytt ärende
Block a user