gnome-power-manager r3123 - in trunk: . src
- From: rhughes svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-power-manager r3123 - in trunk: . src
- Date: Tue, 9 Dec 2008 15:00:23 +0000 (UTC)
Author: rhughes
Date: Tue Dec 9 15:00:23 2008
New Revision: 3123
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=3123&view=rev
Log:
2008-12-09 Richard Hughes <richard hughsie com>
* src/Makefile.am:
Fix make distcheck
* src/gpm-load.c: (gpm_load_get_cpu_values),
(gpm_load_get_current):
Trivial whitepaces changes.
Modified:
trunk/ChangeLog
trunk/src/Makefile.am
trunk/src/gpm-load.c
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Tue Dec 9 15:00:23 2008
@@ -306,6 +306,8 @@
gnome_power_self_test_SOURCES += \
gpm-devicekit.h \
gpm-devicekit.c \
+ egg-console-kit.h \
+ egg-console-kit.c \
$(NULL)
else
gnome_power_self_test_SOURCES += \
Modified: trunk/src/gpm-load.c
==============================================================================
--- trunk/src/gpm-load.c (original)
+++ trunk/src/gpm-load.c Tue Dec 9 15:00:23 2008
@@ -90,13 +90,13 @@
long unsigned cpu_wait = 0;
kstat_ctl_t *kc = NULL;
kstat_named_t *kn = NULL;
- kstat_t *ks = NULL;
+ kstat_t *ks = NULL;
cpu_stat_t data;
int ncpus;
int count;
kc = kstat_open();
- if (!kc){
+ if (!kc) {
egg_warning ("Cannot open kstat!\n");
return FALSE;
}
@@ -175,9 +175,8 @@
char *suc;
fd = fopen("/proc/stat", "r");
- if (! fd) {
+ if (!fd)
return FALSE;
- }
suc = fgets (str, 80, fd);
len = sscanf (str, "%s %lu %lu %lu %lu", tmp,
&cpu_user, &cpu_nice, &cpu_system, cpu_idle);
@@ -199,7 +198,7 @@
gdouble
gpm_load_get_current (GpmLoad *load)
{
- double percentage_load;
+ double percentage_load;
long unsigned cpu_idle;
long unsigned cpu_total;
long unsigned diff_idle;
@@ -208,19 +207,17 @@
/* work out the differences */
ret = gpm_load_get_cpu_values (&cpu_idle, &cpu_total);
- if (!ret) {
+ if (!ret)
return 0.0;
- }
diff_idle = cpu_idle - load->priv->old_idle;
diff_total = cpu_total - load->priv->old_total;
/* If we divide the total time by idle time we get the load. */
- if (diff_idle > 0) {
+ if (diff_idle > 0)
percentage_load = (double) diff_total / (double) diff_idle;
- } else {
+ else
percentage_load = 100;
- }
load->priv->old_idle = cpu_idle;
load->priv->old_total = cpu_total;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]