[gnome-power-manager] Remove the CPU idle check before inactive sleep functionality
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-power-manager] Remove the CPU idle check before inactive sleep functionality
- Date: Thu, 18 Nov 2010 20:04:58 +0000 (UTC)
commit 9831a33494a0a3654cd24bf42a90a41fff6ccfa5
Author: Richard Hughes <richard hughsie com>
Date: Thu Nov 18 20:00:50 2010 +0000
Remove the CPU idle check before inactive sleep functionality
If a script goes wild at 100% CPU, you still want the laptop to save power on battery power.
data/org.gnome.power-manager.gschema.migrate | 1 -
data/org.gnome.power-manager.gschema.xml | 5 -
src/Makefile.am | 2 -
src/gpm-common.h | 1 -
src/gpm-idle.c | 37 +----
src/gpm-idle.h | 2 -
src/gpm-load.c | 281 --------------------------
src/gpm-load.h | 56 -----
src/gpm-manager.c | 5 -
9 files changed, 1 insertions(+), 389 deletions(-)
---
diff --git a/data/org.gnome.power-manager.gschema.migrate b/data/org.gnome.power-manager.gschema.migrate
index 9a7c984..efcee4d 100644
--- a/data/org.gnome.power-manager.gschema.migrate
+++ b/data/org.gnome.power-manager.gschema.migrate
@@ -12,7 +12,6 @@ button-power = /apps/gnome-power-manager/buttons/power
schema-version = /apps/gnome-power-manager/general/installed_schema
use-profile-time = /apps/gnome-power-manager/general/use_profile_time
use-time-for-policy = /apps/gnome-power-manager/general/use_time_for_policy
-check-type-cpu = /apps/gnome-power-manager/general/check_type_cpu
lock-use-screensaver = /apps/gnome-power-manager/lock/use_screensaver_settings
lock-blank-screen = /apps/gnome-power-manager/lock/blank_screen
lock-suspend = /apps/gnome-power-manager/lock/suspend
diff --git a/data/org.gnome.power-manager.gschema.xml b/data/org.gnome.power-manager.gschema.xml
index 1f2f20c..0ea10a1 100644
--- a/data/org.gnome.power-manager.gschema.xml
+++ b/data/org.gnome.power-manager.gschema.xml
@@ -62,11 +62,6 @@
<summary>Whether to use time-based notifications</summary>
<description>If time based notifications should be used. If set to false, then the percentage change is used instead, which may fix a broken ACPI BIOS.</description>
</key>
- <key name="check-type-cpu" type="b">
- <default>false</default>
- <summary>Check CPU load before sleeping</summary>
- <description>If the CPU load should be checked before doing the idle action.</description>
- </key>
<key name="lock-use-screensaver" type="b">
<default>true</default>
<summary>Use gnome-screensaver lock setting</summary>
diff --git a/src/Makefile.am b/src/Makefile.am
index 0a8ee9b..af24e23 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -95,8 +95,6 @@ gnome_power_manager_SOURCES = \
gpm-backlight.c \
gpm-idle.h \
gpm-idle.c \
- gpm-load.h \
- gpm-load.c \
gpm-disks.h \
gpm-disks.c \
gpm-control.h \
diff --git a/src/gpm-common.h b/src/gpm-common.h
index 46e996e..d71f211 100644
--- a/src/gpm-common.h
+++ b/src/gpm-common.h
@@ -76,7 +76,6 @@ G_BEGIN_DECLS
#define GPM_SETTINGS_USE_TIME_POLICY "use-time-for-policy"
#define GPM_SETTINGS_USE_PROFILE_TIME "use-profile-time"
#define GPM_SETTINGS_NETWORKMANAGER_SLEEP "network-sleep"
-#define GPM_SETTINGS_IDLE_CHECK_CPU "check-type-cpu"
/* lock */
#define GPM_SETTINGS_LOCK_USE_SCREENSAVER "lock-use-screensaver"
diff --git a/src/gpm-idle.c b/src/gpm-idle.c
index 639feb0..04225fc 100644
--- a/src/gpm-idle.c
+++ b/src/gpm-idle.c
@@ -42,19 +42,14 @@
#include "gpm-idletime.h"
#include "gpm-idle.h"
-#include "gpm-load.h"
#define GPM_IDLE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPM_TYPE_IDLE, GpmIdlePrivate))
-/* Sets the idle percent limit, i.e. how hard the computer can work
- while considered "at idle" */
-#define GPM_IDLE_CPU_LIMIT 5
#define GPM_IDLE_IDLETIME_ID 1
struct GpmIdlePrivate
{
GpmIdletime *idletime;
- GpmLoad *load;
GDBusProxy *proxy;
GDBusProxy *proxy_presence;
GpmIdleMode mode;
@@ -64,7 +59,6 @@ struct GpmIdlePrivate
guint timeout_blank_id;
guint timeout_sleep_id;
gboolean x_idle;
- gboolean check_type_cpu;
};
enum {
@@ -111,19 +105,6 @@ gpm_idle_set_mode (GpmIdle *idle, GpmIdleMode mode)
}
/**
- * gpm_idle_set_check_cpu:
- * @check_type_cpu: If we should check the CPU before mode becomes
- * GPM_IDLE_MODE_SLEEP and the event is done.
- **/
-void
-gpm_idle_set_check_cpu (GpmIdle *idle, gboolean check_type_cpu)
-{
- g_return_if_fail (GPM_IS_IDLE (idle));
- g_debug ("Setting the CPU load check to %i", check_type_cpu);
- idle->priv->check_type_cpu = check_type_cpu;
-}
-
-/**
* gpm_idle_get_mode:
* Return value: The current mode, e.g. GPM_IDLE_MODE_SLEEP
**/
@@ -153,22 +134,8 @@ gpm_idle_blank_cb (GpmIdle *idle)
static gboolean
gpm_idle_sleep_cb (GpmIdle *idle)
{
- gdouble load;
- gboolean ret = FALSE;
-
- /* get our computed load value */
- if (idle->priv->check_type_cpu) {
- load = gpm_load_get_current (idle->priv->load);
- if (load > GPM_IDLE_CPU_LIMIT) {
- /* check if system is "idle" enough */
- g_debug ("Detected that the CPU is busy");
- ret = TRUE;
- goto out;
- }
- }
gpm_idle_set_mode (idle, GPM_IDLE_MODE_SLEEP);
-out:
- return ret;
+ return FALSE;
}
typedef enum {
@@ -484,7 +451,6 @@ gpm_idle_finalize (GObject *object)
if (idle->priv->timeout_sleep_id != 0)
g_source_remove (idle->priv->timeout_sleep_id);
- g_object_unref (idle->priv->load);
if (idle->priv->proxy != NULL)
g_object_unref (idle->priv->proxy);
if (idle->priv->proxy_presence != NULL)
@@ -539,7 +505,6 @@ gpm_idle_init (GpmIdle *idle)
idle->priv->timeout_blank_id = 0;
idle->priv->timeout_sleep_id = 0;
idle->priv->x_idle = FALSE;
- idle->priv->load = gpm_load_new ();
idle->priv->idletime = gpm_idletime_new ();
g_signal_connect (idle->priv->idletime, "reset", G_CALLBACK (gpm_idle_idletime_reset_cb), idle);
diff --git a/src/gpm-idle.h b/src/gpm-idle.h
index b0cb406..7df0787 100644
--- a/src/gpm-idle.h
+++ b/src/gpm-idle.h
@@ -59,8 +59,6 @@ typedef struct
GType gpm_idle_get_type (void);
GpmIdle *gpm_idle_new (void);
GpmIdleMode gpm_idle_get_mode (GpmIdle *idle);
-void gpm_idle_set_check_cpu (GpmIdle *idle,
- gboolean check_type_cpu);
gboolean gpm_idle_set_timeout_dim (GpmIdle *idle,
guint timeout);
gboolean gpm_idle_set_timeout_blank (GpmIdle *idle,
diff --git a/src/gpm-manager.c b/src/gpm-manager.c
index ebd9598..62f1e78 100644
--- a/src/gpm-manager.c
+++ b/src/gpm-manager.c
@@ -2225,7 +2225,6 @@ gpm_manager_name_lost_cb (GDBusConnection *connection,
static void
gpm_manager_init (GpmManager *manager)
{
- gboolean check_type_cpu;
gint timeout;
guint version;
@@ -2297,10 +2296,6 @@ gpm_manager_init (GpmManager *manager)
g_signal_connect (manager->priv->idle, "idle-changed",
G_CALLBACK (gpm_manager_idle_changed_cb), manager);
- /* set up the check_type_cpu, so we can disable the CPU load check */
- check_type_cpu = g_settings_get_boolean (manager->priv->settings, GPM_SETTINGS_IDLE_CHECK_CPU);
- gpm_idle_set_check_cpu (manager->priv->idle, check_type_cpu);
-
manager->priv->dpms = gpm_dpms_new ();
g_signal_connect (manager->priv->dpms, "mode-changed",
G_CALLBACK (gpm_manager_dpms_mode_changed_cb), manager);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]