summaryrefslogtreecommitdiff
path: root/overlay/gpu-top.h
blob: 13b905d9dde787ae4de59be2b463bd90b84bc1de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#define MAX_RINGS 4

#include <stdint.h>

struct gpu_top {
	enum { PERF, MMIO } type;
	int fd;

	int num_rings;
	int have_wait;
	int have_sema;

	struct gpu_top_ring {
		const char *name;
		union gpu_top_payload {
			struct {
				uint8_t busy;
				uint8_t wait;
				uint8_t sema;
			} u;
			uint32_t payload;
		} u;
	} ring[MAX_RINGS];

	struct gpu_top_stat {
		uint64_t time;
		uint64_t busy[MAX_RINGS];
		uint64_t wait[MAX_RINGS];
		uint64_t sema[MAX_RINGS];
	} stat[2];
	int count;
};

void gpu_top_init(struct gpu_top *gt);
int gpu_top_update(struct gpu_top *gt);