Added rsmi_dev_pci_replay_counter_get()

Also, added code to destroy/recreate mutex if we can't get a lock
within 3 seconds, when shared memory mutex is initialized.
このコミットが含まれているのは:
Chris Freehill
2019-05-06 11:26:40 -05:00
コミット 34c977bd06
11個のファイルの変更88行の追加21行の削除
+18
ファイルの表示
@@ -744,6 +744,24 @@ rsmi_status_t rsmi_dev_pci_id_get(uint32_t dv_ind, uint64_t *bdfid);
rsmi_status_t rsmi_dev_pci_throughput_get(uint32_t dv_ind, uint64_t *sent,
uint64_t *received, uint64_t *max_pkt_sz);
/**
* @brief Get PCIe replay counter
*
* @details Given a device index @p dv_ind and a pointer to a uint64_t @p
* counter, this function will write the sum of the number of NAK's received
* by the GPU and the NAK's generated by the GPU to memory pointed to by @p
* counter.
*
* @param[in] dv_ind a device index
*
* @param[inout] counter a pointer to uint64_t to which the sum of the NAK's
* received and generated by the GPU is written
*
* @retval ::RSMI_STATUS_SUCCESS is returned upon successful call.
*/
rsmi_status_t rsmi_dev_pci_replay_counter_get(uint32_t dv_ind,
uint64_t *counter);
/** @} */ // end of PCIeQuer
/*****************************************************************************/
/** @defgroup PCIeCont PCIe Control
+3 -1
ファイルの表示
@@ -56,7 +56,7 @@
#include "rocm_smi/rocm_smi_common.h"
#include "rocm_smi/rocm_smi.h"
extern "C" {
#include "shared_mutex.h"
#include "shared_mutex.h" // NOLINT
};
namespace amd {
@@ -90,6 +90,7 @@ enum DevInfoTypes {
kDevMemUsedGTT,
kDevMemUsedVisVRAM,
kDevMemUsedVRAM,
kDevPCIEReplayCount,
};
class Device {
@@ -116,6 +117,7 @@ class Device {
void set_bdfid(uint64_t val) {bdfid_ = val;}
uint64_t get_bdfid(void) const {return bdfid_;}
pthread_mutex_t *mutex(void) {return mutex_.ptr;}
private:
std::shared_ptr<Monitor> monitor_;
std::shared_ptr<PowerMon> power_monitor_;
+6 -6
ファイルの表示
@@ -66,23 +66,23 @@ int ReadSysfsStr(std::string path, std::string *retStr);
int WriteSysfsStr(std::string path, std::string val);
struct pthread_wrap {
public:
pthread_wrap(pthread_mutex_t &p_mut) : mutex_(p_mut) {}
public:
explicit pthread_wrap(pthread_mutex_t &p_mut) : mutex_(p_mut) {}
void Acquire() { pthread_mutex_lock(&mutex_); }
void Release() { pthread_mutex_unlock(&mutex_); }
private:
private:
pthread_mutex_t& mutex_;
};
struct ScopedPthread {
ScopedPthread(pthread_wrap& mutex) : pthrd_ref_(mutex) {
explicit ScopedPthread(pthread_wrap& mutex) : pthrd_ref_(mutex) {
pthrd_ref_.Acquire();
};
}
~ScopedPthread() {
pthrd_ref_.Release();
}
private:
private:
ScopedPthread(const ScopedPthread&);
pthread_wrap& pthrd_ref_;