title: How to measure IOPS for a command in linux?
body: <p>I'm working on a simulation model, where I want to determine when the storage IOPS capacity becomes a bottleneck (e.g. and HDD has ~150 IOPS, while an SSD can have 150,000). So I'm trying to come up with a way to benchmark IOPS in a command (git) for some of it's different operations (push, pull, merge, clone). </p>
  
  <p>So far, I have found tools like iostat, however, I am not sure how to limit the report to what a single command does.</p>
  
  <p>The best idea I can come up with is to determine my HDD IOPS capacity, use time on the actual command, see how long it lasts, multiply that by IOPS and those are my IOPS:</p>
  
  <pre><code>HDD -&gt;150 IOPS
  time df -h
  
  real    0m0.032s
  
  150 * .032 = 4.8 IOPS
  </code></pre>
  
  <p>But, this is of course very stupid, because the duration of the execution may have been related to CPU usage rather than HDD usage, so unless usage of HDD was 100% for that time, it makes no sense to measure things like that.</p>
  
  <p>So, how can I measure the IOPS for a command?</p>