30
30
31
31
#include "list.h"
32
32
33
+ #define STRINGIFY (x ) STRINGIFY_HELPER_(x)
34
+ #define STRINGIFY_HELPER_ (x ) #x
35
+
33
36
#define IS_VALID (x , y ) ((y)[(x) / CHAR_BIT] & (1 << ((x) % CHAR_BIT)))
34
37
#define SET_VALID (x , y ) ((y)[(x) / CHAR_BIT] |= (1 << ((x) % CHAR_BIT)))
35
38
#define RESET_VALID (x , y ) ((y)[(x) / CHAR_BIT] &= ~(1 << ((x) % CHAR_BIT)))
@@ -55,6 +58,9 @@ enum gpuinfo_static_info_valid {
55
58
gpuinfo_max_pcie_link_width_valid ,
56
59
gpuinfo_temperature_shutdown_threshold_valid ,
57
60
gpuinfo_temperature_slowdown_threshold_valid ,
61
+ gpuinfo_n_shared_cores_valid ,
62
+ gpuinfo_l2cache_size_valid ,
63
+ gpuinfo_n_exec_engines_valid ,
58
64
gpuinfo_static_info_count ,
59
65
};
60
66
@@ -66,6 +72,9 @@ struct gpuinfo_static_info {
66
72
unsigned max_pcie_link_width ;
67
73
unsigned temperature_shutdown_threshold ;
68
74
unsigned temperature_slowdown_threshold ;
75
+ unsigned n_shared_cores ;
76
+ unsigned l2cache_size ;
77
+ unsigned n_exec_engines ;
69
78
bool integrated_graphics ;
70
79
unsigned char valid [(gpuinfo_static_info_count + CHAR_BIT - 1 ) / CHAR_BIT ];
71
80
};
@@ -146,6 +155,8 @@ enum gpuinfo_process_info_valid {
146
155
gpuinfo_process_cpu_usage_valid ,
147
156
gpuinfo_process_cpu_memory_virt_valid ,
148
157
gpuinfo_process_cpu_memory_res_valid ,
158
+ gpuinfo_process_gpu_cycles_valid ,
159
+ gpuinfo_process_sample_delta_valid ,
149
160
gpuinfo_process_info_count
150
161
};
151
162
@@ -154,10 +165,12 @@ struct gpu_process {
154
165
pid_t pid ; // Process ID
155
166
char * cmdline ; // Process User Name
156
167
char * user_name ; // Process User Name
168
+ uint64_t sample_delta ; // Time spent between two successive samples
157
169
uint64_t gfx_engine_used ; // Time in nanoseconds this process spent using the GPU gfx
158
170
uint64_t compute_engine_used ; // Time in nanoseconds this process spent using the GPU compute
159
171
uint64_t enc_engine_used ; // Time in nanoseconds this process spent using the GPU encoder
160
172
uint64_t dec_engine_used ; // Time in nanoseconds this process spent using the GPU decoder
173
+ uint64_t gpu_cycles ; // Number of GPU cycles spent in the GPU gfx engine
161
174
unsigned gpu_usage ; // Percentage of GPU used by the process
162
175
unsigned encode_usage ; // Percentage of GPU encoder used by the process
163
176
unsigned decode_usage ; // Percentage of GPU decoder used by the process
@@ -184,6 +197,7 @@ struct gpu_vendor {
184
197
185
198
void (* populate_static_info )(struct gpu_info * gpu_info );
186
199
void (* refresh_dynamic_info )(struct gpu_info * gpu_info );
200
+ void (* refresh_utilisation_rate )(struct gpu_info * gpu_info );
187
201
188
202
void (* refresh_running_processes )(struct gpu_info * gpu_info );
189
203
char * name ;
@@ -205,6 +219,8 @@ void register_gpu_vendor(struct gpu_vendor *vendor);
205
219
206
220
bool extract_drm_fdinfo_key_value (char * buf , char * * key , char * * val );
207
221
222
+ void gpuinfo_refresh_utilisation_rate (struct gpu_info * gpu_info );
223
+
208
224
// fdinfo DRM interface names common to multiple drivers
209
225
extern const char drm_pdev [];
210
226
extern const char drm_client_id [];
0 commit comments