From fa17e94b30611513c7b863422a1215fcea74f369 Mon Sep 17 00:00:00 2001 From: Ondrej Čerman Date: Sun, 14 Jun 2020 23:28:09 +0200 Subject: Added tooltips for sensors Version 1.4.2 --- src/gui.c | 9 ++++++--- src/include/zenmonitor.h | 2 ++ src/ss/msr.c | 3 +++ src/ss/os.c | 1 + src/ss/zenpower.c | 38 ++++++++++++++++++++++---------------- src/zenmonitor.c | 1 + 6 files changed, 35 insertions(+), 19 deletions(-) diff --git a/src/gui.c b/src/gui.c index 5c78674..11ef4f8 100644 --- a/src/gui.c +++ b/src/gui.c @@ -12,6 +12,7 @@ static const guint defaultHeight = 350; enum { COLUMN_NAME, + COLUMN_HINT, COLUMN_VALUE, COLUMN_MIN, COLUMN_MAX, @@ -39,6 +40,7 @@ static void init_sensors() { gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, COLUMN_NAME, data->label, + COLUMN_HINT, data->hint, COLUMN_VALUE, " --- ", COLUMN_MIN, " --- ", COLUMN_MAX, " --- ", @@ -53,7 +55,7 @@ static void init_sensors() { static GtkTreeModel* create_model (void) { GtkListStore *store; - store = gtk_list_store_new (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); + store = gtk_list_store_new (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); return GTK_TREE_MODEL (store); } @@ -142,7 +144,7 @@ static void add_columns (GtkTreeView *treeview) { static void about_btn_clicked(GtkButton *button, gpointer user_data) { GtkWidget *dialog; const gchar *website = "https://github.com/ocerman/zenmonitor"; - const gchar *msg = "Zen Monitor 1.4.1\n" + const gchar *msg = "Zen Monitor %s\n" "Monitoring software for AMD Zen-based CPUs\n" "%s\n\n" "Created by: Ondrej Čerman"; @@ -150,7 +152,7 @@ static void about_btn_clicked(GtkButton *button, gpointer user_data) { dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW (window), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, - msg, website, website); + msg, VERSION, website, website); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); @@ -251,6 +253,7 @@ int start_gui (SensorSource *ss) { model = create_model(); treeview = gtk_tree_view_new_with_model(model); + gtk_tree_view_set_tooltip_column(GTK_TREE_VIEW(treeview), COLUMN_HINT); gtk_container_add (GTK_CONTAINER(sw), treeview); add_columns(GTK_TREE_VIEW(treeview)); diff --git a/src/include/zenmonitor.h b/src/include/zenmonitor.h index 399d702..43a6e3f 100644 --- a/src/include/zenmonitor.h +++ b/src/include/zenmonitor.h @@ -1,8 +1,10 @@ #define ERROR_VALUE -999.0 +#define VERSION "1.4.2" typedef struct { gchar *label; + gchar *hint; float *value; float *min; float *max; diff --git a/src/ss/msr.c b/src/ss/msr.c index bb4361c..258d46c 100644 --- a/src/ss/msr.c +++ b/src/ss/msr.c @@ -202,6 +202,7 @@ GSList* msr_get_sensors() { data = sensor_init_new(); data->label = g_strdup("Package Power"); + data->hint = g_strdup("Package Power reported by RAPL\nSource: cpu0 MSR"); data->value = &package_power; data->min = &package_power_min; data->max = &package_power_max; @@ -211,6 +212,7 @@ GSList* msr_get_sensors() { for (i = 0; i < cores; i++) { data = sensor_init_new(); data->label = g_strdup_printf("Core %d Effective Frequency", display_coreid ? cpu_dev_ids[i].coreid: i); + data->hint = g_strdup_printf("Source: cpu%d MSR", cpu_dev_ids[i].cpuid); data->value = &(core_fid[i]); data->min = &(core_fid_min[i]); data->max = &(core_fid_max[i]); @@ -221,6 +223,7 @@ GSList* msr_get_sensors() { for (i = 0; i < cores; i++) { data = sensor_init_new(); data->label = g_strdup_printf("Core %d Power", display_coreid ? cpu_dev_ids[i].coreid: i); + data->hint = g_strdup_printf("Core Power reported by RAPL\nSource: cpu%d MSR", cpu_dev_ids[i].cpuid); data->value = &(core_power[i]); data->min = &(core_power_min[i]); data->max = &(core_power_max[i]); diff --git a/src/ss/os.c b/src/ss/os.c index 8543c5f..c2beb04 100644 --- a/src/ss/os.c +++ b/src/ss/os.c @@ -86,6 +86,7 @@ GSList* os_get_sensors(void) { for (i = 0; i < cores; i++) { data = sensor_init_new(); data->label = g_strdup_printf("Core %d Frequency", display_coreid ? cpu_dev_ids[i].coreid: i); + data->hint = g_strdup_printf("Current frequency of the CPU as determined by the governor and cpufreq core.\n Source: %s", frq_files[i]); data->value = &(core_freq[i]); data->min = &(core_freq_min[i]); data->max = &(core_freq_max[i]); diff --git a/src/ss/zenpower.c b/src/ss/zenpower.c index 56c686d..2bf762b 100644 --- a/src/ss/zenpower.c +++ b/src/ss/zenpower.c @@ -10,6 +10,7 @@ static int nodes = 0; typedef struct { const gchar *label; + const gchar *hint; const gchar *file; const gchar *printf_format; const double adjust_ratio; @@ -26,22 +27,26 @@ typedef struct } HwmonSensor; static HwmonSensorType hwmon_stype[] = { - {"CPU Temperature (tCtl)", "temp1_input", " %6.2f°C", 1000.0}, - {"CPU Temperature (tDie)", "temp2_input", " %6.2f°C", 1000.0}, - {"CCD1 Temperature", "temp3_input", " %6.2f°C", 1000.0}, - {"CCD2 Temperature", "temp4_input", " %6.2f°C", 1000.0}, - {"CCD3 Temperature", "temp5_input", " %6.2f°C", 1000.0}, - {"CCD4 Temperature", "temp6_input", " %6.2f°C", 1000.0}, - {"CCD5 Temperature", "temp7_input", " %6.2f°C", 1000.0}, - {"CCD6 Temperature", "temp8_input", " %6.2f°C", 1000.0}, - {"CCD7 Temperature", "temp9_input", " %6.2f°C", 1000.0}, - {"CCD8 Temperature", "temp10_input", " %6.2f°C", 1000.0}, - {"CPU Core Voltage (SVI2)", "in1_input", " %8.3f V", 1000.0}, - {"SOC Voltage (SVI2)", "in2_input", " %8.3f V", 1000.0}, - {"CPU Core Current (SVI2)", "curr1_input", " %8.3f A", 1000.0}, - {"SOC Current (SVI2)", "curr2_input", " %8.3f A", 1000.0}, - {"CPU Core Power (SVI2)", "power1_input", " %8.3f W", 1000000.0}, - {"SOC Power (SVI2)", "power2_input", " %8.3f W", 1000000.0}, + {"CPU Temperature (tCtl)", "Reported CPU Temperature", "temp1_input", " %6.2f°C", 1000.0}, + {"CPU Temperature (tDie)", "Reported CPU Temperature - offset", "temp2_input", " %6.2f°C", 1000.0}, + {"CCD1 Temperature", "Core Complex Die 1 Temperature", "temp3_input", " %6.2f°C", 1000.0}, + {"CCD2 Temperature", "Core Complex Die 2 Temperature", "temp4_input", " %6.2f°C", 1000.0}, + {"CCD3 Temperature", "Core Complex Die 3 Temperature", "temp5_input", " %6.2f°C", 1000.0}, + {"CCD4 Temperature", "Core Complex Die 4 Temperature", "temp6_input", " %6.2f°C", 1000.0}, + {"CCD5 Temperature", "Core Complex Die 5 Temperature", "temp7_input", " %6.2f°C", 1000.0}, + {"CCD6 Temperature", "Core Complex Die 6 Temperature", "temp8_input", " %6.2f°C", 1000.0}, + {"CCD7 Temperature", "Core Complex Die 7 Temperature", "temp9_input", " %6.2f°C", 1000.0}, + {"CCD8 Temperature", "Core Complex Die 8 Temperature", "temp10_input", " %6.2f°C", 1000.0}, + {"CPU Core Voltage (SVI2)", "Core Voltage reported by SVI2 telemetry", "in1_input", " %8.3f V", 1000.0}, + {"SOC Voltage (SVI2)", "SOC Voltage reported by SVI2 telemetry", "in2_input", " %8.3f V", 1000.0}, + {"CPU Core Current (SVI2)", "Core Current reported by SVI2 telemetry\n" + "Note: May not be accurate on some systems", "curr1_input", " %8.3f A", 1000.0}, + {"SOC Current (SVI2)", "SOC Current reported by SVI2 telemetry\n" + "Note: May not be accurate on some systems", "curr2_input", " %8.3f A", 1000.0}, + {"CPU Core Power (SVI2)", "Core Voltage * Current\n" + "Note: May not be accurate on some systems", "power1_input", " %8.3f W", 1000000.0}, + {"SOC Power (SVI2)", "Core Voltage * Current\n" + "Note: May not be accurate on some systems", "power2_input", " %8.3f W", 1000000.0}, {0, NULL} }; @@ -165,6 +170,7 @@ GSList* zenpower_get_sensors() { else{ data->label = g_strdup(sensor->type->label); } + data->hint = g_strdup_printf("%s\nSource: zenpower %s/%s", sensor->type->hint, sensor->hwmon_dir, sensor->type->file); data->value = &sensor->current_value; data->min = &sensor->min; data->max = &sensor->max; diff --git a/src/zenmonitor.c b/src/zenmonitor.c index 28b74a4..d02c510 100644 --- a/src/zenmonitor.c +++ b/src/zenmonitor.c @@ -111,6 +111,7 @@ SensorInit *sensor_init_new() { void sensor_init_free(SensorInit *s) { if (s) { g_free(s->label); + g_free(s->hint); g_free(s); } } -- cgit v1.2.3-70-g09d2