Solved

# Measure my hard disk speed

Posted on 1997-06-06
309 Views
Hello, I know a little bit about C, I would like to have a source code in C (and the bynary too) that I can use to measure my hard disk speed (and probably another knid of hardware).

Can any of you help me please?.
0
Question by:aacosta
• 3

LVL 2

Accepted Solution

Slarti earned 90 total points
ID: 1251001
First, the problems:
There is no way to know the exact speed of your hard disk. This is because factors such as disk caching (both software and hardware) cause actual transfer rates to vary from the expected values. Programs like Norton Utilities' SysInfo regularly give results which are about 2-3 ms faster than the actual speed. If you really want to find out what your disk speed is, the best way is to either open up the computer and look at it (most disks have this info written on them, along with some other technical details), or look it up in the hard disk's spec sheets (which can probably be found online, and should also have come with your hard disk).

But, if you still want to code a program that will measure disk speed (for instance as part of a program like SysInfo), here's what you need to know:
Disk speeds are measured by two factors: sequential speed and random-access speed. Sequential speeds are mostly affected by the disk transfer rate (which is also a function of the controller). They are basically the amount of time you wait between two sector reads when the two sectors come one after the other. I.e., the disk doesn't have to spin very much to get to the next sector, which is why this speed depends mostly on the trasnfer rate.
Random-access speed is the average amount of time you wait between two sector reads when the sectors are chosen randomly (as opposed to being one after the other). On the average, the amount of time you will have to wait is equal to the amount of time the disk takes to rotate by 180 degrees.
To do these tests, you will first have to find the number of sectors in the hard disk. The interrupts INT 41h and INT 46h are good for this purpose if you have an IDE. (Technical info about these interrupts can be found at http://www.ctyme.com/intr/rb-5790.htm).
You will then need to read sectors as described above. You can use the BIOS Int 13h, function 0Ah to do this (info about this interrupt at http://www.ctyme.com/intr/rb-0546.htm).

You should probably perform the tests many times (say 100 or so), so that the timing will be more accurate. Remember the PC timer only has an accurate of 1/55 sec.

If the above interrupt talk is above your level (you said you know "a little bit about C"), there are C functions defined in DOS.H which can be used to generate interrupts. (Do this in DOS mode - in Windows there are zillions of other factors affecting hard disk performance). The geninterrupt() function is an example. However, remember that interrupts reach right down into the heart of the computer and start messing around with what they find there, so novice programmers should be careful with these functions, especially when they involve disk access. However, if you do want to measure the actual disk speed, this is the way to do it.
0

LVL 1

Author Comment

ID: 1251002
Excellent, your answer was great. I gonna try everything what you say, but if you can send my a C code to aacosta@c-com.net
it would be great.

Thanks.
0

LVL 1

Author Comment

ID: 1251003
Excellent, your answer was great. I gonna try everything what you say, but if you can send my a C code to aacosta@c-com.net
It would be great.

Thanks.
0

LVL 1

Author Comment

ID: 1251004
Hello, again, I've been trying to use the interrupts you suggested me but my computer always hang up (I have not damage anything).
Do you know someone or somewhere I can find the source code I need?
Thanks again, bye.
0

## Featured Post

### Suggested Solutions

In our personal lives, we have well-designed consumer apps to delight us and make even the most complex transactions simple. Many enterprise applications, however, are a bit behind the times. For an enterprise app to be successful in today's tech wo…
Skype is a P2P (Peer to Peer) instant messaging and VOIP (Voice over IP) service – as well as a whole lot more.
This video shows how use content aware, what it’s used for, and when to use it over other tools.