summaryrefslogtreecommitdiff
path: root/tools/perf/util/intel-tpebs.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/intel-tpebs.c')
-rw-r--r--tools/perf/util/intel-tpebs.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/tools/perf/util/intel-tpebs.c b/tools/perf/util/intel-tpebs.c
index a96abec0c65c..5a158395c7fa 100644
--- a/tools/perf/util/intel-tpebs.c
+++ b/tools/perf/util/intel-tpebs.c
@@ -31,6 +31,7 @@
#define PERF_DATA "-"
bool tpebs_recording;
+enum tpebs_mode tpebs_mode;
static LIST_HEAD(tpebs_results);
static pthread_t tpebs_reader_thread;
static struct child_process tpebs_cmd;
@@ -45,6 +46,8 @@ struct tpebs_retire_lat {
char *event;
/** @stats: Recorded retirement latency stats. */
struct stats stats;
+ /** @last: Last retirement latency read. */
+ uint64_t last;
/* Has the event been sent to perf record? */
bool started;
};
@@ -142,6 +145,7 @@ static int process_sample_event(const struct perf_tool *tool __maybe_unused,
* latency value will be used. Save the number of samples and the sum of
* retire latency value for each event.
*/
+ t->last = sample->retire_lat;
update_stats(&t->stats, sample->retire_lat);
mutex_unlock(tpebs_mtx_get());
return 0;
@@ -517,7 +521,21 @@ int evsel__tpebs_read(struct evsel *evsel, int cpu_map_idx, int thread)
return ret;
mutex_lock(tpebs_mtx_get());
}
- val = rint(t->stats.mean);
+ switch (tpebs_mode) {
+ case TPEBS_MODE__MIN:
+ val = rint(t->stats.min);
+ break;
+ case TPEBS_MODE__MAX:
+ val = rint(t->stats.max);
+ break;
+ case TPEBS_MODE__LAST:
+ val = t->last;
+ break;
+ default:
+ case TPEBS_MODE__MEAN:
+ val = rint(t->stats.mean);
+ break;
+ }
mutex_unlock(tpebs_mtx_get());
if (old_count) {