| 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"> |
| 6 |
> |
<refentry id="sg_get_disk_io_stats"> |
| 7 |
|
|
| 8 |
|
<refentryinfo> |
| 9 |
|
<date>$Date$</date> |
| 10 |
|
<releaseinfo>$Id$</releaseinfo> |
| 11 |
|
</refentryinfo> |
| 12 |
< |
|
| 12 |
> |
|
| 13 |
|
<refmeta> |
| 14 |
< |
<refentrytitle>get_diskio_stats</refentrytitle> |
| 14 |
> |
<refentrytitle>sg_get_disk_io_stats</refentrytitle> |
| 15 |
|
<manvolnum>3</manvolnum> |
| 16 |
|
<refmiscinfo>i-scream</refmiscinfo> |
| 17 |
|
</refmeta> |
| 18 |
< |
|
| 18 |
> |
|
| 19 |
|
<refnamediv> |
| 20 |
< |
<refname>get_diskio_stats</refname> |
| 21 |
< |
<refname>get_diskio_stats_diff</refname> |
| 20 |
> |
<refname>sg_get_disk_io_stats</refname> |
| 21 |
> |
<refname>sg_get_disk_io_stats_diff</refname> |
| 22 |
|
<refpurpose>get disk io statistics</refpurpose> |
| 23 |
|
</refnamediv> |
| 24 |
< |
|
| 24 |
> |
|
| 25 |
|
<refsynopsisdiv> |
| 26 |
|
<funcsynopsis> |
| 27 |
|
<funcsynopsisinfo>#include <statgrab.h></funcsynopsisinfo> |
| 28 |
|
<funcprototype> |
| 29 |
< |
<funcdef>diskio_stat_t *<function>get_diskio_stats</function></funcdef> |
| 29 |
> |
<funcdef>sg_disk_io_stats *<function>sg_get_disk_io_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> |
| 33 |
> |
<funcdef>sg_disk_io_stats *<function>sg_get_disk_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 disks the machine has. This is needed to know how many |
| 45 |
< |
<structname>diskio_stat_t</structname> structures have been |
| 45 |
> |
<structname>sg_disk_io_stats</structname> structures have been |
| 46 |
|
returned. A pointer is returned to the first |
| 47 |
< |
<structname>diskio_stat_t</structname>. |
| 47 |
> |
<structname>sg_disk_io_stats</structname>. |
| 48 |
|
</para> |
| 49 |
|
<para> |
| 50 |
< |
<function>get_diskio_stats</function> returns the disk IO stored |
| 50 |
> |
<function>sg_get_disk_io_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 |
| 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 |
| 58 |
> |
<function>sg_get_disk_io_stats_diff</function> is the same as |
| 59 |
> |
<function>sg_get_disk_io_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 |
| 61 |
> |
<function>sg_get_disk_io_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 |
| 75 |
|
<function>statgrab_init</function> is called. |
| 76 |
|
</para> |
| 77 |
|
</refsect1> |
| 78 |
< |
|
| 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>. |
| 84 |
> |
<structname>sg_disk_io_stats</structname>. |
| 85 |
|
</para> |
| 86 |
|
|
| 87 |
|
<programlisting> |
| 90 |
|
long long read_bytes; |
| 91 |
|
long long write_bytes; |
| 92 |
|
time_t systime; |
| 93 |
< |
}diskio_stat_t; |
| 93 |
> |
}sg_disk_io_stats; |
| 94 |
|
</programlisting> |
| 95 |
|
|
| 96 |
|
<variablelist> |
| 132 |
|
<listitem> |
| 133 |
|
<para> |
| 134 |
|
The time period over which <parameter>read_bytes</parameter> |
| 135 |
< |
and <parameter>write_bytes</parameter> were transferred. |
| 135 |
> |
and <parameter>write_bytes</parameter> were transferred. |
| 136 |
|
</para> |
| 137 |
|
</listitem> |
| 138 |
|
</varlistentry> |
| 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>. |
| 145 |
> |
On the very first call <function>sg_get_disk_io_stats_diff</function> |
| 146 |
> |
will return the same as <function>sg_get_disk_io_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 |
| 153 |
> |
<function>sg_get_disk_io_stats_diff</function> function will return |
| 154 |
|
5GB. |
| 155 |
|
</para> |
| 156 |
|
</refsect1> |
| 167 |
|
</member> |
| 168 |
|
</simplelist> |
| 169 |
|
</refsect1> |
| 170 |
< |
|
| 170 |
> |
|
| 171 |
|
<refsect1> |
| 172 |
|
<title>Website</title> |
| 173 |
< |
|
| 173 |
> |
|
| 174 |
|
<simplelist type="vert"> |
| 175 |
|
<member> |
| 176 |
|
<ulink url="http://www.i-scream.org/libstatgrab/"> |