ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/docs/diskio.txt
Revision: 1.1
Committed: Wed Jun 4 16:24:52 2003 UTC (20 years, 11 months ago) by pajs
Content type: text/plain
Branch: MAIN
Log Message:
Diskio doc's... Prob needs some serious proof reading :)

File Contents

# Content
1 Diskio Statistics
2
3 All diskio statistics return a diskio_stat_t structure.
4
5 typedef struct{
6 char *disk_name;
7 long long read_bytes;
8 long long write_bytes;
9 time_t systime;
10 }diskio_stat_t;
11
12 disk_name is the name know to the OS. E.g. hda on linux.
13 read_bytes is the number of bytes that disk has read.
14 write_bytes is the number of bytes that disk has written.
15 sysname is time_t covering the time the amount of data in rx/tx was
16 generated.
17
18 diskio_stat_t *get_diskio_stats(int *entries);
19
20 diskio_stat_t *get_diskio_stats_diff(int *entries);
21
22 Both calls take a pointer to an int, "entries". This is filled with the number
23 of disks the machine has. You need to know this to know how many diskio_stat_t
24 have been returned.
25
26 get_diskio_stats returns the disk io stored in the kernel. E.g.
27 since bootup as long as the way it is stored in the kernel can store a large
28 enough number. Solaris 7 can not, it only stores it in a 32bit int, so it
29 can only store upto 4gb before it will wrap around. Solaris 8 upwards stores
30 it in a 64bit int and so is a very large number :)
31
32 get_diskio_stats_diff is the same as get_diskio_stats except it will
33 return the difference since the last call. So, for instance a call to
34 get_diskio_stats_diff is made, and called again 5 seconds later. Over that
35 time, 2000 bytes of traffic was written and 10000 bytes read. write_bytes will
36 store 2000 bytes, read_bytes will store 10000 and systime will store 5. This
37 function copes with wrap arounds by the O/S so should be seemless to use.
38
39 Bugs:
40 get_diskio_stats_diff on very first call will return the same as
41 get_diskio_stats. After first call it will always return the difference.
42 On machines that hold only 32bits of information, if the call is made 2x
43 wrap around (eg sol7 9gb has been transferred, and it wraps at 4gb) it will
44 return incorrect results (case above, it would say 5gb transferred).
45
46 Very basic example in examples/disk_traffic.c