• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to count logical reads

 
Raviteja Penki
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys,

i wrote a program which stress tests the io. in that process i am creating some files and reading those again for some span.
i want to know how many logical reads done while reading.

how can i get this by using java


Thank you
 
Greg Charles
Sheriff
Posts: 3010
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to Java Ranch!

I'm not completely clear on the definition of logical reads, but you could subclass FileInputStream, and override the three read() methods to increment a counter before calling the equivalent super.read() method.
 
Rob Spoor
Sheriff
Posts: 20821
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you need to add functionality to an existing InputStream you should extend FilterInputStream instead; that way you can use it with any InputStream you want.
 
Raviteja Penki
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
logical read in the sense, reads done from cache,
where as physical read in the sense, reads done from disk.
 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cache? Are you talking about input from files? And you wanted to know how many reads from a file actually came from something which the operating system had cached?

You aren't even likely to get the operating system to tell you that. From Java? Forget about it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!