views:

126

answers:

2

I need to measure the performance of a hard disk using python. What is the best/fastest/shortest/easiest approach to do it? It doesn't have to be overly accurate, just a ballpark value.

My actual goal is to write a small utility which will adjust the postgres settings to the best configuration for the given hardware.

My naive approach would be to write some files and measure the time how long it would take. I would try it for several block sizes, and then I would try to access some random positions within a large file. Any other ideas?

+1  A: 

Start here: http://www.acnc.com/benchmarks.html

Get the source for one you like write something like it in Python.

S.Lott
+2  A: 

I would think your best bet would be using an external tool, Bonnie++ for example, and parse the program output. Even if you're not that concerned with precision there's no reason to reinvent the wheel. Why rewrite what's already there?

Hans Lawrenz
I just don't want to have the user to install another tool. Also it should be platform independent and I would have to explain where to get the binaries for MacOSX and so on. But you are right in so far that I could provide the possibility to read the output of bonnie as well.
Mauli