1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
|
<?xml version="1.0" encoding="UTF-8" ?>
<!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="libwnck-Resource-Usage-of-X-Clients">
<refmeta>
<refentrytitle role="top_of_page" id="libwnck-Resource-Usage-of-X-Clients.top_of_page">Resource Usage of X Clients</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>LIBWNCK Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>Resource Usage of X Clients</refname>
<refpurpose>reading resource usage of X clients.</refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>
<refsect1 id="libwnck-Resource-Usage-of-X-Clients.stability-level">
<title>Stability Level</title>
Unstable, unless otherwise indicated
</refsect1>
<refsynopsisdiv id="libwnck-Resource-Usage-of-X-Clients.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>
<synopsis>
#include <libwnck/libwnck.h>
<link linkend="WnckResourceUsage">WnckResourceUsage</link>;
<link linkend="void">void</link> <link linkend="wnck-xid-read-resource-usage">wnck_xid_read_resource_usage</link> (<link linkend="GdkDisplay">GdkDisplay</link> *gdk_display,
<link linkend="gulong">gulong</link> xid,
<link linkend="WnckResourceUsage">WnckResourceUsage</link> *usage);
<link linkend="void">void</link> <link linkend="wnck-pid-read-resource-usage">wnck_pid_read_resource_usage</link> (<link linkend="GdkDisplay">GdkDisplay</link> *gdk_display,
<link linkend="gulong">gulong</link> pid,
<link linkend="WnckResourceUsage">WnckResourceUsage</link> *usage);
</synopsis>
</refsynopsisdiv>
<refsect1 id="libwnck-Resource-Usage-of-X-Clients.description" role="desc">
<title role="desc.title">Description</title>
<para>
libwnck provides an easy-to-use interface to the XRes X server extension to
read resource usage of X clients, which can be defined either by the X
window ID of one of their windows or by the process ID of their process.</para>
<para>
</para>
</refsect1>
<refsect1 id="libwnck-Resource-Usage-of-X-Clients.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="WnckResourceUsage" role="struct" condition="since:2.6">
<title>WnckResourceUsage</title>
<indexterm zone="WnckResourceUsage" role="2.6"><primary>WnckResourceUsage</primary></indexterm><programlisting>typedef struct {
gulong total_bytes_estimate;
gulong pixmap_bytes;
unsigned int n_pixmaps;
unsigned int n_windows;
unsigned int n_gcs;
unsigned int n_pictures;
unsigned int n_glyphsets;
unsigned int n_fonts;
unsigned int n_colormap_entries;
unsigned int n_passive_grabs;
unsigned int n_cursors;
unsigned int n_other;
} WnckResourceUsage;
</programlisting>
<para>
The <link linkend="WnckResourceUsage"><type>WnckResourceUsage</type></link> struct contains information about the total resource
usage of an X client, and the number of resources allocated for each
resource type.</para>
<para>
</para><variablelist role="struct">
<varlistentry>
<term><link linkend="gulong">gulong</link> <structfield>total_bytes_estimate</structfield>;</term>
<listitem><simpara> estimation of the total number of bytes allocated in
the X server.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="gulong">gulong</link> <structfield>pixmap_bytes</structfield>;</term>
<listitem><simpara> number of bytes allocated in the X server for resources of
type Pixmap.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>unsigned <link linkend="int">int</link> <structfield>n_pixmaps</structfield>;</term>
<listitem><simpara> number of Pixmap resources allocated.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>unsigned <link linkend="int">int</link> <structfield>n_windows</structfield>;</term>
<listitem><simpara> number of Window resources allocated.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>unsigned <link linkend="int">int</link> <structfield>n_gcs</structfield>;</term>
<listitem><simpara> number of GContext resources allocated.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>unsigned <link linkend="int">int</link> <structfield>n_pictures</structfield>;</term>
<listitem><simpara> number of Picture resources allocated.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>unsigned <link linkend="int">int</link> <structfield>n_glyphsets</structfield>;</term>
<listitem><simpara> number of Glyphset resources allocated.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>unsigned <link linkend="int">int</link> <structfield>n_fonts</structfield>;</term>
<listitem><simpara> number of Font resources allocated.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>unsigned <link linkend="int">int</link> <structfield>n_colormap_entries</structfield>;</term>
<listitem><simpara> number of Colormap resources allocated.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>unsigned <link linkend="int">int</link> <structfield>n_passive_grabs</structfield>;</term>
<listitem><simpara> number of PassiveGrab resources allocated.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>unsigned <link linkend="int">int</link> <structfield>n_cursors</structfield>;</term>
<listitem><simpara> number of Cursor resources allocated.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term>unsigned <link linkend="int">int</link> <structfield>n_other</structfield>;</term>
<listitem><simpara> number of other resources allocated.
</simpara></listitem>
</varlistentry>
</variablelist><para role="since">Since 2.6
</para></refsect2>
<refsect2 id="wnck-xid-read-resource-usage" role="function" condition="since:2.6">
<title>wnck_xid_read_resource_usage ()</title>
<indexterm zone="wnck-xid-read-resource-usage" role="2.6"><primary>wnck_xid_read_resource_usage</primary></indexterm><programlisting><link linkend="void">void</link> wnck_xid_read_resource_usage (<link linkend="GdkDisplay">GdkDisplay</link> *gdk_display,
<link linkend="gulong">gulong</link> xid,
<link linkend="WnckResourceUsage">WnckResourceUsage</link> *usage);</programlisting>
<para>
Looks for the X resource usage of the application owning the X window ID
<parameter>xid</parameter> on display <parameter>gdisplay</parameter>. If no resource usage can be found, then all
fields of <parameter>usage</parameter> are set to 0.
</para>
<para>
To properly work, this function requires the XRes extension on the X server.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>gdk_display</parameter> :</term>
<listitem><simpara> a <classname>GdkDisplay</classname>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>xid</parameter> :</term>
<listitem><simpara> an X window ID.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>usage</parameter> :</term>
<listitem><simpara> return location for the X resource usage of the application owning
the X window ID <parameter>xid</parameter>.
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.6
</para></refsect2>
<refsect2 id="wnck-pid-read-resource-usage" role="function" condition="since:2.6">
<title>wnck_pid_read_resource_usage ()</title>
<indexterm zone="wnck-pid-read-resource-usage" role="2.6"><primary>wnck_pid_read_resource_usage</primary></indexterm><programlisting><link linkend="void">void</link> wnck_pid_read_resource_usage (<link linkend="GdkDisplay">GdkDisplay</link> *gdk_display,
<link linkend="gulong">gulong</link> pid,
<link linkend="WnckResourceUsage">WnckResourceUsage</link> *usage);</programlisting>
<para>
Looks for the X resource usage of the application with process ID <parameter>pid</parameter> on
display <parameter>gdisplay</parameter>. If no resource usage can be found, then all fields of
<parameter>usage</parameter> are set to 0.
</para>
<para>
In order to find the resource usage of an application that does not have an
X window visible to libwnck (panel applets do not have any toplevel windows,
for example), <link linkend="wnck-pid-read-resource-usage"><function>wnck_pid_read_resource_usage()</function></link> walks through the whole tree of
X windows. Since this walk is expensive in CPU, a cache is created. This
cache is updated in the background. This means there is a non-null
probability that no resource usage will be found for an application, even if
it is an X client. If this happens, calling <link linkend="wnck-pid-read-resource-usage"><function>wnck_pid_read_resource_usage()</function></link>
again after a few seconds should work.
</para>
<para>
To properly work, this function requires the XRes extension on the X server.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>gdk_display</parameter> :</term>
<listitem><simpara> a <classname>GdkDisplay</classname>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>pid</parameter> :</term>
<listitem><simpara> a process ID.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>usage</parameter> :</term>
<listitem><simpara> return location for the X resource usage of the application with
process ID <parameter>pid</parameter>.
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.6
</para></refsect2>
</refsect1>
<refsect1 id="libwnck-Resource-Usage-of-X-Clients.see-also">
<title>See Also</title>
<link linkend="wnck-window-get-xid"><function>wnck_window_get_xid()</function></link>, <link linkend="wnck-application-get-xid"><function>wnck_application_get_xid()</function></link>, <link linkend="wnck-window-get-pid"><function>wnck_window_get_pid()</function></link>, <link linkend="wnck-application-get-pid"><function>wnck_application_get_pid()</function></link>
</refsect1>
</refentry>
|