ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/docs/get_diskio_stats.xml
Revision: 1.6
Committed: Sun May 2 09:35:15 2004 UTC (20 years ago) by tdb
Content type: text/xml
Branch: MAIN
CVS Tags: HEAD
Changes since 1.5: +2 -2 lines
State: FILE REMOVED
Log Message:
Do a repo copy of the documentation to their new names, then delete the old
ones. They still need their content updating though. We also need docs for
the new process stats stuff, the error reporting code, and I think the FS
stats which seem to be missing.

File Contents

# Content
1 <?xml version="1.0"?>
2
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_diskio_stats">
7
8 <refentryinfo>
9 <date>$Date: 2004/03/11 17:35:24 $</date>
10 <releaseinfo>$Id: get_diskio_stats.xml,v 1.5 2004/03/11 17:35:24 tdb Exp $</releaseinfo>
11 </refentryinfo>
12
13 <refmeta>
14 <refentrytitle>get_diskio_stats</refentrytitle>
15 <manvolnum>3</manvolnum>
16 <refmiscinfo>i-scream</refmiscinfo>
17 </refmeta>
18
19 <refnamediv>
20 <refname>get_diskio_stats</refname>
21 <refname>get_diskio_stats_diff</refname>
22 <refpurpose>get disk io statistics</refpurpose>
23 </refnamediv>
24
25 <refsynopsisdiv>
26 <funcsynopsis>
27 <funcsynopsisinfo>#include &lt;statgrab.h&gt;</funcsynopsisinfo>
28 <funcprototype>
29 <funcdef>diskio_stat_t *<function>get_diskio_stats</function></funcdef>
30 <paramdef>int *<parameter>entries</parameter></paramdef>
31 </funcprototype>
32 <funcprototype>
33 <funcdef>diskio_stat_t *<function>get_diskio_stats_diff</function></funcdef>
34 <paramdef>int *<parameter>entries</parameter></paramdef>
35 </funcprototype>
36 </funcsynopsis>
37 </refsynopsisdiv>
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 disks the machine has. This is needed to know how many
45 <structname>diskio_stat_t</structname> structures have been
46 returned. A pointer is returned to the first
47 <structname>diskio_stat_t</structname>.
48 </para>
49 <para>
50 <function>get_diskio_stats</function> returns the disk IO stored
51 in the kernel which holds the amount of data transferred since
52 bootup. On some platforms, such as Solaris 7, this value is
53 stored in a 32bit int, so wraps around when it reaches 4GB. Other
54 platforms, such as Solaris 8, hold the value in a 64bit int,
55 which wraps somewhere near 17 million terabytes.
56 </para>
57 <para>
58 <function>get_diskio_stats_diff</function> is the same as
59 <function>get_diskio_stats</function> except it will return the
60 difference since the last call. So, for instance a call to
61 <function>get_diskio_stats_diff</function> is made, and called
62 again 5 seconds later. Over that time, 2000 bytes of traffic were
63 written and 10000 bytes read. <parameter>write_bytes</parameter>
64 will store 2000 bytes, <parameter>read_bytes</parameter> will
65 store 10000, and <parameter>systime</parameter> will store 5.
66 This function copes with wrap arounds by the O/S so should be
67 seemless to use.
68 </para>
69 <para>
70 On Solaris libstatgrab will attempt to get the cXtXdXsX
71 representation for the <varname>disk_name</varname> string. If
72 it fails it will use a name like sd0. On some systems programs
73 calling libstatgrab will need elevated privileges to lookup
74 some of the names. The mappings are built up when
75 <function>statgrab_init</function> is called.
76 </para>
77 </refsect1>
78
79 <refsect1>
80 <title>Return Values</title>
81
82 <para>
83 All diskio statistics return a pointer to a structure of type
84 <structname>diskio_stat_t</structname>.
85 </para>
86
87 <programlisting>
88 typedef struct{
89 char *disk_name;
90 long long read_bytes;
91 long long write_bytes;
92 time_t systime;
93 }diskio_stat_t;
94 </programlisting>
95
96 <variablelist>
97 <varlistentry>
98 <term>
99 <structfield>disk_name</structfield>
100 </term>
101 <listitem>
102 <para>
103 The name known to the operating system.
104 (eg. on linux it might be hda)
105 </para>
106 </listitem>
107 </varlistentry>
108 <varlistentry>
109 <term>
110 <structfield>read_bytes</structfield>
111 </term>
112 <listitem>
113 <para>
114 The number of bytes the disk has read.
115 </para>
116 </listitem>
117 </varlistentry>
118 <varlistentry>
119 <term>
120 <structfield>write_bytes</structfield>
121 </term>
122 <listitem>
123 <para>
124 The number of bytes the disk has written.
125 </para>
126 </listitem>
127 </varlistentry>
128 <varlistentry>
129 <term>
130 <structfield>systime</structfield>
131 </term>
132 <listitem>
133 <para>
134 The time period over which <parameter>read_bytes</parameter>
135 and <parameter>write_bytes</parameter> were transferred.
136 </para>
137 </listitem>
138 </varlistentry>
139 </variablelist>
140 </refsect1>
141
142 <refsect1>
143 <title>Bugs</title>
144 <para>
145 On the very first call <function>get_diskio_stats_diff</function>
146 will return the same as <function>get_diskio_stats</function>.
147 After the first call it will always return the difference.
148 </para>
149 <para>
150 On operating systems that hold only 32bits of data there is a
151 problem if the values wrap twice. For example, on Solaris 7 if
152 9GB is transferred and the operating system wraps at 4GB, the
153 <function>get_diskio_stats_diff</function> function will return
154 5GB.
155 </para>
156 </refsect1>
157
158 <refsect1>
159 <title>See Also</title>
160
161 <simplelist type="inline">
162 <member>
163 <citerefentry>
164 <refentrytitle>statgrab</refentrytitle>
165 <manvolnum>3</manvolnum>
166 </citerefentry>
167 </member>
168 </simplelist>
169 </refsect1>
170
171 <refsect1>
172 <title>Website</title>
173
174 <simplelist type="vert">
175 <member>
176 <ulink url="http://www.i-scream.org/libstatgrab/">
177 http://www.i-scream.org/libstatgrab/
178 </ulink>
179 </member>
180 </simplelist>
181 </refsect1>
182
183 </refentry>