diff --git a/LICENSE b/LICENSE index e7edd2a..a005a76 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 Ondrej Čerman +Copyright (c) 2018-2020 Ondrej Čerman Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/gui.c b/src/gui.c index 115e31a..8378286 100644 --- a/src/gui.c +++ b/src/gui.c @@ -141,7 +141,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.2\n" + const gchar *msg = "Zen Monitor 1.3\n" "Monitoring software for AMD Zen-based CPUs\n" "%s\n\n" "Created by: Ondrej Čerman"; diff --git a/src/include/zenmonitor.h b/src/include/zenmonitor.h index 21cc9fc..ff8f1a7 100644 --- a/src/include/zenmonitor.h +++ b/src/include/zenmonitor.h @@ -25,3 +25,4 @@ void sensor_init_free(SensorInit *s); gboolean check_zen(); gchar *cpu_model(); guint get_core_count(); +gboolean display_coreid; diff --git a/src/ss/msr.c b/src/ss/msr.c index 17c9530..f64c534 100644 --- a/src/ss/msr.c +++ b/src/ss/msr.c @@ -166,7 +166,7 @@ GSList* msr_get_sensors() { for (i = 0; i < cores; i++) { data = sensor_init_new(); - data->label = g_strdup_printf("Core %d Power", cpu_dev_ids[i].coreid); + data->label = g_strdup_printf("Core %d Power", display_coreid ? cpu_dev_ids[i].coreid: i); 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 637c4ec..a491c02 100644 --- a/src/ss/os.c +++ b/src/ss/os.c @@ -80,7 +80,7 @@ GSList* os_get_sensors(void) { for (i = 0; i < cores; i++) { data = sensor_init_new(); - data->label = g_strdup_printf("Core %d Frequency", cpu_dev_ids[i].coreid); + data->label = g_strdup_printf("Core %d Frequency", display_coreid ? cpu_dev_ids[i].coreid: i); data->value = &(core_freq[i]); data->min = &(core_freq_min[i]); data->max = &(core_freq_max[i]); diff --git a/src/zenmonitor.c b/src/zenmonitor.c index dbc2eec..09495c0 100644 --- a/src/zenmonitor.c +++ b/src/zenmonitor.c @@ -114,8 +114,26 @@ void sensor_init_free(SensorInit *s) { } } +gboolean display_coreid = 0; + +static GOptionEntry options[] = +{ + { "coreid", 'c', 0, G_OPTION_ARG_NONE, &display_coreid, "Display core_id instead of core index", NULL }, + { NULL } +}; + int main (int argc, char *argv[]) { - gtk_init(&argc, &argv); + GError *error = NULL; + GOptionContext *context; + + context = g_option_context_new ("- Zenmonitor display options"); + g_option_context_add_main_entries(context, options, NULL); + g_option_context_add_group(context, gtk_get_option_group (TRUE)); + if (!g_option_context_parse(context, &argc, &argv, &error)) { + g_print ("option parsing failed: %s\n", error->message); + exit (1); + } + start_gui(sensor_sources); }