File: xe_gputop.h

package info (click to toggle)
intel-gpu-tools 2.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 63,360 kB
  • sloc: xml: 781,458; ansic: 360,567; python: 8,336; yacc: 2,781; perl: 1,196; sh: 1,177; lex: 487; asm: 227; lisp: 35; makefile: 30
file content (59 lines) | stat: -rw-r--r-- 1,253 bytes parent folder | download
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* SPDX-License-Identifier: MIT */
/*
 * Copyright © 2025 Intel Corporation
 */

#ifndef __XE_GPUTOP_H__
#define __XE_GPUTOP_H__

#include <dirent.h>

#include "igt_device_scan.h"
#include "igt_perf.h"
#include "utils.h"
#include "xe/xe_query.h"

struct xe_pmu_pair {
	uint64_t cur;
	uint64_t prev;
};

struct xe_pmu_counter {
	uint64_t type;
	uint64_t config;
	unsigned int idx;
	struct xe_pmu_pair val;
	int fd;
	bool present;
};

struct xe_engine {
	const char *name;
	char *display_name;
	struct drm_xe_engine_class_instance drm_xe_engine;
	unsigned int num_counters;
	struct xe_pmu_counter engine_active_ticks;
	struct xe_pmu_counter engine_total_ticks;
};

struct xe_pmu_device {
	unsigned int num_engines;
	unsigned int num_counters;
	int fd;
	char *device;
	struct xe_engine engine;
};

struct xe_gputop {
	struct igt_device_card *card;
	struct xe_pmu_device *pmu_device_obj;
};

void xe_gputop_init(void *ptr, int index, struct igt_device_card *card);
void *xe_populate_engines(const void *obj, int index);
int xe_pmu_init(const void *obj, int index);
void xe_pmu_sample(const void *obj, int index);
int xe_print_engines(const void *obj, int index, int lines, int w, int h);
void xe_clean_up(void *obj, int len);

#endif /* __XE_GPUTOP_H__ */