mirror of
https://github.com/Syllo/nvtop.git
synced 2024-03-13 10:04:14 +03:00
@@ -76,6 +76,7 @@ struct gpuinfo_static_info {
|
||||
unsigned l2cache_size;
|
||||
unsigned n_exec_engines;
|
||||
bool integrated_graphics;
|
||||
bool encode_decode_shared;
|
||||
unsigned char valid[(gpuinfo_static_info_count + CHAR_BIT - 1) / CHAR_BIT];
|
||||
};
|
||||
|
||||
@@ -102,6 +103,7 @@ enum gpuinfo_dynamic_info_valid {
|
||||
gpuinfo_gpu_temp_valid,
|
||||
gpuinfo_power_draw_valid,
|
||||
gpuinfo_power_draw_max_valid,
|
||||
gpuinfo_multi_instance_mode_valid,
|
||||
gpuinfo_dynamic_info_count,
|
||||
};
|
||||
|
||||
@@ -125,7 +127,7 @@ struct gpuinfo_dynamic_info {
|
||||
unsigned int gpu_temp; // GPU temperature °celsius
|
||||
unsigned int power_draw; // Power usage in milliwatts
|
||||
unsigned int power_draw_max; // Max power usage in milliwatts
|
||||
bool encode_decode_shared; // True if encode and decode is shared (Intel)
|
||||
bool multi_instance_mode; // True if the GPU is in multi-instance mode
|
||||
unsigned char valid[(gpuinfo_dynamic_info_count + CHAR_BIT - 1) / CHAR_BIT];
|
||||
};
|
||||
|
||||
|
||||
@@ -513,6 +513,7 @@ static void gpuinfo_amdgpu_populate_static_info(struct gpu_info *_gpu_info) {
|
||||
const char *name = NULL;
|
||||
|
||||
static_info->integrated_graphics = false;
|
||||
static_info->encode_decode_shared = false;
|
||||
RESET_ALL(static_info->valid);
|
||||
|
||||
if (libdrm_amdgpu_handle && _amdgpu_get_marketing_name)
|
||||
@@ -585,6 +586,7 @@ static void gpuinfo_amdgpu_populate_static_info(struct gpu_info *_gpu_info) {
|
||||
#ifdef AMDGPU_FAMILY_NV
|
||||
case AMDGPU_FAMILY_NV:
|
||||
strncpy(dst, " (Navi10)", remaining_len);
|
||||
static_info->encode_decode_shared = true;
|
||||
break;
|
||||
#endif
|
||||
#ifdef AMDGPU_FAMILY_VGH
|
||||
@@ -646,7 +648,6 @@ static void gpuinfo_amdgpu_refresh_dynamic_info(struct gpu_info *_gpu_info) {
|
||||
uint32_t out32;
|
||||
|
||||
RESET_ALL(dynamic_info->valid);
|
||||
dynamic_info->encode_decode_shared = false;
|
||||
|
||||
if (libdrm_amdgpu_handle && _amdgpu_query_gpu_info)
|
||||
info_query_success = !_amdgpu_query_gpu_info(gpu_info->amdgpu_device, &info);
|
||||
|
||||
@@ -115,6 +115,7 @@ static void gpuinfo_apple_populate_static_info(struct gpu_info *_gpu_info) {
|
||||
SET_VALID(gpuinfo_device_name_valid, static_info->valid);
|
||||
|
||||
static_info->integrated_graphics = [gpu_info->device location] == MTLDeviceLocationBuiltIn;
|
||||
static_info->encode_decode_shared = true;
|
||||
}
|
||||
|
||||
static void gpuinfo_apple_refresh_dynamic_info(struct gpu_info *_gpu_info) {
|
||||
|
||||
@@ -147,6 +147,7 @@ static void gpuinfo_ascend_populate_static_info(struct gpu_info *_gpu_info) {
|
||||
struct gpu_info_ascend *gpu_info = container_of(_gpu_info, struct gpu_info_ascend, base);
|
||||
struct gpuinfo_static_info *static_info = &gpu_info->base.static_info;
|
||||
static_info->integrated_graphics = false;
|
||||
static_info->encode_decode_shared = true;
|
||||
RESET_ALL(static_info->valid);
|
||||
|
||||
int card_id, device_id;
|
||||
@@ -168,7 +169,6 @@ static void gpuinfo_ascend_refresh_dynamic_info(struct gpu_info *_gpu_info) {
|
||||
struct gpu_info_ascend *gpu_info = container_of(_gpu_info, struct gpu_info_ascend, base);
|
||||
struct gpuinfo_dynamic_info *dynamic_info = &gpu_info->base.dynamic_info;
|
||||
RESET_ALL(dynamic_info->valid);
|
||||
dynamic_info->encode_decode_shared = false;
|
||||
|
||||
int card_id, device_id;
|
||||
_decode_card_device_id_from_pdev(_gpu_info->pdev, &card_id, &device_id);
|
||||
|
||||
@@ -315,6 +315,7 @@ void gpuinfo_intel_populate_static_info(struct gpu_info *_gpu_info) {
|
||||
const char *dev_name;
|
||||
|
||||
static_info->integrated_graphics = false;
|
||||
static_info->encode_decode_shared = true;
|
||||
RESET_ALL(static_info->valid);
|
||||
|
||||
if (nvtop_device_get_property_value(gpu_info->driver_device, "ID_MODEL_FROM_DATABASE", &dev_name) >= 0) {
|
||||
@@ -348,7 +349,6 @@ void gpuinfo_intel_refresh_dynamic_info(struct gpu_info *_gpu_info) {
|
||||
struct gpuinfo_dynamic_info *dynamic_info = &gpu_info->base.dynamic_info;
|
||||
|
||||
RESET_ALL(dynamic_info->valid);
|
||||
dynamic_info->encode_decode_shared = true;
|
||||
|
||||
nvtop_device *card_dev_copy;
|
||||
const char *syspath;
|
||||
|
||||
@@ -318,7 +318,6 @@ void mali_common_refresh_dynamic_info(struct gpuinfo_dynamic_info *dynamic_info,
|
||||
const char *meminfo_available)
|
||||
{
|
||||
RESET_ALL(dynamic_info->valid);
|
||||
dynamic_info->encode_decode_shared = true;
|
||||
|
||||
rewind(state->meminfo_file);
|
||||
fflush(state->meminfo_file);
|
||||
|
||||
@@ -466,6 +466,7 @@ void gpuinfo_msm_populate_static_info(struct gpu_info *_gpu_info) {
|
||||
struct gpuinfo_static_info *static_info = &gpu_info->base.static_info;
|
||||
|
||||
static_info->integrated_graphics = true;
|
||||
static_info->encode_decode_shared = true;
|
||||
RESET_ALL(static_info->valid);
|
||||
|
||||
uint64_t gpuid;
|
||||
@@ -496,7 +497,6 @@ void gpuinfo_msm_refresh_dynamic_info(struct gpu_info *_gpu_info) {
|
||||
struct gpuinfo_dynamic_info *dynamic_info = &gpu_info->base.dynamic_info;
|
||||
|
||||
RESET_ALL(dynamic_info->valid);
|
||||
dynamic_info->encode_decode_shared = true;
|
||||
|
||||
// GPU clock
|
||||
uint64_t clock_val;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2021 Maxime Schmitt <maxime.schmitt91@gmail.com>
|
||||
* Copyright (C) 2021-2024 Maxime Schmitt <maxime.schmitt91@gmail.com>
|
||||
*
|
||||
* This file is part of Nvtop.
|
||||
*
|
||||
@@ -420,6 +420,7 @@ static void gpuinfo_nvidia_populate_static_info(struct gpu_info *_gpu_info) {
|
||||
nvmlDevice_t device = gpu_info->gpuhandle;
|
||||
|
||||
static_info->integrated_graphics = false;
|
||||
static_info->encode_decode_shared = false;
|
||||
RESET_ALL(static_info->valid);
|
||||
|
||||
last_nvml_return_status = nvmlDeviceGetName(device, static_info->device_name, MAX_DEVICE_NAME);
|
||||
@@ -457,7 +458,6 @@ static void gpuinfo_nvidia_refresh_dynamic_info(struct gpu_info *_gpu_info) {
|
||||
nvmlClockType_t getMaxClockFrom = NVML_CLOCK_GRAPHICS;
|
||||
|
||||
RESET_ALL(dynamic_info->valid);
|
||||
dynamic_info->encode_decode_shared = false;
|
||||
|
||||
// GPU current speed
|
||||
// Maximum between SM and Graphical
|
||||
|
||||
@@ -210,6 +210,7 @@ void gpuinfo_panfrost_populate_static_info(struct gpu_info *_gpu_info) {
|
||||
struct gpuinfo_static_info *static_info = &gpu_info->base.static_info;
|
||||
|
||||
static_info->integrated_graphics = true;
|
||||
static_info->encode_decode_shared = true;
|
||||
RESET_ALL(static_info->valid);
|
||||
|
||||
uint64_t gpuid;
|
||||
|
||||
@@ -122,6 +122,7 @@ void gpuinfo_panthor_populate_static_info(struct gpu_info *_gpu_info) {
|
||||
}
|
||||
|
||||
static_info->integrated_graphics = true;
|
||||
static_info->encode_decode_shared = true;
|
||||
RESET_ALL(static_info->valid);
|
||||
|
||||
struct drm_panthor_gpu_info gpu_dev_info = {0};
|
||||
|
||||
@@ -641,7 +641,7 @@ static void draw_devices(struct list_head *devices, struct nvtop_interface *inte
|
||||
encode_decode_show_select(dev, GPUINFO_DYNAMIC_FIELD_VALID(&device->dynamic_info, encoder_rate),
|
||||
GPUINFO_DYNAMIC_FIELD_VALID(&device->dynamic_info, decoder_rate),
|
||||
device->dynamic_info.encoder_rate, device->dynamic_info.decoder_rate,
|
||||
interface->options.encode_decode_hiding_timer, device->dynamic_info.encode_decode_shared,
|
||||
interface->options.encode_decode_hiding_timer, device->static_info.encode_decode_shared,
|
||||
&display_encode, &display_decode);
|
||||
|
||||
WINDOW *gpu_util_win;
|
||||
@@ -673,7 +673,7 @@ static void draw_devices(struct list_head *devices, struct nvtop_interface *inte
|
||||
unsigned rate =
|
||||
GPUINFO_DYNAMIC_FIELD_VALID(&device->dynamic_info, decoder_rate) ? device->dynamic_info.decoder_rate : 0;
|
||||
snprintf(buff, 1024, "%u%%", rate);
|
||||
if (device->dynamic_info.encode_decode_shared)
|
||||
if (device->static_info.encode_decode_shared)
|
||||
draw_percentage_meter(decode_win, "ENC/DEC", rate, buff);
|
||||
else
|
||||
draw_percentage_meter(decode_win, "DEC", rate, buff);
|
||||
@@ -727,7 +727,7 @@ static void draw_devices(struct list_head *devices, struct nvtop_interface *inte
|
||||
mvwprintw(dev->fan_speed, 0, 0, "CPU-FAN ");
|
||||
mvwchgat(dev->fan_speed, 0, 3, 5, 0, cyan_color, NULL);
|
||||
} else
|
||||
mvwprintw(dev->fan_speed, 0, 0, "FAN N/A%%");
|
||||
mvwprintw(dev->fan_speed, 0, 0, "FAN N/A ");
|
||||
mvwchgat(dev->fan_speed, 0, 0, 3, 0, cyan_color, NULL);
|
||||
wnoutrefresh(dev->fan_speed);
|
||||
|
||||
@@ -1246,24 +1246,30 @@ static void print_processes_on_screen(all_processes all_procs, struct process_wi
|
||||
unsigned gpu_usage = 0;
|
||||
if (GPUINFO_PROCESS_FIELD_VALID(processes[i].process, gpu_usage)) {
|
||||
gpu_usage = processes[i].process->gpu_usage;
|
||||
printed += snprintf(&process_print_buffer[printed], process_buffer_line_size - printed, "%3u%% ", gpu_usage);
|
||||
} else {
|
||||
printed += snprintf(&process_print_buffer[printed], process_buffer_line_size - printed, "N/A ");
|
||||
}
|
||||
printed += snprintf(&process_print_buffer[printed], process_buffer_line_size - printed, "%3u%% ", gpu_usage);
|
||||
}
|
||||
|
||||
if (process_is_field_displayed(process_enc_rate, fields_to_display)) {
|
||||
unsigned encoder_rate = 0;
|
||||
if (GPUINFO_PROCESS_FIELD_VALID(processes[i].process, encode_usage)) {
|
||||
encoder_rate = processes[i].process->encode_usage;
|
||||
printed += snprintf(&process_print_buffer[printed], process_buffer_line_size - printed, "%3u%% ", encoder_rate);
|
||||
} else {
|
||||
printed += snprintf(&process_print_buffer[printed], process_buffer_line_size - printed, "N/A ");
|
||||
}
|
||||
printed += snprintf(&process_print_buffer[printed], process_buffer_line_size - printed, "%3u%% ", encoder_rate);
|
||||
}
|
||||
|
||||
if (process_is_field_displayed(process_dec_rate, fields_to_display)) {
|
||||
unsigned decode_rate = 0;
|
||||
if (GPUINFO_PROCESS_FIELD_VALID(processes[i].process, decode_usage)) {
|
||||
decode_rate = processes[i].process->decode_usage;
|
||||
printed += snprintf(&process_print_buffer[printed], process_buffer_line_size - printed, "%3u%% ", decode_rate);
|
||||
} else {
|
||||
printed += snprintf(&process_print_buffer[printed], process_buffer_line_size - printed, "N/A ");
|
||||
}
|
||||
printed += snprintf(&process_print_buffer[printed], process_buffer_line_size - printed, "%3u%% ", decode_rate);
|
||||
}
|
||||
|
||||
if (process_is_field_displayed(process_memory, fields_to_display)) {
|
||||
@@ -1277,7 +1283,7 @@ static void print_processes_on_screen(all_processes all_procs, struct process_wi
|
||||
(unsigned)(processes[i].process->gpu_memory_usage / 1048576));
|
||||
}
|
||||
} else {
|
||||
memory[0] = '\0';
|
||||
snprintf(memory, sizeof_process_field[process_memory], "%s", "N/A");
|
||||
}
|
||||
printed += snprintf(&process_print_buffer[printed], process_buffer_line_size - printed, "%*s ",
|
||||
sizeof_process_field[process_memory], memory);
|
||||
|
||||
Reference in New Issue
Block a user