ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/docs/sg_get_network_io_stats.xml
(Generate patch)

Comparing projects/libstatgrab/docs/sg_get_network_io_stats.xml (file contents):
Revision 1.1 by tdb, Thu Oct 2 14:53:22 2003 UTC vs.
Revision 1.7 by tdb, Sun May 2 17:21:35 2004 UTC

# Line 3 | Line 3
3   <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
4                 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
5  
6 < <refentry id="get_network_stats">
6 > <refentry id="sg_get_network_io_stats">
7  
8    <refentryinfo>
9      <date>$Date$</date>
10      <releaseinfo>$Id$</releaseinfo>
11    </refentryinfo>
12 <  
12 >
13    <refmeta>
14 <    <refentrytitle>get_network_stats</refentrytitle>
14 >    <refentrytitle>sg_get_network_io_stats</refentrytitle>
15      <manvolnum>3</manvolnum>
16      <refmiscinfo>i-scream</refmiscinfo>
17    </refmeta>
18 <  
18 >
19    <refnamediv>
20 <    <refname>get_network_stats</refname>
21 <    <refname>get_network_stats_diff</refname>
20 >    <refname>sg_get_network_io_stats</refname>
21 >    <refname>sg_get_network_io_stats_diff</refname>
22      <refpurpose>get network statistics</refpurpose>
23    </refnamediv>
24 <    
24 >
25    <refsynopsisdiv>
26      <funcsynopsis>
27        <funcsynopsisinfo>#include &lt;statgrab.h&gt;</funcsynopsisinfo>
28        <funcprototype>
29 <        <funcdef>network_stat_t *<function>get_network_stats</function></funcdef>
29 >        <funcdef>sg_network_io_stats *<function>sg_get_network_io_stats</function></funcdef>
30          <paramdef>int *<parameter>entries</parameter></paramdef>
31        </funcprototype>
32        <funcprototype>
33 <        <funcdef>network_stat_t *<function>get_network_stats_diff</function></funcdef>
33 >        <funcdef>sg_network_io_stats *<function>sg_get_network_io_stats_diff</function></funcdef>
34          <paramdef>int *<parameter>entries</parameter></paramdef>
35        </funcprototype>
36      </funcsynopsis>
37    </refsynopsisdiv>
38 <    
38 >
39    <refsect1>
40      <title>Description</title>
41      <para>
42        Both calls take a pointer to an int,
43        <parameter>entries</parameter>, which is filled with the number
44        of network interfaces the machine has. This is needed to know how
45 <      many <structname>network_stat_t</structname> structures have been
45 >      many <structname>sg_network_io_stats</structname> structures have been
46        returned. A pointer is returned to the first
47 <      <structname>network_stat_t</structname>.
47 >      <structname>sg_network_io_stats</structname>.
48      </para>
49      <para>
50 <      <function>get_network_stats</function> returns the network
50 >      <function>sg_get_network_io_stats</function> returns the network
51        traffic stored in the kernel which holds the amount of data
52        transferred since bootup. On some platforms, such as Solaris 7,
53        this value is stored in a 32bit int, so wraps around when it
# Line 55 | Line 55
55        in a 64bit int, which wraps somewhere near 17 million terabytes.
56      </para>
57      <para>
58 <      <function>get_network_stats_diff</function> is the same as
59 <      <function>get_network_stats</function> except it will return the
58 >      <function>sg_get_network_io_stats</function> also returns the number
59 >      of packets sent and received, and the number of errors that
60 >      have occured. It also makes the number of collisions available.
61 >    </para>
62 >    <para>
63 >      <function>sg_get_network_io_stats_diff</function> is the same as
64 >      <function>sg_get_network_io_stats</function> except it will return the
65        difference since the last call. So, for instance a call to
66 <      <function>get_network_stats_diff</function> is made, and called
66 >      <function>sg_get_network_io_stats_diff</function> is made, and called
67        again 5 seconds later. Over that time, 20 bytes of traffic was
68        transmitted and 10 bytes received. Tx will store 20, rx will
69        store 10 and systime will store 5. This function copes with wrap
70        arounds by the O/S so should be seemless to use.
71      </para>
72    </refsect1>
73 <  
73 >
74    <refsect1>
75      <title>Return Values</title>
76  
77      <para>
78        All network statistics return a pointer to a structure of type
79 <      <structname>network_stat_t</structname>.
79 >      <structname>sg_network_io_stats</structname>.
80      </para>
81  
82      <programlisting>
# Line 79 | Line 84 | typedef struct{
84          char *interface_name;
85          long long tx;
86          long long rx;
87 +        long long ipackets;
88 +        long long opackets;
89 +        long long ierrors;
90 +        long long oerrors;
91 +        long long collisions;
92          time_t systime;
93 < }network_stat_t;
93 > }sg_network_io_stats;
94      </programlisting>
95  
96      <variablelist>
# Line 117 | Line 127 | typedef struct{
127        </varlistentry>
128        <varlistentry>
129          <term>
130 +          <structfield>ipackets</structfield>
131 +        </term>
132 +        <listitem>
133 +          <para>
134 +            The number of packets received.
135 +          </para>
136 +        </listitem>
137 +      </varlistentry>
138 +      <varlistentry>
139 +        <term>
140 +          <structfield>opackets</structfield>
141 +        </term>
142 +        <listitem>
143 +          <para>
144 +            The number of packets transmitted.
145 +          </para>
146 +        </listitem>
147 +      </varlistentry>
148 +      <varlistentry>
149 +        <term>
150 +          <structfield>ierrors</structfield>
151 +        </term>
152 +        <listitem>
153 +          <para>
154 +            The number of receive errors.
155 +          </para>
156 +        </listitem>
157 +      </varlistentry>
158 +      <varlistentry>
159 +        <term>
160 +          <structfield>oerrors</structfield>
161 +        </term>
162 +        <listitem>
163 +          <para>
164 +            The number of transmit errors.
165 +          </para>
166 +        </listitem>
167 +      </varlistentry>
168 +      <varlistentry>
169 +        <term>
170 +          <structfield>collisions</structfield>
171 +        </term>
172 +        <listitem>
173 +          <para>
174 +            The number of collisions.
175 +          </para>
176 +        </listitem>
177 +      </varlistentry>
178 +      <varlistentry>
179 +        <term>
180            <structfield>systime</structfield>
181          </term>
182          <listitem>
183            <para>
184 <            The time period over which tx and rx were transferred.
184 >            The time period over which <parameter>tx</parameter>
185 >            and <parameter>rx</parameter> were transferred.
186            </para>
187          </listitem>
188        </varlistentry>
# Line 132 | Line 193 | typedef struct{
193      <title>Bugs</title>
194      <para>
195        On the very first call
196 <      <function>get_network_stats_diff</function> will return the same
197 <      as <function>get_network_stats</function>. After the first call
196 >      <function>sg_get_network_io_stats_diff</function> will return the same
197 >      as <function>sg_get_network_io_stats</function>. After the first call
198        it will always return the difference.
199      </para>
200      <para>
201        On operating system that hold only 32bits of data there is a
202        problem if the values wrap twice. For example, on Solaris 7 if
203        9GB is transferred and the operating system wraps at 4GB, the
204 <      <function>get_network_stats_diff</function> function will return
204 >      <function>sg_get_network_io_stats_diff</function> function will return
205        5GB.
206      </para>
207    </refsect1>
208  
209    <refsect1>
210      <title>See Also</title>
211 <    <para>Nothing yet</para>
211 >
212 >    <simplelist type="inline">
213 >      <member>
214 >        <citerefentry>
215 >          <refentrytitle>statgrab</refentrytitle>
216 >          <manvolnum>3</manvolnum>
217 >        </citerefentry>
218 >      </member>
219 >    </simplelist>
220    </refsect1>
221 <  
221 >
222    <refsect1>
223      <title>Website</title>
224 <    
224 >
225      <simplelist type="vert">
226        <member>
227 <        <ulink url="http://www.i-scream.org">http://www.i-scream.org</ulink>
227 >        <ulink url="http://www.i-scream.org/libstatgrab/">
228 >          http://www.i-scream.org/libstatgrab/
229 >        </ulink>
230        </member>
231      </simplelist>
232    </refsect1>

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines