From d891912126a45a22184c694781830e8f8c90f014 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Thu, 13 Nov 2008 16:39:57 +0000 Subject: [PATCH] feature: add in the interface file for QoS control --- doc/Makefile.am | 1 + doc/dbus/Makefile.am | 6 +- doc/devkit-power-docs.xml | 1 + .../org.freedesktop.devicekit.power.policy.in | 40 ++ src/Makefile.am | 13 +- src/org.freedesktop.DeviceKit.Power.QoS.xml | 341 ++++++++++++++++++ 6 files changed, 399 insertions(+), 3 deletions(-) create mode 100644 src/org.freedesktop.DeviceKit.Power.QoS.xml diff --git a/doc/Makefile.am b/doc/Makefile.am index 5d5a83f..94b5b23 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -54,6 +54,7 @@ content_files = \ man/DeviceKit-power.xml \ dbus/org.freedesktop.DeviceKit.Power.ref.xml \ dbus/org.freedesktop.DeviceKit.Power.Device.ref.xml \ + dbus/org.freedesktop.DeviceKit.Power.QoS.ref.xml \ $(NULL) # Images to copy into HTML directory diff --git a/doc/dbus/Makefile.am b/doc/dbus/Makefile.am index c8511ac..6ac027d 100644 --- a/doc/dbus/Makefile.am +++ b/doc/dbus/Makefile.am @@ -1,5 +1,5 @@ -all : org.freedesktop.DeviceKit.Power.ref.xml org.freedesktop.DeviceKit.Power.Device.ref.xml +all : org.freedesktop.DeviceKit.Power.ref.xml org.freedesktop.DeviceKit.Power.Device.ref.xml org.freedesktop.DeviceKit.Power.QoS.ref.xml org.freedesktop.DeviceKit.Power.ref.xml : $(top_srcdir)/src/org.freedesktop.DeviceKit.Power.xml $(top_srcdir)/doc/dbus/spec-to-docbook.xsl echo """" > $@ @@ -9,6 +9,10 @@ org.freedesktop.DeviceKit.Power.Device.ref.xml : $(top_srcdir)/src/org.freedeskt echo """" > $@ $(XSLTPROC) $(top_srcdir)/doc/dbus/spec-to-docbook.xsl $< | tail -n +2 >> $@ +org.freedesktop.DeviceKit.Power.QoS.ref.xml : $(top_srcdir)/src/org.freedesktop.DeviceKit.Power.QoS.xml $(top_srcdir)/doc/dbus/spec-to-docbook.xsl + echo """" > $@ + $(XSLTPROC) $(top_srcdir)/doc/dbus/spec-to-docbook.xsl $< | tail -n +2 >> $@ + EXTRA_DIST = spec-to-docbook.xsl dbus-introspect-docs.dtd clean-local : diff --git a/doc/devkit-power-docs.xml b/doc/devkit-power-docs.xml index 3cfcae2..c052b6b 100644 --- a/doc/devkit-power-docs.xml +++ b/doc/devkit-power-docs.xml @@ -66,6 +66,7 @@ + diff --git a/policy/org.freedesktop.devicekit.power.policy.in b/policy/org.freedesktop.devicekit.power.policy.in index d74e16c..3185c97 100644 --- a/policy/org.freedesktop.devicekit.power.policy.in +++ b/policy/org.freedesktop.devicekit.power.policy.in @@ -39,4 +39,44 @@ file are instantly applied. + + <_description>Set the required latency of an application + <_message>Authentication is required to set the required latency of an application + + no + no + yes + + + + + <_description>Set a persistent latency setting + <_message>Authentication is required to set a persistent latency setting + + no + no + yes + + + + + <_description>Set administrator settings for latency control + <_message>Authentication is required to set administrator settings for latency control + + no + no + auth_admin + + + + + <_description>Cancel a latency request + <_message>Authentication is required to cancel a latency request + + no + no + auth_admin + + + diff --git a/src/Makefile.am b/src/Makefile.am index 4d501d7..7d7c2b4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -26,7 +26,9 @@ DEVKIT_POWER_LIBS = $(top_builddir)/libdevkit-power/libdevkit-power.la BUILT_SOURCES = \ dkp-daemon-glue.h \ dkp-device-glue.h \ - dkp-marshal.h dkp-marshal.c + dkp-qos-glue.h \ + dkp-marshal.h \ + dkp-marshal.c dkp-marshal.h: dkp-marshal.list glib-genmarshal $< --prefix=dkp_marshal --header > $@ @@ -40,10 +42,16 @@ dkp-daemon-glue.h: org.freedesktop.DeviceKit.Power.xml Makefile.am dkp-device-glue.h: org.freedesktop.DeviceKit.Power.Device.xml Makefile.am dbus-binding-tool --prefix=dkp_device --mode=glib-server --output=dkp-device-glue.h org.freedesktop.DeviceKit.Power.Device.xml +dkp-qos-glue.h: org.freedesktop.DeviceKit.Power.QoS.xml Makefile.am + dbus-binding-tool --prefix=dkp_qos --mode=glib-server --output=dkp-qos-glue.h org.freedesktop.DeviceKit.Power.QoS.xml + libexec_PROGRAMS = devkit-power-daemon dbusifdir = $(datadir)/dbus-1/interfaces -dbusif_DATA = org.freedesktop.DeviceKit.Power.xml org.freedesktop.DeviceKit.Power.Device.xml +dbusif_DATA = \ + org.freedesktop.DeviceKit.Power.xml \ + org.freedesktop.DeviceKit.Power.Device.xml \ + org.freedesktop.DeviceKit.Power.QoS.xml devkit_power_daemon_SOURCES = \ egg-debug.c \ @@ -103,6 +111,7 @@ CLEANFILES = $(BUILT_SOURCES) EXTRA_DIST = \ org.freedesktop.DeviceKit.Power.xml \ org.freedesktop.DeviceKit.Power.Device.xml \ + org.freedesktop.DeviceKit.Power.QoS.xml \ dkp-marshal.list \ 95-devkit-power-csr.rules \ 95-devkit-power-hid.rules \ diff --git a/src/org.freedesktop.DeviceKit.Power.QoS.xml b/src/org.freedesktop.DeviceKit.Power.QoS.xml new file mode 100644 index 0000000..47341ba --- /dev/null +++ b/src/org.freedesktop.DeviceKit.Power.QoS.xml @@ -0,0 +1,341 @@ + +]> + + + + + + org.freedesktop.DeviceKit.Power.QoS is a DBus interface implimented + by DeviceKit-power. + It allows applications to request latencies, for example a couple of seconds + for an IM application, or a few hundred microseconds for a multiplayer game. + + + Use cases: + + + + + I want my IM application to request 0.5s latency for messages. + + + I'm running an OpenGL simulation and want maximum performance, + even when on battery power. + + + I'm running an SQL server for a credit card company, and want the + server to request low latency CPU and network as any delay costs money. + + + I'm an admin, and want to change the power consumption vs. latency + from cron scripts so it uses high latency during the night for + maximum power saving, and low latency during business hours. + + + I want high throughput when copying files, but want low throughput + for downloading updates in the background. + + + I want my power manager to set all latencies to lowest when on + AC power. + + + I don't want my users messing with latency settings. + + + I'm and admin and I want to be able to override all latency + settings on my machines. + + + + + Why don't applications use the PMQoS interface directly? + By providing a framework we can override requests by policy, and also + control requests from random services. + You also can't set latencies unless you're the root user, which is not + suitable for the desktop use case. + + + Of course, you can do if you really want, but then you loose the + benefits of the query interface and the policy override, + and have to run your application as root. + + + + + + + + + + + The type of latency to control, cpu_dma or + network. + + + + + + + The value, in microseconds or kilobits per second. + The value -1 means unset and the default is used. + + + + + + + Set the minimum acceptable latency of the system. + Setting this value tells the system to not attempt latencies below this setting. + This may be useful in a data center or server room, when you want to override the + latency requests from applications. + This may be required if the server room is operating outside a standard thermal + or power envelope, and an override is required. + You do not have to use this method during normal operation. + + + Callers need the org.freedesktop.devicekit.power.latency.set-minimum-latency authorization + + if an error occured while setting the latency + + + + + + + + + + + The type of latency to control, cpu_dma or + network. + + + + + + + The value, in microseconds or kilobits per second. + The value -1 means remove all latency requirements. + + + + + + + If the latency request outlives the connection. + When the application issuing the request disconnects from the system + bus, the latency request is automatically cleaned up. + By setting this flag to TRUE, the request is not cleaned up when + the client disconnects, and the cookie is preserved acress reboots. + + + + + + + A cookie that identifies the request. This allows an application or + service to request multiple latency settings from one process, and for + other processes to cancel requests. + + + + + + + Set the required latency of an application or service. + + + + Callers need the + org.freedesktop.devicekit.power.latency.request-latency-persistent + authorization if persistent is TRUE, or + org.freedesktop.devicekit.power.latency.request-latency otherwise. + + + if an error occured while setting the latency + + + + + + + + + + + The type of latency to control, cpu_dma or + network. + + + + + + + A cookie that identifies the request. This allows an application or + serivice to request multiple latency settings from one process. + + + + + + + Cancel the latency request from the application or service. + + + + Callers need the + org.freedesktop.devicekit.power.latency.cancel-request + authorization if they were not the one issuing the request. + + + if an error occured while clearing the latency + + + + + + + + + + + The type of latency to return, cpu_dma or + network. + + + + + + + The value, in microseconds or kilobits per second. + The value -1 means not set or unavailable. + + + + + + + Get the lowest latency state on the system at the current time. + + + + if an error occured while getting the latency + + + + + + + + + + The type of latency that changed, cpu_dma or + network. + + + + + + + The value, in microseconds or kilobits per second. + The value -1 means not set or unavailable. + + + + + + + Some latency value has changed. + + + + + + + + + + + The request lists, where each application can request different + latency types. + + + cookie + + The random cookie that identifies the request. + + + + uid + + The user ID that issued the request. + + + + pid + + The process ID of the application. + + + + exec + + The executable that issued the request. + + + + timespec + + The number of seconds since the epoch. + + + + persistent + + If the request is persistent and outlives the connection lifetime. + + + + type + + The type of the request, cpu_dma or + network. + + + + value + + The value, in microseconds or kilobits per second. + discharging. + + + + + + + + + Gets all the system requests from all services and applications. + + + + + + + + + + + The latency requests on the system have changed. + + + + + + + +