jonatzin
jonatzin

Reputation: 972

Measuring Thread I/O in Java

I want to be able to measure thread I/O through code on my live/running application. So far the best (and only) solution I found is this one which requires me to hook directly into windows' performance monitor. However it seems very complex and there must be a simpler way to do this. I don't mind writing different code for Windows & Linux, to be honest I was expecting it.

Thanks for you help

Update:

So what I mean by Disk I/O is: If you open windows resource monitoring and go to the disk tab you can look at each process that is running and lock at the avg read/write of B/Sec over the last minute. I want to get the same data but per thread

Upvotes: 1

Views: 2459

Answers (1)

Nicholas
Nicholas

Reputation: 16056

Take a look at Hyperic Sigar. It is a cross-platform native resource Java API.

The class FileSystemUsage gives you a bunch of stats about file system usage (obvious...) such as

  • Disk Queue
  • Disk Writes / Disk Bytes Written
  • Disk Reads / Disk Reads Written

Most of them are cumulative, but you just compute a delta every n seconds to get a rate.

There's also a javaagent for profiling/monitoring file IO called JPicus. I have not looked at it in a while, but it may be useful.

Upvotes: 2

Related Questions