<?xml version="1.0"?><!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<refentry id="QoS">
  <refmeta>
    <refentrytitle role="top_of_page">org.freedesktop.UPower.QoS</refentrytitle>
  </refmeta>
  <refnamediv>
    <refname>org.freedesktop.UPower.QoS</refname>
    <refpurpose>QoS interface</refpurpose>
  </refnamediv>
  <refsynopsisdiv role="synopsis">
    <title role="synopsis.title">Methods</title>
    <synopsis><link linkend="QoS.SetMinimumLatency">SetMinimumLatency</link>(in's'type,
in'i'value)
<link linkend="QoS.RequestLatency">RequestLatency</link>(in's'type,
in'i'value,
in'b'persistent,
out'u'cookie)
<link linkend="QoS.CancelRequest">CancelRequest</link>(in'u'cookie)
<link linkend="QoS.GetLatency">GetLatency</link>(in's'type,
out'i'value)
<link linkend="QoS.GetLatencyRequests">GetLatencyRequests</link>(out'a(uuusxbssi)'requests)
</synopsis>
  </refsynopsisdiv>
  <refsect1 role="signal_proto">
    <title role="signal_proto.title">Signals</title>
    <synopsis><link linkend="QoS::LatencyChanged">LatencyChanged</link>('s'type,
'i'value)
<link linkend="QoS::RequestsChanged">RequestsChanged</link>()
</synopsis>
  </refsect1>
  <refsect1 role="impl_interfaces">
    <title role="impl_interfaces.title">Implemented Interfaces</title>
    <para>
    Objects implementing org.freedesktop.UPower.QoS also implements
    org.freedesktop.DBus.Introspectable,
    org.freedesktop.DBus.Properties
    </para>
  </refsect1>
  <refsect1 role="desc">
    <title role="desc.title">Description</title>
    <para>
      
        <para>
          org.freedesktop.UPower.QoS is a DBus interface implemented
          by UPower.
          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.
        </para>
        <para>
          Use cases:
        </para>
        
          
            <para>
              I want my IM application to request 0.5s latency for messages.
            </para>
            <para>
              I'm running an OpenGL simulation and want maximum performance,
              even when on battery power.
            </para>
            <para>
              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.
            </para>
            <para>
              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.
            </para>
            <para>
              I want high throughput when copying files, but want low throughput
              for downloading updates in the background.
            </para>
            <para>
              I want my power manager to set all latencies to lowest when on
              AC power.
            </para>
            <para>
              I don't want my users messing with latency settings.
            </para>
            <para>
              I'm and admin and I want to be able to override all latency
              settings on my machines.
            </para>
          
        
        <para>
          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.
        </para>
        <para>
          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.
        </para>
      
    </para>
  </refsect1>
  <refsect1 role="details"><title role="details.title">Details</title><refsect2><title><anchor role="function" id="QoS.SetMinimumLatency"/>SetMinimumLatency ()</title><indexterm><primary>SetMinimumLatency</primary><secondary>QoS</secondary></indexterm><programlisting>SetMinimumLatency (in's'type,
in'i'value)</programlisting></refsect2>
          <para>
            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.
          </para>
        <variablelist role="params"><varlistentry><term><parameter>type</parameter>:</term><listitem><simpara>
            The type of latency to control, <literal>cpu_dma</literal> or
            <literal>network</literal>.
          </simpara></listitem></varlistentry><varlistentry><term><parameter>value</parameter>:</term><listitem><simpara>
            The value, in microseconds or kilobits per second.
            The value <literal>-1</literal> means unset and the default is used.
          </simpara></listitem></varlistentry></variablelist><refsect3><title>Errors</title><variablelist role="errors"><varlistentry><term><parameter>org.freedesktop.UPower.GeneralError</parameter>:</term><listitem><simpara>if an error occured while setting the latency</simpara></listitem></varlistentry></variablelist></refsect3><refsect3><title>Permissions</title><para role="permission">Callers need the <literal>org.freedesktop.upower.qos.set-minimum-latency</literal> authorization</para></refsect3><refsect2><title><anchor role="function" id="QoS.RequestLatency"/>RequestLatency ()</title><indexterm><primary>RequestLatency</primary><secondary>QoS</secondary></indexterm><programlisting>RequestLatency (in's'type,
in'i'value,
in'b'persistent,
out'u'cookie)</programlisting></refsect2>
          <para>
            Set the required latency of an application or service.
          </para>
        <variablelist role="params"><varlistentry><term><parameter>type</parameter>:</term><listitem><simpara>
            The type of latency to control, <literal>cpu_dma</literal> or
            <literal>network</literal>.
          </simpara></listitem></varlistentry><varlistentry><term><parameter>value</parameter>:</term><listitem><simpara>
            The value, in microseconds or kilobits per second.
            The value <literal>-1</literal> means remove all latency requirements.
          </simpara></listitem></varlistentry><varlistentry><term><parameter>persistent</parameter>:</term><listitem><simpara>
            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.
          </simpara></listitem></varlistentry><varlistentry><term><parameter>cookie</parameter>:</term><listitem><simpara>
            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.
          </simpara></listitem></varlistentry></variablelist><refsect3><title>Errors</title><variablelist role="errors"><varlistentry><term><parameter>org.freedesktop.UPower.GeneralError</parameter>:</term><listitem><simpara>if an error occured while setting the latency</simpara></listitem></varlistentry></variablelist></refsect3><refsect3><title>Permissions</title><para role="permission">
          Callers need the
          <literal>org.freedesktop.upower.qos.request-latency-persistent</literal>
          authorization if <literal>persistent</literal> is TRUE, or
          <literal>org.freedesktop.upower.qos.request-latency</literal> otherwise.
        </para></refsect3><refsect2><title><anchor role="function" id="QoS.CancelRequest"/>CancelRequest ()</title><indexterm><primary>CancelRequest</primary><secondary>QoS</secondary></indexterm><programlisting>CancelRequest (in'u'cookie)</programlisting></refsect2>
          <para>
            Cancel the latency request from the application or service.
          </para>
        <variablelist role="params"><varlistentry><term><parameter>cookie</parameter>:</term><listitem><simpara>
            A cookie that identifies the request. This allows an application or
            serivice to request multiple latency settings from one process.
          </simpara></listitem></varlistentry></variablelist><refsect3><title>Errors</title><variablelist role="errors"><varlistentry><term><parameter>org.freedesktop.UPower.GeneralError</parameter>:</term><listitem><simpara>if an error occured while clearing the latency</simpara></listitem></varlistentry></variablelist></refsect3><refsect3><title>Permissions</title><para role="permission">
          Callers need the
          <literal>org.freedesktop.upower.qos.cancel-request</literal>
          authorization if they were not the one issuing the request.
        </para></refsect3><refsect2><title><anchor role="function" id="QoS.GetLatency"/>GetLatency ()</title><indexterm><primary>GetLatency</primary><secondary>QoS</secondary></indexterm><programlisting>GetLatency (in's'type,
out'i'value)</programlisting></refsect2>
          <para>
            Get the lowest latency state on the system at the current time.
          </para>
        <variablelist role="params"><varlistentry><term><parameter>type</parameter>:</term><listitem><simpara>
            The type of latency to return, <literal>cpu_dma</literal> or
            <literal>network</literal>.
          </simpara></listitem></varlistentry><varlistentry><term><parameter>value</parameter>:</term><listitem><simpara>
            The value, in microseconds or kilobits per second.
            The value <literal>-1</literal> means not set or unavailable.
          </simpara></listitem></varlistentry></variablelist><refsect3><title>Errors</title><variablelist role="errors"><varlistentry><term><parameter>org.freedesktop.UPower.GeneralError</parameter>:</term><listitem><simpara>if an error occured while getting the latency</simpara></listitem></varlistentry></variablelist></refsect3><refsect2><title><anchor role="function" id="QoS.GetLatencyRequests"/>GetLatencyRequests ()</title><indexterm><primary>GetLatencyRequests</primary><secondary>QoS</secondary></indexterm><programlisting>GetLatencyRequests (out'a(uuusxbssi)'requests)</programlisting></refsect2>
          <para>
            Gets all the system requests from all services and applications.
          </para>
        <variablelist role="params"><varlistentry><term><parameter>requests</parameter>:</term><listitem><simpara>
            The request lists, where each application can request different
            latency types.
            <para><itemizedlist><listitem><emphasis role="bold">cookie: </emphasis>
                  The random cookie that identifies the request.
                </listitem><listitem><emphasis role="bold">uid: </emphasis>
                  The user ID that issued the request.
                </listitem><listitem><emphasis role="bold">pid: </emphasis>
                  The process ID of the application.
                </listitem><listitem><emphasis role="bold">exec: </emphasis>
                  The executable that issued the request.
                </listitem><listitem><emphasis role="bold">timespec: </emphasis>
                  The number of seconds since the epoch.
                </listitem><listitem><emphasis role="bold">persistent: </emphasis>
                  If the request is persistent and outlives the connection lifetime.
                </listitem><listitem><emphasis role="bold">type: </emphasis>
                  The type of the request, <literal>cpu_dma</literal> or
                  <literal>network</literal>.
                </listitem><listitem><emphasis role="bold">value: </emphasis>
                  The value, in microseconds or kilobits per second.
                </listitem></itemizedlist></para>
        </simpara></listitem></varlistentry></variablelist></refsect1>
  <refsect1 role="signals"><title role="signals.title">Signal Details</title><refsect2><title><anchor role="function" id="QoS::LatencyChanged"/>The LatencyChanged signal</title><indexterm><primary>LatencyChanged</primary><secondary>QoS</secondary></indexterm><programlisting>LatencyChanged ('s'type,
'i'value)</programlisting></refsect2>
          <para>
            Some latency value has changed.
          </para>
        <variablelist role="params"><varlistentry><term><parameter>type</parameter>:</term><listitem><simpara>
            The type of latency that changed, cpu_dma or
            network.
          </simpara></listitem></varlistentry><varlistentry><term><parameter>value</parameter>:</term><listitem><simpara>
            The value, in microseconds or kilobits per second.
            The value -1 means not set or unavailable.
          </simpara></listitem></varlistentry></variablelist><refsect2><title><anchor role="function" id="QoS::RequestsChanged"/>The RequestsChanged signal</title><indexterm><primary>RequestsChanged</primary><secondary>QoS</secondary></indexterm><programlisting>RequestsChanged ()</programlisting></refsect2>
          <para>
            The latency requests on the system have changed.
          </para>
        <variablelist role="params"/></refsect1>
</refentry>
