753 lines
30 KiB
Diff
753 lines
30 KiB
Diff
commit 9da203a35c72d7212d99512b735730267200e810
|
|
Author: rbuj <robert.buj@gmail.com>
|
|
Date: Thu Feb 13 14:41:26 2020 +0100
|
|
|
|
Remove the CPU wakeups feature
|
|
https://github.com/mate-desktop/mate-power-manager/commit/9da203a35c72d7212d99512b735730267200e810
|
|
|
|
---
|
|
data/gpm-statistics.ui | 111 ++----------
|
|
src/gpm-statistics.c | 378 +----------------------------------------
|
|
2 files changed, 21 insertions(+), 468 deletions(-)
|
|
|
|
diff --git a/data/gpm-statistics.ui b/data/gpm-statistics.ui
|
|
index e15360e..3bb48cf 100644
|
|
--- a/data/gpm-statistics.ui
|
|
+++ b/data/gpm-statistics.ui
|
|
@@ -1,12 +1,16 @@
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
+<!-- Generated with glade 3.22.1 -->
|
|
<interface>
|
|
- <requires lib="gtk+" version="2.16"/>
|
|
+ <requires lib="gtk+" version="3.0"/>
|
|
<object class="GtkDialog" id="dialog_stats">
|
|
<property name="can_focus">False</property>
|
|
<property name="border_width">6</property>
|
|
<property name="title" translatable="yes">Power Statistics</property>
|
|
<property name="window_position">center-on-parent</property>
|
|
<property name="type_hint">dialog</property>
|
|
+ <child>
|
|
+ <placeholder/>
|
|
+ </child>
|
|
<child internal-child="vbox">
|
|
<object class="GtkBox" id="dialog-vbox1">
|
|
<property name="visible">True</property>
|
|
@@ -21,11 +25,11 @@
|
|
<child>
|
|
<object class="GtkButton" id="button_help">
|
|
<property name="label">gtk-help</property>
|
|
+ <property name="use_action_appearance">False</property>
|
|
<property name="visible">True</property>
|
|
<property name="can_focus">True</property>
|
|
<property name="can_default">True</property>
|
|
<property name="receives_default">False</property>
|
|
- <property name="use_action_appearance">False</property>
|
|
<property name="use_stock">True</property>
|
|
</object>
|
|
<packing>
|
|
@@ -38,11 +42,11 @@
|
|
<child>
|
|
<object class="GtkButton" id="button_close">
|
|
<property name="label">gtk-close</property>
|
|
+ <property name="use_action_appearance">False</property>
|
|
<property name="visible">True</property>
|
|
<property name="can_focus">True</property>
|
|
<property name="can_default">True</property>
|
|
<property name="receives_default">False</property>
|
|
- <property name="use_action_appearance">False</property>
|
|
<property name="use_stock">True</property>
|
|
</object>
|
|
<packing>
|
|
@@ -52,6 +56,11 @@
|
|
</packing>
|
|
</child>
|
|
</object>
|
|
+ <packing>
|
|
+ <property name="expand">False</property>
|
|
+ <property name="fill">False</property>
|
|
+ <property name="position">0</property>
|
|
+ </packing>
|
|
</child>
|
|
<child>
|
|
<object class="GtkHBox" id="hbox1">
|
|
@@ -64,7 +73,6 @@
|
|
<property name="visible">True</property>
|
|
<property name="can_focus">True</property>
|
|
<property name="hscrollbar_policy">never</property>
|
|
- <property name="vscrollbar_policy">automatic</property>
|
|
<property name="shadow_type">in</property>
|
|
<child>
|
|
<object class="GtkTreeView" id="treeview_devices">
|
|
@@ -92,8 +100,6 @@
|
|
<property name="visible">True</property>
|
|
<property name="can_focus">True</property>
|
|
<property name="border_width">9</property>
|
|
- <property name="hscrollbar_policy">automatic</property>
|
|
- <property name="vscrollbar_policy">automatic</property>
|
|
<property name="shadow_type">in</property>
|
|
<child>
|
|
<object class="GtkTreeView" id="treeview_info">
|
|
@@ -140,6 +146,7 @@
|
|
</object>
|
|
<packing>
|
|
<property name="expand">False</property>
|
|
+ <property name="fill">True</property>
|
|
<property name="position">0</property>
|
|
</packing>
|
|
</child>
|
|
@@ -147,7 +154,6 @@
|
|
<object class="GtkComboBoxText" id="combobox_history_type">
|
|
<property name="visible">True</property>
|
|
<property name="can_focus">False</property>
|
|
- <property name="entry_text_column">0</property>
|
|
</object>
|
|
<packing>
|
|
<property name="expand">True</property>
|
|
@@ -183,7 +189,6 @@
|
|
<object class="GtkComboBoxText" id="combobox_history_time">
|
|
<property name="visible">True</property>
|
|
<property name="can_focus">False</property>
|
|
- <property name="entry_text_column">0</property>
|
|
</object>
|
|
<packing>
|
|
<property name="expand">True</property>
|
|
@@ -274,10 +279,10 @@
|
|
<child>
|
|
<object class="GtkCheckButton" id="checkbutton_smooth_history">
|
|
<property name="label" translatable="yes">Use smoothed line</property>
|
|
+ <property name="use_action_appearance">False</property>
|
|
<property name="visible">True</property>
|
|
<property name="can_focus">True</property>
|
|
<property name="receives_default">False</property>
|
|
- <property name="use_action_appearance">False</property>
|
|
<property name="draw_indicator">True</property>
|
|
</object>
|
|
<packing>
|
|
@@ -289,10 +294,10 @@
|
|
<child>
|
|
<object class="GtkCheckButton" id="checkbutton_points_history">
|
|
<property name="label" translatable="yes">Show data points</property>
|
|
+ <property name="use_action_appearance">False</property>
|
|
<property name="visible">True</property>
|
|
<property name="can_focus">True</property>
|
|
<property name="receives_default">False</property>
|
|
- <property name="use_action_appearance">False</property>
|
|
<property name="draw_indicator">True</property>
|
|
</object>
|
|
<packing>
|
|
@@ -351,7 +356,6 @@
|
|
<object class="GtkComboBoxText" id="combobox_stats_type">
|
|
<property name="visible">True</property>
|
|
<property name="can_focus">False</property>
|
|
- <property name="entry_text_column">0</property>
|
|
</object>
|
|
<packing>
|
|
<property name="expand">True</property>
|
|
@@ -436,10 +440,10 @@
|
|
<child>
|
|
<object class="GtkCheckButton" id="checkbutton_smooth_stats">
|
|
<property name="label" translatable="yes">Use smoothed line</property>
|
|
+ <property name="use_action_appearance">False</property>
|
|
<property name="visible">True</property>
|
|
<property name="can_focus">True</property>
|
|
<property name="receives_default">False</property>
|
|
- <property name="use_action_appearance">False</property>
|
|
<property name="draw_indicator">True</property>
|
|
</object>
|
|
<packing>
|
|
@@ -451,10 +455,10 @@
|
|
<child>
|
|
<object class="GtkCheckButton" id="checkbutton_points_stats">
|
|
<property name="label" translatable="yes">Show data points</property>
|
|
+ <property name="use_action_appearance">False</property>
|
|
<property name="visible">True</property>
|
|
<property name="can_focus">True</property>
|
|
<property name="receives_default">False</property>
|
|
- <property name="use_action_appearance">False</property>
|
|
<property name="draw_indicator">True</property>
|
|
</object>
|
|
<packing>
|
|
@@ -486,87 +490,6 @@
|
|
<property name="tab_fill">False</property>
|
|
</packing>
|
|
</child>
|
|
- <child>
|
|
- <object class="GtkVBox" id="vbox1">
|
|
- <property name="visible">True</property>
|
|
- <property name="can_focus">False</property>
|
|
- <property name="border_width">9</property>
|
|
- <property name="spacing">9</property>
|
|
- <child>
|
|
- <object class="GtkHBox" id="hbox3">
|
|
- <property name="visible">True</property>
|
|
- <property name="can_focus">False</property>
|
|
- <property name="spacing">3</property>
|
|
- <child>
|
|
- <object class="GtkLabel" id="label8">
|
|
- <property name="visible">True</property>
|
|
- <property name="can_focus">False</property>
|
|
- <property name="label" translatable="yes">Processor wakeups per second:</property>
|
|
- </object>
|
|
- <packing>
|
|
- <property name="expand">False</property>
|
|
- <property name="fill">True</property>
|
|
- <property name="position">0</property>
|
|
- </packing>
|
|
- </child>
|
|
- <child>
|
|
- <object class="GtkLabel" id="label_total_wakeups">
|
|
- <property name="visible">True</property>
|
|
- <property name="can_focus">False</property>
|
|
- <property name="label" translatable="yes">0</property>
|
|
- </object>
|
|
- <packing>
|
|
- <property name="expand">False</property>
|
|
- <property name="fill">True</property>
|
|
- <property name="position">1</property>
|
|
- </packing>
|
|
- </child>
|
|
- </object>
|
|
- <packing>
|
|
- <property name="expand">False</property>
|
|
- <property name="fill">True</property>
|
|
- <property name="position">0</property>
|
|
- </packing>
|
|
- </child>
|
|
- <child>
|
|
- <object class="GtkScrolledWindow" id="scrolledwindow3">
|
|
- <property name="visible">True</property>
|
|
- <property name="can_focus">True</property>
|
|
- <property name="hscrollbar_policy">automatic</property>
|
|
- <property name="vscrollbar_policy">automatic</property>
|
|
- <property name="shadow_type">in</property>
|
|
- <child>
|
|
- <object class="GtkTreeView" id="treeview_wakeups">
|
|
- <property name="visible">True</property>
|
|
- <property name="can_focus">True</property>
|
|
- <child internal-child="selection">
|
|
- <object class="GtkTreeSelection" id="treeview-selection3"/>
|
|
- </child>
|
|
- </object>
|
|
- </child>
|
|
- </object>
|
|
- <packing>
|
|
- <property name="expand">True</property>
|
|
- <property name="fill">True</property>
|
|
- <property name="position">1</property>
|
|
- </packing>
|
|
- </child>
|
|
- </object>
|
|
- <packing>
|
|
- <property name="position">3</property>
|
|
- </packing>
|
|
- </child>
|
|
- <child type="tab">
|
|
- <object class="GtkLabel" id="label7">
|
|
- <property name="visible">True</property>
|
|
- <property name="can_focus">False</property>
|
|
- <property name="label" translatable="yes">Wakeups</property>
|
|
- </object>
|
|
- <packing>
|
|
- <property name="position">3</property>
|
|
- <property name="tab_fill">False</property>
|
|
- </packing>
|
|
- </child>
|
|
</object>
|
|
<packing>
|
|
<property name="expand">True</property>
|
|
diff --git a/src/gpm-statistics.c b/src/gpm-statistics.c
|
|
index d6bcaf1..4d26362 100644
|
|
--- a/src/gpm-statistics.c
|
|
+++ b/src/gpm-statistics.c
|
|
@@ -42,14 +42,12 @@
|
|
static GtkBuilder *builder = NULL;
|
|
static GtkListStore *list_store_info = NULL;
|
|
static GtkListStore *list_store_devices = NULL;
|
|
-static GtkListStore *list_store_wakeups = NULL;
|
|
gchar *current_device = NULL;
|
|
static const gchar *history_type;
|
|
static const gchar *stats_type;
|
|
static guint history_time;
|
|
static GSettings *settings;
|
|
static gfloat sigma_smoothing = 0.0f;
|
|
-static UpWakeups *wakeups = NULL;
|
|
static GtkWidget *graph_history = NULL;
|
|
static GtkWidget *graph_statistics = NULL;
|
|
|
|
@@ -66,15 +64,6 @@ enum {
|
|
GPM_DEVICES_COLUMN_LAST
|
|
};
|
|
|
|
-enum {
|
|
- GPM_WAKEUPS_COLUMN_ICON,
|
|
- GPM_WAKEUPS_COLUMN_ID,
|
|
- GPM_WAKEUPS_COLUMN_VALUE,
|
|
- GPM_WAKEUPS_COLUMN_CMDLINE,
|
|
- GPM_WAKEUPS_COLUMN_DETAILS,
|
|
- GPM_WAKEUPS_COLUMN_LAST
|
|
-};
|
|
-
|
|
#define GPM_HISTORY_RATE_TEXT _("Rate")
|
|
#define GPM_HISTORY_CHARGE_TEXT _("Charge")
|
|
#define GPM_HISTORY_TIME_FULL_TEXT _("Time to full")
|
|
@@ -166,51 +155,6 @@ gpm_stats_add_devices_columns (GtkTreeView *treeview)
|
|
gtk_tree_view_column_set_expand (column, TRUE);
|
|
}
|
|
|
|
-/**
|
|
- * gpm_stats_add_wakeups_columns:
|
|
- **/
|
|
-static void
|
|
-gpm_stats_add_wakeups_columns (GtkTreeView *treeview)
|
|
-{
|
|
- GtkCellRenderer *renderer;
|
|
- GtkTreeViewColumn *column;
|
|
-
|
|
- /* image */
|
|
- renderer = gtk_cell_renderer_pixbuf_new ();
|
|
- g_object_set (renderer, "stock-size", GTK_ICON_SIZE_BUTTON, NULL);
|
|
- column = gtk_tree_view_column_new_with_attributes (_("Type"), renderer,
|
|
- "icon-name", GPM_WAKEUPS_COLUMN_ICON, NULL);
|
|
- gtk_tree_view_append_column (treeview, column);
|
|
-
|
|
- /* column for id */
|
|
- renderer = gtk_cell_renderer_text_new ();
|
|
- column = gtk_tree_view_column_new_with_attributes (_("ID"), renderer,
|
|
- "markup", GPM_WAKEUPS_COLUMN_ID, NULL);
|
|
- gtk_tree_view_append_column (treeview, column);
|
|
- gtk_tree_view_column_set_expand (column, TRUE);
|
|
-
|
|
- /* column for value */
|
|
- renderer = gtk_cell_renderer_text_new ();
|
|
- column = gtk_tree_view_column_new_with_attributes (_("Wakeups"), renderer,
|
|
- "markup", GPM_WAKEUPS_COLUMN_VALUE, NULL);
|
|
- gtk_tree_view_append_column (treeview, column);
|
|
- gtk_tree_view_column_set_expand (column, TRUE);
|
|
-
|
|
- /* column for cmdline */
|
|
- renderer = gtk_cell_renderer_text_new ();
|
|
- column = gtk_tree_view_column_new_with_attributes (_("Command"), renderer,
|
|
- "markup", GPM_WAKEUPS_COLUMN_CMDLINE, NULL);
|
|
- gtk_tree_view_append_column (treeview, column);
|
|
- gtk_tree_view_column_set_expand (column, TRUE);
|
|
-
|
|
- /* column for details */
|
|
- renderer = gtk_cell_renderer_text_new ();
|
|
- column = gtk_tree_view_column_new_with_attributes (_("Details"), renderer,
|
|
- "markup", GPM_WAKEUPS_COLUMN_DETAILS, NULL);
|
|
- gtk_tree_view_append_column (treeview, column);
|
|
- gtk_tree_view_column_set_expand (column, TRUE);
|
|
-}
|
|
-
|
|
/**
|
|
* gpm_stats_add_info_data:
|
|
**/
|
|
@@ -797,280 +741,12 @@ gpm_stats_update_info_data (UpDevice *device)
|
|
else
|
|
gtk_widget_hide (page_widget);
|
|
|
|
- /* hide wakeups page */
|
|
- page_widget = gtk_notebook_get_nth_page (notebook, 3);
|
|
- gtk_widget_hide (page_widget);
|
|
-
|
|
page = gtk_notebook_get_current_page (notebook);
|
|
gpm_stats_update_info_data_page (device, page);
|
|
|
|
return;
|
|
}
|
|
|
|
-/**
|
|
- * gpm_stats_format_cmdline:
|
|
- **/
|
|
-static gchar *
|
|
-gpm_stats_format_cmdline (UpWakeupItem *item)
|
|
-{
|
|
- gchar *found;
|
|
- gchar *temp = NULL;
|
|
- gchar *cmdline;
|
|
- const gchar *temp_ptr;
|
|
-
|
|
- /* nothing */
|
|
- if (up_wakeup_item_get_cmdline (item) == NULL) {
|
|
- /* TRANSLATORS: the command line was not provided */
|
|
- temp_ptr = _("No data");
|
|
- goto out;
|
|
- }
|
|
-
|
|
- /* common kernel cmd names */
|
|
- if (g_strcmp0 (up_wakeup_item_get_cmdline (item), "insmod") == 0) {
|
|
- /* TRANSLATORS: kernel module, usually a device driver */
|
|
- temp_ptr = _("Kernel module");
|
|
- goto out;
|
|
- }
|
|
- if (g_strcmp0 (up_wakeup_item_get_cmdline (item), "modprobe") == 0) {
|
|
- /* TRANSLATORS: kernel module, usually a device driver */
|
|
- temp_ptr = _("Kernel module");
|
|
- goto out;
|
|
- }
|
|
- if (g_strcmp0 (up_wakeup_item_get_cmdline (item), "swapper") == 0) {
|
|
- /* TRANSLATORS: kernel housekeeping */
|
|
- temp_ptr = _("Kernel core");
|
|
- goto out;
|
|
- }
|
|
- if (g_strcmp0 (up_wakeup_item_get_cmdline (item), "kernel-ipi") == 0) {
|
|
- /* TRANSLATORS: interrupt between processors */
|
|
- temp_ptr = _("Interprocessor interrupt");
|
|
- goto out;
|
|
- }
|
|
- if (g_strcmp0 (up_wakeup_item_get_cmdline (item), "interrupt") == 0) {
|
|
- /* TRANSLATORS: unknown interrupt */
|
|
- temp_ptr = _("Interrupt");
|
|
- goto out;
|
|
- }
|
|
-
|
|
- /* truncate at first space or ':' */
|
|
- temp = g_strdup (up_wakeup_item_get_cmdline (item));
|
|
- found = strstr (temp, ":");
|
|
- if (found != NULL)
|
|
- *found = '\0';
|
|
- found = strstr (temp, " ");
|
|
- if (found != NULL)
|
|
- *found = '\0';
|
|
-
|
|
- /* remove path */
|
|
- found = g_strrstr (temp, "/");
|
|
- if (found != NULL && strncmp (temp, "event", 5) != 0)
|
|
- temp_ptr = found + 1;
|
|
- else
|
|
- temp_ptr = temp;
|
|
-
|
|
-out:
|
|
- /* format command line */
|
|
- if (up_wakeup_item_get_is_userspace (item))
|
|
- cmdline = g_markup_escape_text (temp_ptr, -1);
|
|
- else
|
|
- cmdline = g_markup_printf_escaped ("<i>%s</i>", temp_ptr);
|
|
- g_free (temp);
|
|
-
|
|
- /* return */
|
|
- return cmdline;
|
|
-}
|
|
-
|
|
-/**
|
|
- * gpm_stats_format_details:
|
|
- **/
|
|
-static gchar *
|
|
-gpm_stats_format_details (UpWakeupItem *item)
|
|
-{
|
|
- gchar *details;
|
|
- const gchar *data;
|
|
-
|
|
- /* get this once to avoid a load of derefs */
|
|
- data = up_wakeup_item_get_details (item);
|
|
-
|
|
- /* replace common driver names */
|
|
- if (g_strcmp0 (data, "i8042") == 0) {
|
|
- /* TRANSLATORS: the keyboard and mouse device event */
|
|
- details = g_strdup (_("PS/2 keyboard/mouse/touchpad"));
|
|
- } else if (g_strcmp0 (data, "acpi") == 0) {
|
|
- /* TRANSLATORS: ACPI, the Intel power standard on laptops and desktops */
|
|
- details = g_strdup (_("ACPI"));
|
|
- } else if (g_strcmp0 (data, "ata_piix") == 0) {
|
|
- /* TRANSLATORS: serial ATA is a new style of hard disk interface */
|
|
- details = g_strdup (_("Serial ATA"));
|
|
- } else if (g_strcmp0 (data, "libata") == 0) {
|
|
- /* TRANSLATORS: this is the old-style ATA interface */
|
|
- details = g_strdup (_("ATA host controller"));
|
|
- } else if (g_strcmp0 (data, "iwl3945") == 0 || g_strcmp0 (data, "iwlagn") == 0) {
|
|
- /* TRANSLATORS: 802.11 wireless adaptor */
|
|
- details = g_strdup (_("Intel wireless adaptor"));
|
|
-
|
|
- /* try to make the wakeup type nicer */
|
|
- } else if (g_str_has_prefix (data, "__mod_timer")) {
|
|
- /* TRANSLATORS: a timer is something that fires periodically.
|
|
- * The parameter is a process name, e.g. "firefox-bin".
|
|
- * This is shown when the timer wakes up. */
|
|
- details = g_strdup_printf (_("Timer %s"), data+12);
|
|
- } else if (g_str_has_prefix (data, "mod_timer")) {
|
|
- /* TRANSLATORS: a timer is something that fires periodically.
|
|
- * The parameter is a process name, e.g. "firefox-bin".
|
|
- * This is shown when the timer wakes up. */
|
|
- details = g_strdup_printf (_("Timer %s"), data+10);
|
|
- } else if (g_str_has_prefix (data, "hrtimer_start_expires")) {
|
|
- /* TRANSLATORS: a timer is something that fires periodically.
|
|
- * The parameter is a process name, e.g. "firefox-bin".
|
|
- * This is shown when the timer wakes up. */
|
|
- details = g_strdup_printf (_("Timer %s"), data+22);
|
|
- } else if (g_str_has_prefix (data, "hrtimer_start")) {
|
|
- /* TRANSLATORS: a timer is something that fires periodically.
|
|
- * The parameter is a process name, e.g. "firefox-bin".
|
|
- * This is shown when the timer wakes up. */
|
|
- details = g_strdup_printf (_("Timer %s"), data+14);
|
|
- } else if (g_str_has_prefix (data, "do_setitimer")) {
|
|
- /* TRANSLATORS: a timer is something that fires periodically.
|
|
- * The parameter is a process name, e.g. "firefox-bin".
|
|
- * This is shown when the timer wakes up. */
|
|
- details = g_strdup_printf (_("Timer %s"), data+10);
|
|
- } else if (g_str_has_prefix (data, "do_nanosleep")) {
|
|
- /* TRANSLATORS: the parameter is the name of task that's woken up from sleeping.
|
|
- * This is shown when the task wakes up. */
|
|
- details = g_strdup_printf (_("Sleep %s"), data+13);
|
|
- } else if (g_str_has_prefix (data, "enqueue_task_rt")) {
|
|
- /* TRANSLATORS: this is the name of a new realtime task. */
|
|
- details = g_strdup_printf (_("New task %s"), data+16);
|
|
- } else if (g_str_has_prefix (data, "futex_wait")) {
|
|
- /* TRANSLATORS: this is the name of a task that's woken to check state.
|
|
- * This is shown when the task wakes up. */
|
|
- details = g_strdup_printf (_("Wait %s"), data+11);
|
|
- } else if (g_str_has_prefix (data, "queue_delayed_work_on")) {
|
|
- /* TRANSLATORS: this is the name of a work queue.
|
|
- * A work queue is a list of work that has to be done. */
|
|
- details = g_strdup_printf (_("Work queue %s"), data+22);
|
|
- } else if (g_str_has_prefix (data, "queue_delayed_work")) {
|
|
- /* TRANSLATORS: this is the name of a work queue.
|
|
- * A work queue is a list of work that has to be done. */
|
|
- details = g_strdup_printf (_("Work queue %s"), data+19);
|
|
- } else if (g_str_has_prefix (data, "dst_run_gc")) {
|
|
- /* TRANSLATORS: this is when the networking subsystem clears out old entries */
|
|
- details = g_strdup_printf (_("Network route flush %s"), data+11);
|
|
- } else if (g_str_has_prefix (data, "usb_hcd_poll_rh_status")) {
|
|
- /* TRANSLATORS: this is the name of an activity on the USB bus */
|
|
- details = g_strdup_printf (_("USB activity %s"), data+23);
|
|
- } else if (g_str_has_prefix (data, "schedule_hrtimeout_range")) {
|
|
- /* TRANSLATORS: we've timed out of an aligned timer, with the name */
|
|
- details = g_strdup_printf (_("Wakeup %s"), data+25);
|
|
- } else if (g_str_has_prefix (data, "Local timer interrupts")) {
|
|
- /* TRANSLATORS: interupts on the system required for basic operation */
|
|
- details = g_strdup (_("Local interrupts"));
|
|
- } else if (g_str_has_prefix (data, "Rescheduling interrupts")) {
|
|
- /* TRANSLATORS: interrupts when a task gets moved from one core to another */
|
|
- details = g_strdup (_("Rescheduling interrupts"));
|
|
- } else
|
|
- details = g_markup_escape_text (data, -1);
|
|
-
|
|
- return details;
|
|
-}
|
|
-/**
|
|
- * gpm_stats_add_wakeups_item:
|
|
- **/
|
|
-static void
|
|
-gpm_stats_add_wakeups_item (UpWakeupItem *item)
|
|
-{
|
|
- const gchar *icon;
|
|
- gchar *value;
|
|
- gchar *id;
|
|
- gchar *details;
|
|
- gchar *cmdline;
|
|
- GtkTreeIter iter;
|
|
-
|
|
- if (up_wakeup_item_get_is_userspace (item)) {
|
|
- icon = "application-x-executable";
|
|
- id = g_strdup_printf ("%i", up_wakeup_item_get_id (item));
|
|
- } else {
|
|
- icon = "applications-system";
|
|
- if (up_wakeup_item_get_id (item) < 0xff0)
|
|
- id = g_strdup_printf ("IRQ%i", up_wakeup_item_get_id (item));
|
|
- else
|
|
- id = g_strdup ("IRQx");
|
|
- }
|
|
-
|
|
- /* formate value to one decimal place */
|
|
- value = g_strdup_printf ("%.1f", up_wakeup_item_get_value (item));
|
|
-
|
|
- /* get formatted lines */
|
|
- cmdline = gpm_stats_format_cmdline (item);
|
|
- details = gpm_stats_format_details (item);
|
|
-
|
|
- gtk_list_store_append (list_store_wakeups, &iter);
|
|
- gtk_list_store_set (list_store_wakeups, &iter,
|
|
- GPM_WAKEUPS_COLUMN_ID, id,
|
|
- GPM_WAKEUPS_COLUMN_VALUE, value,
|
|
- GPM_WAKEUPS_COLUMN_CMDLINE, cmdline,
|
|
- GPM_WAKEUPS_COLUMN_DETAILS, details,
|
|
- GPM_WAKEUPS_COLUMN_ICON, icon, -1);
|
|
- g_free (cmdline);
|
|
- g_free (details);
|
|
- g_free (value);
|
|
- g_free (id);
|
|
-}
|
|
-
|
|
-/**
|
|
- * gpm_stats_update_wakeups_data:
|
|
- **/
|
|
-static void
|
|
-gpm_stats_update_wakeups_data (void)
|
|
-{
|
|
- GtkWidget *widget;
|
|
- GtkWidget *page_widget;
|
|
- guint total;
|
|
- UpWakeupItem *item;
|
|
- gchar *text;
|
|
- guint i;
|
|
- GError *error = NULL;
|
|
- GPtrArray *array;
|
|
-
|
|
- widget = GTK_WIDGET (gtk_builder_get_object (builder, "notebook1"));
|
|
-
|
|
- /* hide other pages */
|
|
- page_widget = gtk_notebook_get_nth_page (GTK_NOTEBOOK(widget), 0);
|
|
- gtk_widget_hide (page_widget);
|
|
- page_widget = gtk_notebook_get_nth_page (GTK_NOTEBOOK(widget), 1);
|
|
- gtk_widget_hide (page_widget);
|
|
- page_widget = gtk_notebook_get_nth_page (GTK_NOTEBOOK(widget), 2);
|
|
- gtk_widget_hide (page_widget);
|
|
-
|
|
- /* show wakeups page */
|
|
- page_widget = gtk_notebook_get_nth_page (GTK_NOTEBOOK(widget), 3);
|
|
- gtk_widget_show (page_widget);
|
|
-
|
|
- /* show total */
|
|
- total = up_wakeups_get_total_sync (wakeups, NULL, &error);
|
|
- widget = GTK_WIDGET (gtk_builder_get_object (builder, "label_total_wakeups"));
|
|
- if (error == NULL) {
|
|
- text = g_strdup_printf ("%i", total);
|
|
- gtk_label_set_label (GTK_LABEL(widget), text);
|
|
- g_free (text);
|
|
- } else {
|
|
- gtk_label_set_label (GTK_LABEL(widget), error->message);
|
|
- g_error_free (error);
|
|
- }
|
|
-
|
|
- /* get data */
|
|
- gtk_list_store_clear (list_store_wakeups);
|
|
- array = up_wakeups_get_data_sync (wakeups, NULL, NULL);
|
|
- if (array == NULL)
|
|
- return;
|
|
- for (i=0; i<array->len; i++) {
|
|
- item = g_ptr_array_index (array, i);
|
|
- gpm_stats_add_wakeups_item (item);
|
|
- }
|
|
- g_ptr_array_unref (array);
|
|
-}
|
|
-
|
|
static void
|
|
gpm_stats_set_title (GtkWindow *window, gint page_num)
|
|
{
|
|
@@ -1082,8 +758,6 @@ gpm_stats_set_title (GtkWindow *window, gint page_num)
|
|
N_("Device History"),
|
|
/* TRANSLATORS: shown on the titlebar */
|
|
N_("Device Profile"),
|
|
- /* TRANSLATORS: shown on the titlebar */
|
|
- N_("Processor Wakeups")
|
|
};
|
|
|
|
/* TRANSLATORS: shown on the titlebar */
|
|
@@ -1111,9 +785,6 @@ gpm_stats_notebook_changed_cb (GtkNotebook *notebook, gpointer page, gint page_n
|
|
if (current_device == NULL)
|
|
return;
|
|
|
|
- if (g_strcmp0 (current_device, "wakeups") == 0)
|
|
- return;
|
|
-
|
|
device = up_device_new ();
|
|
up_device_set_object_path_sync (device, current_device, NULL, NULL);
|
|
gpm_stats_update_info_data_page (device, page_num);
|
|
@@ -1160,14 +831,10 @@ gpm_stats_devices_treeview_clicked_cb (GtkTreeSelection *selection, gboolean dat
|
|
egg_debug ("selected row is: %s", current_device);
|
|
|
|
/* is special device */
|
|
- if (g_strcmp0 (current_device, "wakeups") == 0) {
|
|
- gpm_stats_update_wakeups_data ();
|
|
- } else {
|
|
- device = up_device_new ();
|
|
- up_device_set_object_path_sync (device, current_device, NULL, NULL);
|
|
- gpm_stats_update_info_data (device);
|
|
- g_object_unref (device);
|
|
- }
|
|
+ device = up_device_new ();
|
|
+ up_device_set_object_path_sync (device, current_device, NULL, NULL);
|
|
+ gpm_stats_update_info_data (device);
|
|
+ g_object_unref (device);
|
|
|
|
} else {
|
|
egg_debug ("no row selected");
|
|
@@ -1256,16 +923,6 @@ gpm_stats_add_device (UpDevice *device)
|
|
g_free (model);
|
|
}
|
|
|
|
-/**
|
|
- * gpm_stats_data_changed_cb:
|
|
- **/
|
|
-static void
|
|
-gpm_stats_data_changed_cb (UpClient *client, gpointer user_data)
|
|
-{
|
|
- if (g_strcmp0 (current_device, "wakeups") == 0)
|
|
- gpm_stats_update_wakeups_data ();
|
|
-}
|
|
-
|
|
/**
|
|
* gpm_stats_device_added_cb:
|
|
**/
|
|
@@ -1568,7 +1225,6 @@ main (int argc, char *argv[])
|
|
GtkTreeSelection *selection;
|
|
GtkApplication *app;
|
|
gint status;
|
|
- gboolean ret;
|
|
UpClient *client;
|
|
GPtrArray *devices = NULL;
|
|
UpDevice *device;
|
|
@@ -1690,8 +1346,6 @@ main (int argc, char *argv[])
|
|
list_store_info = gtk_list_store_new (GPM_INFO_COLUMN_LAST, G_TYPE_STRING, G_TYPE_STRING);
|
|
list_store_devices = gtk_list_store_new (GPM_DEVICES_COLUMN_LAST, G_TYPE_STRING,
|
|
G_TYPE_STRING, G_TYPE_STRING);
|
|
- list_store_wakeups = gtk_list_store_new (GPM_WAKEUPS_COLUMN_LAST, G_TYPE_STRING,
|
|
- G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
|
|
|
|
/* create transaction_id tree view */
|
|
widget = GTK_WIDGET (gtk_builder_get_object (builder, "treeview_info"));
|
|
@@ -1714,15 +1368,6 @@ main (int argc, char *argv[])
|
|
gpm_stats_add_devices_columns (GTK_TREE_VIEW (widget));
|
|
gtk_tree_view_columns_autosize (GTK_TREE_VIEW (widget)); /* show */
|
|
|
|
- /* create wakeups tree view */
|
|
- widget = GTK_WIDGET (gtk_builder_get_object (builder, "treeview_wakeups"));
|
|
- gtk_tree_view_set_model (GTK_TREE_VIEW (widget),
|
|
- GTK_TREE_MODEL (list_store_wakeups));
|
|
-
|
|
- /* add columns to the tree view */
|
|
- gpm_stats_add_wakeups_columns (GTK_TREE_VIEW (widget));
|
|
- gtk_tree_view_columns_autosize (GTK_TREE_VIEW (widget)); /* show */
|
|
-
|
|
history_type = g_settings_get_string (settings, GPM_SETTINGS_INFO_HISTORY_TYPE);
|
|
history_time = g_settings_get_int (settings, GPM_SETTINGS_INFO_HISTORY_TIME);
|
|
if (history_type == NULL)
|
|
@@ -1782,8 +1427,6 @@ main (int argc, char *argv[])
|
|
|
|
client = up_client_new ();
|
|
|
|
- wakeups = up_wakeups_new ();
|
|
- g_signal_connect (wakeups, "data-changed", G_CALLBACK (gpm_stats_data_changed_cb), NULL);
|
|
#if !UP_CHECK_VERSION(0, 99, 0)
|
|
/* coldplug */
|
|
ret = up_client_enumerate_devices_sync (client, NULL, NULL);
|
|
@@ -1827,18 +1470,6 @@ main (int argc, char *argv[])
|
|
if (last_device == NULL)
|
|
last_device = g_settings_get_string (settings, GPM_SETTINGS_INFO_LAST_DEVICE);
|
|
|
|
- /* has capability to measure wakeups */
|
|
- ret = up_wakeups_get_has_capability (wakeups);
|
|
- if (ret) {
|
|
- GtkTreeIter iter;
|
|
- gtk_list_store_append (list_store_devices, &iter);
|
|
- gtk_list_store_set (list_store_devices, &iter,
|
|
- GPM_DEVICES_COLUMN_ID, "wakeups",
|
|
- /* TRANSLATORS: the icon for the CPU */
|
|
- GPM_DEVICES_COLUMN_TEXT, _("Processor"),
|
|
- GPM_DEVICES_COLUMN_ICON, "computer", -1);
|
|
- }
|
|
-
|
|
/* set the correct focus on the last device */
|
|
if (last_device != NULL)
|
|
gpm_stats_highlight_device (last_device);
|
|
@@ -1860,7 +1491,6 @@ out:
|
|
|
|
g_object_unref (settings);
|
|
g_object_unref (client);
|
|
- g_object_unref (wakeups);
|
|
g_object_unref (builder);
|
|
g_object_unref (list_store_info);
|
|
g_object_unref (app);
|
|
--
|
|
2.33.0
|
|
|