Add initial support for getting process information

Added implementation of and tests for
rsmi_dev_compute_process_info_by_pid_get() and
rsmi_dev_compute_process_info_get()

Change-Id: I4c4f5f39fe6701da37916c9ad41449b5d35ac7af
This commit is contained in:
Chris Freehill
2019-07-03 11:29:19 -05:00
parent 1c5e090507
commit 9b93cbe21d
14 changed files with 660 additions and 49 deletions
+1 -14
View File
@@ -60,6 +60,7 @@
#include "rocm_smi/rocm_smi_device.h"
#include "rocm_smi/rocm_smi.h"
#include "rocm_smi/rocm_smi_exception.h"
#include "rocm_smi/rocm_smi_utils.h"
extern "C" {
#include "shared_mutex.h" // NOLINT
@@ -159,20 +160,6 @@ static const std::map<rsmi_dev_perf_level, const char *> kDevPerfLvlMap = {
{RSMI_DEV_PERF_LEVEL_UNKNOWN, kDevPerfLevelUnknownStr},
};
static int isRegularFile(std::string fname, bool *is_reg) {
struct stat file_stat;
int ret;
assert(is_reg != nullptr);
ret = stat(fname.c_str(), &file_stat);
if (ret) {
return errno;
}
*is_reg = S_ISREG(file_stat.st_mode);
return 0;
}
#define RET_IF_NONZERO(X) { \
if (X) return X; \
}