Prep work for adding PMU support in gputop. Cc: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx> Cc: Lucas De Marchi <lucas.demarchi@xxxxxxxxx> Cc: Kamil Konieczny <kamil.konieczny@xxxxxxxxxxxxxxx> Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@xxxxxxxxx> --- tools/gputop.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tools/gputop.c b/tools/gputop.c index 43b01f566..4e3663417 100644 --- a/tools/gputop.c +++ b/tools/gputop.c @@ -42,6 +42,34 @@ static const char *bars[] = { " ", "▏", "▎", "▍", "▌", "▋", "▊", " #define ANSI_HEADER "\033[7m" #define ANSI_RESET "\033[0m" +struct pmu_pair { + uint64_t cur; + uint64_t prev; +}; + +struct pmu_counter { + uint64_t type; + uint64_t config; + unsigned int idx; + struct pmu_pair val; + double scale; + const char *units; + bool present; +}; + +#define MAX_GTS 4 + +struct pmu_info { + char device_events_path[300]; + int pmu_fd; + struct pmu_counter req_freq[MAX_GTS]; + struct pmu_counter act_freq[MAX_GTS]; + struct pmu_counter c6[MAX_GTS]; + int num_gts; + int num_counters; + uint64_t ts_cur, ts_prev; +}; + static void n_spaces(const unsigned int n) { unsigned int i; -- 2.38.1