[SWDEV-488303] Adjusted process vram_mem data source (#411)

* [SWDEV-488303] Adjusted process vram_mem data source
* Standardized sscanf format strings

---------

Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
Co-authored-by: gabrpham_amdeng <Gabriel.Pham@amd.com>
This commit is contained in:
Arif, Maisam
2025-05-29 23:26:12 -05:00
committed by GitHub
parent 876f3976e0
commit 42441c78ea
6 changed files with 91 additions and 27 deletions
+5 -5
View File
@@ -1080,18 +1080,18 @@ typedef uint32_t amdsmi_process_handle_t;
typedef struct {
char name[AMDSMI_MAX_STRING_LENGTH];
amdsmi_process_handle_t pid;
uint64_t mem; //!< In bytes
uint64_t mem; //!< In Bytes
struct engine_usage_ {
uint64_t gfx; //!< In nano-secs
uint64_t enc; //!< In nano-secs
uint32_t reserved[12];
} engine_usage; //!< time the process spends using these engines in ns
struct memory_usage_ {
uint64_t gtt_mem; //!< In MB
uint64_t cpu_mem; //!< In MB
uint64_t vram_mem; //!< In MB
uint64_t gtt_mem; //!< In Bytes
uint64_t cpu_mem; //!< In Bytes
uint64_t vram_mem; //!< In Bytes
uint32_t reserved[10];
} memory_usage; //!< in bytes
} memory_usage; //!< In Bytes
char container_name[AMDSMI_MAX_STRING_LENGTH];
uint32_t cu_occupancy; //!< Num CUs utilized
uint32_t reserved[11];
@@ -62,6 +62,7 @@ class AMDSmiGPUDevice: public AMDSmiProcessor {
uint32_t get_gpu_fd() const;
uint32_t get_card_id(); // -e feature + we can get card_id for our internal functions
uint32_t get_drm_render_minor(); // -e feature + we can get card_id for our internal functions
uint64_t get_kfd_gpu_id(); // Used to decode vram usage for KFD processes
std::string& get_gpu_path();
amdsmi_bdf_t get_bdf();
bool check_if_drm_is_supported() { return drm_.check_if_drm_is_supported(); }
@@ -84,6 +85,7 @@ class AMDSmiGPUDevice: public AMDSmiProcessor {
AMDSmiDrm& drm_;
uint32_t card_index_;
uint32_t drm_render_minor_;
uint64_t kfd_gpu_id_; // Used to decode vram usage for KFD processes
GPUComputeProcessList_t compute_process_list_;
int32_t get_compute_process_list_impl(GPUComputeProcessList_t& compute_process_list,
ComputeProcessListType_t list_type);