Adjust event counters to report only new events

Previously, RSMI assumed that the event counter values returned
from perf were only new events. But in fact, when we read the
counter values, they are running totals. To account for this, we
now record the value we read and take the difference between the
current value and the previously recorded value.

Change-Id: I1e04b514e89c7c4d4719889f2dae3a1283864e7f


[ROCm/rocm_smi_lib commit: ce475b009c]
Dieser Commit ist enthalten in:
Chris Freehill
2021-02-24 11:02:17 -06:00
Ursprung 37e617e0c8
Commit 0bf5eb21a5
2 geänderte Dateien mit 4 neuen und 3 gelöschten Zeilen
@@ -110,7 +110,7 @@ class Event {
uint32_t dev_ind_;
int32_t fd_;
perf_event_attr attr_;
uint64_t prev_cntr_val_;
int32_t get_event_file_info(void);
int32_t get_event_type(uint32_t *ev_type);
};