summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2009-01-30 13:53:56 +0000
committerRichard Hughes <richard@hughsie.com>2009-01-30 13:53:56 +0000
commit7ea9a1c6c58d242026feb7df4ec6f1b27ccd647e (patch)
treeaf7066664a36d4c86e6198895f315f0e1cd9dda2 /src
parent3ca11019c0f103e2e3c274067fceff2b021829d7 (diff)
trivial: change the interface to be a double with per seconds, not per minute
Diffstat (limited to 'src')
-rw-r--r--src/dkp-wakeups.c24
-rw-r--r--src/org.freedesktop.DeviceKit.Power.Wakeups.xml16
2 files changed, 20 insertions, 20 deletions
diff --git a/src/dkp-wakeups.c b/src/dkp-wakeups.c
index 7bf9ea8..646cabe 100644
--- a/src/dkp-wakeups.c
+++ b/src/dkp-wakeups.c
@@ -45,7 +45,7 @@ static void dkp_wakeups_finalize (GObject *object);
#define DKP_WAKEUPS_REQUESTS_STRUCT_TYPE (dbus_g_type_get_struct ("GValueArray", \
G_TYPE_BOOLEAN, \
G_TYPE_UINT, \
- G_TYPE_UINT, \
+ G_TYPE_DOUBLE, \
G_TYPE_STRING, \
G_TYPE_STRING, \
G_TYPE_INVALID))
@@ -122,7 +122,7 @@ dkp_wakeups_data_print (DkpWakeups *wakeups)
for (i=0; i<wakeups->priv->data->len; i++) {
obj = g_ptr_array_index (wakeups->priv->data, i);
- if (obj->value > 0)
+ if (obj->value > 0.01f)
dkp_wakeups_obj_print (obj);
}
}
@@ -155,14 +155,14 @@ static guint
dkp_wakeups_data_get_total (DkpWakeups *wakeups)
{
guint i;
- guint total = 0;
+ gfloat total = 0;
DkpWakeupsObj *obj;
for (i=0; i<wakeups->priv->data->len; i++) {
obj = g_ptr_array_index (wakeups->priv->data, i);
total += obj->value;
}
- return total;
+ return (guint) total;
}
/**
@@ -206,14 +206,14 @@ dkp_wakeups_get_data (DkpWakeups *wakeups, GPtrArray **data, GError **error)
GValue elem = {0};
obj = g_ptr_array_index (array, i);
- if (obj->value == 0)
+ if (obj->value < 0.01f)
continue;
g_value_init (&elem, DKP_WAKEUPS_REQUESTS_STRUCT_TYPE);
g_value_take_boxed (&elem, dbus_g_type_specialized_construct (DKP_WAKEUPS_REQUESTS_STRUCT_TYPE));
dbus_g_type_struct_set (&elem,
- 0, FALSE,
- 1, obj->value,
- 2, obj->id,
+ 0, obj->is_userspace,
+ 1, obj->id,
+ 2, obj->value,
3, obj->cmdline,
4, obj->details,
G_MAXUINT);
@@ -315,7 +315,7 @@ dkp_wakeups_poll_kernel_cb (DkpWakeups *wakeups)
for (i=0; i<wakeups->priv->data->len; i++) {
obj = g_ptr_array_index (wakeups->priv->data, i);
if (!obj->is_userspace)
- obj->value = 0;
+ obj->value = 0.0f;
}
/* get the data */
@@ -395,7 +395,7 @@ dkp_wakeups_poll_kernel_cb (DkpWakeups *wakeups)
}
/* we report this in minutes, not seconds */
if (obj->old > 0)
- obj->value = (interrupts - obj->old) * 60 / DKP_WAKEUPS_POLL_INTERVAL_KERNEL;
+ obj->value = (interrupts - obj->old) / (gfloat) DKP_WAKEUPS_POLL_INTERVAL_KERNEL;
obj->old = interrupts;
skip:
g_ptr_array_foreach (sections, (GFunc) g_free, NULL);
@@ -436,7 +436,7 @@ dkp_wakeups_poll_userspace_cb (DkpWakeups *wakeups)
for (i=0; i<wakeups->priv->data->len; i++) {
obj = g_ptr_array_index (wakeups->priv->data, i);
if (obj->is_userspace)
- obj->value = 0;
+ obj->value = 0.0f;
}
/* get the data */
@@ -516,7 +516,7 @@ dkp_wakeups_poll_userspace_cb (DkpWakeups *wakeups)
obj->is_userspace = TRUE;
}
/* we report this in minutes, not seconds */
- obj->value = (gfloat) interrupts * 60.0f / interval;
+ obj->value = (gfloat) interrupts / interval;
skip:
g_ptr_array_foreach (sections, (GFunc) g_free, NULL);
g_ptr_array_free (sections, TRUE);
diff --git a/src/org.freedesktop.DeviceKit.Power.Wakeups.xml b/src/org.freedesktop.DeviceKit.Power.Wakeups.xml
index 7f77d60..d31ab7c 100644
--- a/src/org.freedesktop.DeviceKit.Power.Wakeups.xml
+++ b/src/org.freedesktop.DeviceKit.Power.Wakeups.xml
@@ -4,11 +4,11 @@
<!ENTITY ERROR_GENERAL "org.freedesktop.DeviceKit.Power.GeneralError">
]>
<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
- <interface name="org.freedesktop.DeviceKit.Power.Wakeup">
+ <interface name="org.freedesktop.DeviceKit.Power.Wakeups">
<doc:doc>
<doc:description>
<doc:para>
- org.freedesktop.DeviceKit.Power.Wakeup is a DBus interface implimented
+ org.freedesktop.DeviceKit.Power.Wakeups is a DBus interface implimented
by DeviceKit-power.
It allows applications to watch what applications and drivers are
causing the wakeups on the system.
@@ -18,7 +18,7 @@
<!-- ************************************************************ -->
<method name="GetTotal">
- <arg name="value" direction="out" type="i">
+ <arg name="value" direction="out" type="u">
<doc:doc>
<doc:summary>
The number of wakeups per second.
@@ -57,7 +57,7 @@
<!-- ************************************************************ -->
<method name="GetData">
- <arg name="data" direction="out" type="a(buuss)">
+ <arg name="data" direction="out" type="a(budss)">
<doc:doc>
<doc:summary>
The data of all the processes and drivers which contribute to the
@@ -70,15 +70,15 @@
</doc:definition>
</doc:item>
<doc:item>
- <doc:term>value</doc:term>
+ <doc:term>id</doc:term>
<doc:definition>
- The number of wakeups per minute.
+ The process ID of the application, or the IRQ for kernel drivers.
</doc:definition>
</doc:item>
<doc:item>
- <doc:term>id</doc:term>
+ <doc:term>value</doc:term>
<doc:definition>
- The process ID of the application, or the IRQ for kernel drivers.
+ The number of wakeups per second.
</doc:definition>
</doc:item>
<doc:item>