1 |
tdb |
1.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$</date> |
10 |
|
|
<releaseinfo>$Id$</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 <statgrab.h></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 |
|
|
</refsect1> |
70 |
|
|
|
71 |
|
|
<refsect1> |
72 |
|
|
<title>Return Values</title> |
73 |
|
|
|
74 |
|
|
<para> |
75 |
|
|
All diskio statistics return a pointer to a structure of type |
76 |
|
|
<structname>diskio_stat_t</structname>. |
77 |
|
|
</para> |
78 |
|
|
|
79 |
|
|
<programlisting> |
80 |
|
|
typedef struct{ |
81 |
|
|
char *disk_name; |
82 |
|
|
long long read_bytes; |
83 |
|
|
long long write_bytes; |
84 |
|
|
time_t systime; |
85 |
|
|
}diskio_stat_t; |
86 |
|
|
</programlisting> |
87 |
|
|
|
88 |
|
|
<variablelist> |
89 |
|
|
<varlistentry> |
90 |
|
|
<term> |
91 |
|
|
<structfield>disk_name</structfield> |
92 |
|
|
</term> |
93 |
|
|
<listitem> |
94 |
|
|
<para> |
95 |
|
|
The name known to the operating system. |
96 |
|
|
(eg. on linux it might be hda) |
97 |
|
|
</para> |
98 |
|
|
</listitem> |
99 |
|
|
</varlistentry> |
100 |
|
|
<varlistentry> |
101 |
|
|
<term> |
102 |
|
|
<structfield>read_bytes</structfield> |
103 |
|
|
</term> |
104 |
|
|
<listitem> |
105 |
|
|
<para> |
106 |
|
|
The number of bytes the disk has read. |
107 |
|
|
</para> |
108 |
|
|
</listitem> |
109 |
|
|
</varlistentry> |
110 |
|
|
<varlistentry> |
111 |
|
|
<term> |
112 |
|
|
<structfield>write_bytes</structfield> |
113 |
|
|
</term> |
114 |
|
|
<listitem> |
115 |
|
|
<para> |
116 |
|
|
The number of bytes the disk has written. |
117 |
|
|
</para> |
118 |
|
|
</listitem> |
119 |
|
|
</varlistentry> |
120 |
|
|
<varlistentry> |
121 |
|
|
<term> |
122 |
|
|
<structfield>systime</structfield> |
123 |
|
|
</term> |
124 |
|
|
<listitem> |
125 |
|
|
<para> |
126 |
|
|
The time period over which read_bytes and write_bytes |
127 |
|
|
were transferred. |
128 |
|
|
</para> |
129 |
|
|
</listitem> |
130 |
|
|
</varlistentry> |
131 |
|
|
</variablelist> |
132 |
|
|
</refsect1> |
133 |
|
|
|
134 |
|
|
<refsect1> |
135 |
|
|
<title>Bugs</title> |
136 |
|
|
<para> |
137 |
|
|
On the very first call <function>get_diskio_stats_diff</function> |
138 |
|
|
will return the same as <function>get_diskio_stats</function>. |
139 |
|
|
After the first call it will always return the difference. |
140 |
|
|
</para> |
141 |
|
|
<para> |
142 |
|
|
On operating systems that hold only 32bits of data there is a |
143 |
|
|
problem if the values wrap twice. For example, on Solaris 7 if |
144 |
|
|
9GB is transferred and the operating system wraps at 4GB, the |
145 |
|
|
<function>get_diskio_stats_diff</function> function will return |
146 |
|
|
5GB. |
147 |
|
|
</para> |
148 |
|
|
</refsect1> |
149 |
|
|
|
150 |
|
|
<refsect1> |
151 |
|
|
<title>See Also</title> |
152 |
|
|
<para>Nothing yet</para> |
153 |
|
|
</refsect1> |
154 |
|
|
|
155 |
|
|
<refsect1> |
156 |
|
|
<title>Website</title> |
157 |
|
|
|
158 |
|
|
<simplelist type="vert"> |
159 |
|
|
<member> |
160 |
|
|
<ulink url="http://www.i-scream.org">http://www.i-scream.org</ulink> |
161 |
|
|
</member> |
162 |
|
|
</simplelist> |
163 |
|
|
</refsect1> |
164 |
|
|
|
165 |
|
|
</refentry> |