summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2016-07-11 17:06:15 +0200
committerraveit65 <[email protected]>2016-07-25 16:13:41 +0200
commitff8f84fbab62f3c3fdc875a2b61a6d8a0654b2dc (patch)
treea7ea4da804c5143462cc6df8d9176d91b7737889 /src
parent85afd16cee70390540d73e0b66999b0d859d299e (diff)
downloadmate-power-manager-ff8f84fbab62f3c3fdc875a2b61a6d8a0654b2dc.tar.bz2
mate-power-manager-ff8f84fbab62f3c3fdc875a2b61a6d8a0654b2dc.tar.xz
Assign names to our idle sources when using newer versions of glib2
This makes it possible to profile more accurately using systemtap taken from: https://git.gnome.org/browse/gnome-power-manager/commit/?id=fbb075b5
Diffstat (limited to 'src')
-rw-r--r--src/gpm-dpms.c1
-rw-r--r--src/gpm-engine.c4
-rw-r--r--src/gpm-idle.c8
-rw-r--r--src/gpm-main.c4
-rw-r--r--src/gpm-manager.c13
5 files changed, 23 insertions, 7 deletions
diff --git a/src/gpm-dpms.c b/src/gpm-dpms.c
index 644ffe7..bb1e718 100644
--- a/src/gpm-dpms.c
+++ b/src/gpm-dpms.c
@@ -301,6 +301,7 @@ gpm_dpms_init (GpmDpms *dpms)
dpms->priv->display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default());
dpms->priv->dpms_capable = DPMSCapable (dpms->priv->display);
dpms->priv->timer_id = g_timeout_add_seconds (GPM_DPMS_POLL_TIME, (GSourceFunc)gpm_dpms_poll_mode_cb, dpms);
+ g_source_set_name_by_id (dpms->priv->timer_id, "[GpmDpms] poll");
/* ensure we clear the default timeouts (Standby: 1200s, Suspend: 1800s, Off: 2400s) */
gpm_dpms_clear_timeouts (dpms);
diff --git a/src/gpm-engine.c b/src/gpm-engine.c
index 611ccf5..022916e 100644
--- a/src/gpm-engine.c
+++ b/src/gpm-engine.c
@@ -1159,6 +1159,7 @@ gpm_engine_init (GpmEngine *engine)
GPtrArray *array = NULL;
guint i;
#endif
+ guint idle_id;
engine->priv = GPM_ENGINE_GET_PRIVATE (engine);
engine->priv->array = g_ptr_array_new_with_free_func (g_object_unref);
@@ -1223,7 +1224,8 @@ gpm_engine_init (GpmEngine *engine)
else
egg_debug ("Using percentage notification policy");
- g_idle_add ((GSourceFunc) gpm_engine_coldplug_idle_cb, engine);
+ idle_id = g_idle_add ((GSourceFunc) gpm_engine_coldplug_idle_cb, engine);
+ g_source_set_name_by_id (idle_id, "[GpmEngine] coldplug");
}
/**
diff --git a/src/gpm-idle.c b/src/gpm-idle.c
index 67dbeee..a593fe9 100644
--- a/src/gpm-idle.c
+++ b/src/gpm-idle.c
@@ -227,7 +227,9 @@ gpm_idle_evaluate (GpmIdle *idle)
if (idle->priv->timeout_blank_id == 0 &&
idle->priv->timeout_blank != 0) {
egg_debug ("setting up blank callback for %is", idle->priv->timeout_blank);
- idle->priv->timeout_blank_id = g_timeout_add_seconds (idle->priv->timeout_blank, (GSourceFunc) gpm_idle_blank_cb, idle);
+ idle->priv->timeout_blank_id = g_timeout_add_seconds (idle->priv->timeout_blank,
+ (GSourceFunc) gpm_idle_blank_cb, idle);
+ g_source_set_name_by_id (idle->priv->timeout_blank_id, "[GpmIdle] blank");
}
/* are we inhibited from sleeping */
@@ -242,7 +244,9 @@ gpm_idle_evaluate (GpmIdle *idle)
if (idle->priv->timeout_sleep_id == 0 &&
idle->priv->timeout_sleep != 0) {
egg_debug ("setting up sleep callback %is", idle->priv->timeout_sleep);
- idle->priv->timeout_sleep_id = g_timeout_add_seconds (idle->priv->timeout_sleep, (GSourceFunc) gpm_idle_sleep_cb, idle);
+ idle->priv->timeout_sleep_id = g_timeout_add_seconds (idle->priv->timeout_sleep,
+ (GSourceFunc) gpm_idle_sleep_cb, idle);
+ g_source_set_name_by_id (idle->priv->timeout_sleep_id, "[GpmIdle] sleep");
}
}
out:
diff --git a/src/gpm-main.c b/src/gpm-main.c
index 6186d6e..3244e00 100644
--- a/src/gpm-main.c
+++ b/src/gpm-main.c
@@ -165,6 +165,7 @@ main (int argc, char *argv[])
GError *error = NULL;
GOptionContext *context;
gint ret;
+ guint timer_id;
const GOptionEntry options[] = {
{ "verbose", '\0', 0, G_OPTION_ARG_NONE, &verbose,
@@ -264,7 +265,8 @@ main (int argc, char *argv[])
/* Only timeout and close the mainloop if we have specified it
* on the command line */
if (timed_exit) {
- g_timeout_add_seconds (20, (GSourceFunc) timed_exit_cb, loop);
+ timer_id = g_timeout_add_seconds (20, (GSourceFunc) timed_exit_cb, loop);
+ g_source_set_name_by_id (timer_id, "[GpmMain] timed-exit");
}
if (immediate_exit == FALSE) {
diff --git a/src/gpm-manager.c b/src/gpm-manager.c
index bfbfa3a..ce2b695 100644
--- a/src/gpm-manager.c
+++ b/src/gpm-manager.c
@@ -239,6 +239,8 @@ gpm_manager_play_loop_start (GpmManager *manager, GpmManagerSound action, gboole
(GSourceFunc) gpm_manager_play_loop_timeout_cb,
manager);
+ g_source_set_name_by_id (manager->priv->critical_alert_timeout_id, "[GpmManager] play-loop");
+
/* play the sound, using sounds from the naming spec */
context = ca_gtk_context_get_for_screen (gdk_screen_get_default ());
retval = ca_context_play (context, 0,
@@ -1560,6 +1562,7 @@ gpm_manager_engine_charge_action_cb (GpmEngine *engine, UpDevice *device, GpmMan
gchar *icon = NULL;
UpDeviceKind kind;
GpmActionPolicy policy;
+ guint timer_id;
/* get device properties */
g_object_get (device,
@@ -1608,7 +1611,8 @@ gpm_manager_engine_charge_action_cb (GpmEngine *engine, UpDevice *device, GpmMan
}
/* wait 20 seconds for user-panic */
- g_timeout_add_seconds (20, (GSourceFunc) manager_critical_action_do, manager);
+ timer_id = g_timeout_add_seconds (20, (GSourceFunc) manager_critical_action_do, manager);
+ g_source_set_name_by_id (timer_id, "[GpmManager] battery critical-action");
} else if (kind == UP_DEVICE_KIND_UPS) {
/* TRANSLATORS: UPS is really, really, low */
@@ -1636,7 +1640,8 @@ gpm_manager_engine_charge_action_cb (GpmEngine *engine, UpDevice *device, GpmMan
}
/* wait 20 seconds for user-panic */
- g_timeout_add_seconds (20, (GSourceFunc) manager_critical_action_do, manager);
+ timer_id = g_timeout_add_seconds (20, (GSourceFunc) manager_critical_action_do, manager);
+ g_source_set_name_by_id (timer_id, "[GpmManager] ups critical-action");
}
@@ -1708,8 +1713,10 @@ gpm_manager_reset_just_resumed_cb (gpointer user_data)
static void
gpm_manager_control_resume_cb (GpmControl *control, GpmControlAction action, GpmManager *manager)
{
+ guint timer_id;
manager->priv->just_resumed = TRUE;
- g_timeout_add_seconds (1, gpm_manager_reset_just_resumed_cb, manager);
+ timer_id = g_timeout_add_seconds (1, gpm_manager_reset_just_resumed_cb, manager);
+ g_source_set_name_by_id (timer_id, "[GpmManager] just-resumed");
}
/**