Update XGMI perf counter test to show utilization

Also:
* When destroying a counter, make sure to stop the counter first
* In the test, do not stop (disable) the counter before
  reading it.
* Clean up some whitespace in other tests
* Re-add manual pdf file

Change-Id: I0786ef3a994ca568299c77e44f092af8943ac33d
This commit is contained in:
Chris Freehill committed 2020-06-10 12:49:49 -04:00
1 parent 8cf44548c0
commit f946ea37ef
9 files changed
+227 -103

No files matched your search

+11 -2
View File
@@ -566,7 +566,7 @@ rsmi_init(uint64_t flags) {
smi.Initialize(flags);
} catch(...) {
smi.Cleanup();
throw;
throw amd::smi::rsmi_exception(RSMI_STATUS_INIT_ERROR, __FUNCTION__);
}
}
refGuard.Dismiss();
@@ -2663,14 +2663,17 @@ rsmi_dev_counter_destroy(rsmi_event_handle_t evnt_handle) {
return RSMI_STATUS_INVALID_ARGS;
}
uint32_t ret = 0;
amd::smi::evt::Event *evt =
reinterpret_cast<amd::smi::evt::Event *>(evnt_handle);
uint32_t dv_ind = evt->dev_ind();
DEVICE_MUTEX
REQUIRE_ROOT_ACCESS
ret = evt->stopCounter();
delete evt;
return RSMI_STATUS_SUCCESS;
return errno_to_rsmi_status(ret);;
CATCH
}
@@ -2730,6 +2733,12 @@ rsmi_counter_read(rsmi_event_handle_t evt_handle,
ret = evt->getValue(value);
// If value > 2^48, then an overflow has occurred. We need to discard this
// value and re-read:
if (ret == 0 && value->value > 0xFFFFFFFFFFFF) {
ret = evt->getValue(value);
}
return errno_to_rsmi_status(ret);
CATCH
}
+1
View File
@@ -315,6 +315,7 @@ amd::smi::evt::Event::openPerfHandle(void) {
attr_.size = sizeof(struct perf_event_attr);
attr_.config = get_perf_attr_config(&event_info_);
attr_.sample_type = PERF_SAMPLE_IDENTIFIER;
attr_.read_format = PERF_FORMAT_TOTAL_TIME_ENABLED |
PERF_FORMAT_TOTAL_TIME_RUNNING;
attr_.disabled = 1;