PC Sampling: Add start stop and flush APIs

Create PC Sampling APIs for start and stop functions. And create stub
for flush function.

Change-Id: I7a093b29dc87e34ac06faaae6cac2be50e4663e1


[ROCm/ROCR-Runtime commit: a842247482]
This commit is contained in:
David Yat Sin
2023-09-23 15:58:13 +00:00
parent 566e2c60fd
commit bcdecc7ff4
7 changed files with 161 additions and 3 deletions
@@ -70,7 +70,7 @@ class PcsRuntime {
class PcSamplingSession {
public:
PcSamplingSession() : agent(NULL), thunkId_(0){};
PcSamplingSession() : agent(NULL), thunkId_(0), active_(false){};
PcSamplingSession(core::Agent* agent, hsa_ven_amd_pcs_method_kind_t method,
hsa_ven_amd_pcs_units_t units, size_t interval, size_t latency,
size_t buffer_size, hsa_ven_amd_pcs_data_ready_callback_t data_ready_callback,
@@ -88,11 +88,15 @@ class PcsRuntime {
core::Agent* agent;
void SetThunkId(HsaPcSamplingTraceId thunkId) { thunkId_ = thunkId; }
HsaPcSamplingTraceId ThunkId() { return thunkId_; }
bool isActive() { return active_; }
void start() { active_ = true; }
void stop() { active_ = false; }
private:
HsaPcSamplingTraceId thunkId_;
bool valid_; // Whether configuration parameters are valid
bool active_; // Set to true when the session is started
bool valid_; // Whether configuration parameters are valid
size_t sample_size_;
struct client_session_data_t {
@@ -126,6 +130,9 @@ class PcsRuntime {
void* client_cb_data, hsa_ven_amd_pcs_t* handle);
hsa_status_t PcSamplingDestroy(hsa_ven_amd_pcs_t handle);
hsa_status_t PcSamplingStart(hsa_ven_amd_pcs_t handle);
hsa_status_t PcSamplingStop(hsa_ven_amd_pcs_t handle);
hsa_status_t PcSamplingFlush(hsa_ven_amd_pcs_t handle);
private:
/// @brief Initialize singleton object, must be called once.