[PATCH i-g-t v2 1/4] tools/gputop: Define data structs for PMU stats

Vinay Belgaumkar vinay.belgaumkar at intel.com
Fri Dec 20 00:37:31 UTC 2024


Prep work for adding PMU support in gputop.

Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
Cc: Lucas De Marchi <lucas.demarchi at intel.com>
Cc: Kamil Konieczny <kamil.konieczny at linux.intel.com>
Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar at intel.com>
---
 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



More information about the igt-dev mailing list