0

I am working on getting 'Average read time (ms)' and 'Average write time(ms)' from "iostat -xnp" command.

In linux there is a '/proc/diskstats" command, which gives me 'Time spent in reading millis' and 'Time spent in writing millis and 'number of reads completed', and 'writes completed'. So, i can divide 'Time spent in reading' with 'Number of reads completed' to get the average read time(ms).

To derive the similar result, i am using the below equation. Please correct if its wrong.

example output of iostat:

------------------------
r/s    w/s   kr/s   kw/s wait actv wsvc_t asvc_t  %w  %b device
0.8    3.7   43.5   38.3  0.0  0.0    0.8    0.4   0   0 c0d0
0.0    0.0    0.0    0.0  0.0  0.0    0.0    0.1   0   0 c0t1d0
0.0    0.0    0.0    0.0  0.0  0.0    0.0    0.0   0   0 c2t1d0s2

Average_time_spent_reading(ms) = number_of_reads_per_second * average_service_time(ms)/(number_of_reads_per_second + number_of_writes_per_second) .

Average_time_spent_writing(ms) = number_of_writes_per_second * average_service_time(ms) /(number_of_reads_per_second + number_of_writes_per_second)

Thanks in advance.

  • Which version of Solaris? What files do you have in /usr/demo/dtrace? – Andrew Henle Feb 29 '16 at 10:35
2

You can solve this with DTrace - and if you use the DTrace Toolkit (http://www.brendangregg.com/dtracetoolkit.html) you can see how it's done. Solaris 11 and later let you pkg install system/dtrace/dtrace-toolkit; I think for Solaris 10 you'd need to grab it from Brendan's website directly.

  • Hi, dtrace is a solution, but i am not supposed to use it in my code. can i derive from iostat somehow? – Venkat Teki Mar 2 '16 at 9:29
  • you'd need to use libkstat. For an example of what you can see using libkstat, find out what sd instances you have, and run a command like kstat -p -m sd -i 18 (I've got an sd18). That'll show you all the reads, writes and other useful info. – James McPherson Mar 3 '16 at 23:09
  • Just bewere, however - every time you read a kstat, the entire kstat chain for the entire kernel is traversed. – James McPherson Mar 3 '16 at 23:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.