Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intel additional HWMON (Fan + Temp) & i915 process memory usage #331

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/extract_gpuinfo_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ static const char i915_drm_intel_render[] = "drm-engine-render";
static const char i915_drm_intel_copy[] = "drm-engine-copy";
static const char i915_drm_intel_video[] = "drm-engine-video";
static const char i915_drm_intel_video_enhance[] = "drm-engine-video-enhance";
static const char i915_drm_intel_vram[] = "drm-total-local0";

static const char xe_drm_intel_vram[] = "drm-total-vram0";

Expand Down Expand Up @@ -159,7 +160,7 @@ static bool parse_drm_fdinfo_intel(struct gpu_info *info, FILE *fdinfo_file, str
bool is_video = !strcmp(key, i915_drm_intel_video);
bool is_video_enhance = !strcmp(key, i915_drm_intel_video_enhance);

if (strcmp(key, xe_drm_intel_vram)) {
if (!strcmp(key, i915_drm_intel_vram) || !strcmp(key, xe_drm_intel_vram)) {
// TODO: do we count "gtt mem" too?
unsigned long mem_int;
char *endptr;
Expand Down Expand Up @@ -420,6 +421,18 @@ void gpuinfo_intel_refresh_dynamic_info(struct gpu_info *_gpu_info) {
unsigned val = strtoul(hwmon_power_max, NULL, 10);
SET_GPUINFO_DYNAMIC(dynamic_info, power_draw_max, val / 1000);
}
const char *hwmon_fan;
// maxFanValue is just a guess, there is no way to get the max fan speed from hwmon
const unsigned maxFanValue = 4000/100;
if (nvtop_device_get_sysattr_value(hwmon_dev_noncached, "fan1_input", &hwmon_fan) >= 0) {
unsigned val = strtoul(hwmon_fan, NULL, 10);
SET_GPUINFO_DYNAMIC(dynamic_info, fan_speed, val / maxFanValue);
}
const char *hwmon_temp;
if (nvtop_device_get_sysattr_value(hwmon_dev_noncached, "temp1_input", &hwmon_temp) >= 0) {
unsigned val = strtoul(hwmon_temp, NULL, 10);
SET_GPUINFO_DYNAMIC(dynamic_info, gpu_temp, val / 1000);
}
}

// Let the temporary devices be garbage collected
Expand Down
16 changes: 10 additions & 6 deletions src/info_messages_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,15 @@ static int get_linux_kernel_release(unsigned *major, unsigned *minor, unsigned *
return nmatch != 3;
}

static char *allMessages[] = {
enum messages {
AMD_GPU_514,
INTEL_GPU_519,
MSM_GPU,
};

static const char *allMessages[] = {
"Nvtop won't be able to show AMD GPU processes on your kernel version (requires Linux >= 5.14)",
"Nvtop won't be able to show Intel GPU utilization and processes on your kernel version (requires Linux >= 5.19)",
"This version of Nvtop does not yet support reporting all data for Intel GPUs, such as memory, power, fan and temperature information",
"This version of Nvtop does not yet support reporting all data for MSM GPUs, such as power, fan and temperature information",
};
static const char *message_array[sizeof(allMessages) / sizeof(*allMessages)];
Expand Down Expand Up @@ -69,16 +74,15 @@ void get_info_messages(struct list_head *devices, unsigned *num_messages, const
}
if (hasAMD) {
if (linux_major < 5 || (linux_major == 5 && linux_minor < 14)) {
message_array[(*num_messages)++] = allMessages[0];
message_array[(*num_messages)++] = allMessages[AMD_GPU_514];
}
}
if (hasIntel) {
if (linux_major < 5 || (linux_major == 5 && linux_minor < 19)) {
message_array[(*num_messages)++] = allMessages[1];
message_array[(*num_messages)++] = allMessages[INTEL_GPU_519];
}
message_array[(*num_messages)++] = allMessages[2];
}
if (hasMSM) {
message_array[(*num_messages)++] = allMessages[3];
message_array[(*num_messages)++] = allMessages[MSM_GPU];
}
}
3 changes: 1 addition & 2 deletions src/nvtop.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,7 @@ int main(int argc, char **argv) {
allDevicesOptions.gpu_specific_opts[i].to_draw = 0;
}
}
if (hide_processes_option)
allDevicesOptions.hide_processes_list = true;
allDevicesOptions.hide_processes_list = hide_processes_option;
if (encode_decode_timer_option_set) {
allDevicesOptions.encode_decode_hiding_timer = encode_decode_hide_time;
if (allDevicesOptions.encode_decode_hiding_timer < 0.)
Expand Down