Subject: nore on disk stats
To: None <tech-kern@NetBSD.ORG>
From: Jason Thorpe <>
List: tech-kern
Date: 11/09/1995 16:56:30
Ok, so I have the kernel portions about 80% done.  It all compiles, 
and seems to run fine.  So far, about 50 files have changed.

With a suggestion from cgd, I have a mechanism that should pretty 
accurately calculate the amount of time a disk is busy, using 
timestamps.  My design has changed a little to adapt to implementation 
details, but is more-or-less the same.  In particular, functions were added:

	struct disk *disk_getfirst __P((void));
		Returns first disk in disklist.

	struct disk *disk_getnext __P((struct disk *));
		Returns next disk in disklist.

	struct disk *disk_find __P((char *));
		Returns the disk strucure corresponding to the
		provided name (e.g. "sd0" or "ccd3"), or NULL if no
		match is found.

	void disk_busy __P((struct disk *));
		Increments the busy count, sets starting timestamp if
		count moves from 0 to 1.

	void disk_unbusy __P((struct disk *));
		Decrements busy count, and sets ending timestamp and
		increments total busy time if count drops to 0.

Now, the question I have is, what units should data transfer rates be 
in?  As Mike Hibler pointed out to me, counting bytes/words/longs or even 
blocks could potentially wrap the counter very quickly on a busy 
fileserver, so it seems as if attempting to do so over the long-haul is 
dubious.  However, having information on the amount of data that's 
traveled in/out of a particular disk might be quite useful.

My idea is to add another argument to disk_unbusy(), that being the 
number of bytes that was use transfered.  When the busy count drops to 
zero, the average transfer rate can be calculated and merged with the 

Anyhow, I'd like to hear any comments or suggestions, particularly, what 
the most useful "size unit per time unit" combination would be.  Bytes 
per second pops into my head immediately, but seconds might be to grainy.


Jason R. Thorpe                             
NASA Ames Research Center                               Home: 408.866.1912
NAS: M/S 258-6                                          Work: 415.604.0935
Moffett Field, CA 94035                                Pager: 415.428.6939