2.8.3 Exercise: Displaying Read and Write I/O Throughput Separately

Create a version of diskact.d that aggregates the results separately for reading from, and writing to, block devices. Use a tick probe to collect data for 10 seconds.

  • In the actions for io:::start and io:::done, assign the value of args[0]->b_flags & B_READ ? "READ" : "WRITE" to the variable iodir.

  • In the actions for io:::start and io:::done, add iodir as a key to the start[] associative array.

  • In the action for io:::done, add iodir as a key to the anonymous aggregation variable @[].

  • Modify the format string for printa() to display the value of the iodir key.

(Estimated completion time: 20 minutes)