[gnome-power-manager] Assign names to our idle sources when using new versions of glib2
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-power-manager] Assign names to our idle sources when using new versions of glib2
- Date: Sat, 5 Jun 2010 15:28:39 +0000 (UTC)
commit fbb075b5e5093c0007603656240132d6dc6191f7
Author: Richard Hughes <richard hughsie com>
Date: Sat Jun 5 16:04:28 2010 +0100
Assign names to our idle sources when using new versions of glib2
This makes it possible to profile more accurately using systemtap
src/gpm-dpms.c | 3 +++
src/gpm-engine.c | 6 +++++-
src/gpm-idle.c | 12 ++++++++++--
src/gpm-main.c | 6 +++++-
src/gpm-manager.c | 27 +++++++++++++++++++++++----
5 files changed, 46 insertions(+), 8 deletions(-)
---
diff --git a/src/gpm-dpms.c b/src/gpm-dpms.c
index a83cb7e..081ffce 100644
--- a/src/gpm-dpms.c
+++ b/src/gpm-dpms.c
@@ -346,6 +346,9 @@ gpm_dpms_init (GpmDpms *dpms)
/* DPMSCapable() can never change for a given display */
dpms->priv->dpms_capable = DPMSCapable (GDK_DISPLAY ());
dpms->priv->timer_id = g_timeout_add_seconds (GPM_DPMS_POLL_TIME, (GSourceFunc)gpm_dpms_poll_mode_cb, dpms);
+#if GLIB_CHECK_VERSION(2,25,8)
+ g_source_set_name_by_id (dpms->priv->timer_id, "[GpmDpms] poll");
+#endif
/* 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 6c3c4f2..fa237fd 100644
--- a/src/gpm-engine.c
+++ b/src/gpm-engine.c
@@ -1102,6 +1102,7 @@ static void
gpm_engine_init (GpmEngine *engine)
{
gchar *icon_policy;
+ guint idle_id;
engine->priv = GPM_ENGINE_GET_PRIVATE (engine);
@@ -1161,7 +1162,10 @@ 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);
+#if GLIB_CHECK_VERSION(2,25,8)
+ g_source_set_name_by_id (idle_id, "[GpmEngine] coldplug");
+#endif
}
/**
diff --git a/src/gpm-idle.c b/src/gpm-idle.c
index 7c0fc5c..3775019 100644
--- a/src/gpm-idle.c
+++ b/src/gpm-idle.c
@@ -227,7 +227,11 @@ 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);
+#if GLIB_CHECK_VERSION(2,25,8)
+ g_source_set_name_by_id (idle->priv->timeout_blank_id, "[GpmIdle] blank");
+#endif
}
/* are we inhibited from sleeping */
@@ -242,7 +246,11 @@ 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);
+#if GLIB_CHECK_VERSION(2,25,8)
+ g_source_set_name_by_id (idle->priv->timeout_sleep_id, "[GpmIdle] sleep");
+#endif
}
}
out:
diff --git a/src/gpm-main.c b/src/gpm-main.c
index 339ba3b..02001c5 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,
@@ -269,7 +270,10 @@ 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);
+#if GLIB_CHECK_VERSION(2,25,8)
+ g_source_set_name_by_id (timer_id, "[GpmMain] timed-exit");
+#endif
}
if (immediate_exit == FALSE) {
diff --git a/src/gpm-manager.c b/src/gpm-manager.c
index e75afd5..ee112ea 100644
--- a/src/gpm-manager.c
+++ b/src/gpm-manager.c
@@ -233,6 +233,9 @@ gpm_manager_play_loop_start (GpmManager *manager, GpmManagerSound action, gboole
manager->priv->critical_alert_timeout_id = g_timeout_add_seconds (timeout,
(GSourceFunc) gpm_manager_play_loop_timeout_cb,
manager);
+#if GLIB_CHECK_VERSION(2,25,8)
+ g_source_set_name_by_id (manager->priv->critical_alert_timeout_id, "[GpmManager] play-loop");
+#endif
/* play the sound, using sounds from the naming spec */
retval = ca_context_play (ca_gtk_context_get (), 0,
@@ -1217,6 +1220,7 @@ static void
gpm_manager_engine_perhaps_recall_cb (GpmEngine *engine, UpDevice *device, gchar *oem_vendor, gchar *website, GpmManager *manager)
{
gboolean ret;
+ guint timer_id;
/* don't show when running under GDM */
if (g_getenv ("RUNNING_UNDER_GDM") != NULL) {
@@ -1235,7 +1239,11 @@ gpm_manager_engine_perhaps_recall_cb (GpmEngine *engine, UpDevice *device, gchar
g_object_set_data_full (G_OBJECT (manager), "recall-oem-website", (gpointer) g_strdup (website), (GDestroyNotify) g_free);
/* delay by a few seconds so the panel can load */
- g_timeout_add_seconds (GPM_MANAGER_RECALL_DELAY, (GSourceFunc) gpm_manager_perhaps_recall_delay_cb, manager);
+ timer_id = g_timeout_add_seconds (GPM_MANAGER_RECALL_DELAY,
+ (GSourceFunc) gpm_manager_perhaps_recall_delay_cb, manager);
+#if GLIB_CHECK_VERSION(2,25,8)
+ g_source_set_name_by_id (timer_id, "[GpmManager] perhaps-recall");
+#endif
}
/**
@@ -1745,6 +1753,7 @@ gpm_manager_engine_charge_action_cb (GpmEngine *engine, UpDevice *device, GpmMan
GIcon *icon = NULL;
UpDeviceKind kind;
GpmActionPolicy policy;
+ guint timer_id;
/* get device properties */
g_object_get (device,
@@ -1796,7 +1805,10 @@ gpm_manager_engine_charge_action_cb (GpmEngine *engine, UpDevice *device, GpmMan
g_free (action);
/* 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);
+#if GLIB_CHECK_VERSION(2,25,8)
+ g_source_set_name_by_id (timer_id, "[GpmManager] battery critical-action");
+#endif
} else if (kind == UP_DEVICE_KIND_UPS) {
/* TRANSLATORS: UPS is really, really, low */
@@ -1825,7 +1837,10 @@ 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);
+#if GLIB_CHECK_VERSION(2,25,8)
+ g_source_set_name_by_id (timer_id, "[GpmManager] ups critical-action");
+#endif
g_free (action);
}
@@ -1897,8 +1912,12 @@ 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);
+#if GLIB_CHECK_VERSION(2,25,8)
+ g_source_set_name_by_id (timer_id, "[GpmManager] just-resumed");
+#endif
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]