diff mbox series

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

Message ID 20241220003734.69174-2-vinay.belgaumkar@intel.com (mailing list archive)
State New
Headers show
Series tools/gputop: Add PMU stats | expand

Commit Message

Vinay Belgaumkar Dec. 20, 2024, 12:37 a.m. UTC
Prep work for adding PMU support in gputop.

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
---
 tools/gputop.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
diff mbox series

Patch

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;