Code

Add FreeBSD submit_io_time to disk plugin
authorKevin Bowling <kbowling@llnw.com>
Mon, 4 Apr 2016 09:13:08 +0000 (02:13 -0700)
committerKevin Bowling <kbowling@llnw.com>
Mon, 4 Apr 2016 09:13:08 +0000 (02:13 -0700)
src/disk.c

index 05a863fb01666cd1764c880cc462c30e337738d6..1dbdd9de543cca3fe65315a561b4d494e2e62dcc 100644 (file)
@@ -536,7 +536,7 @@ static int disk_read (void)
        struct gident *geom_id;
 
        const char *disk_name;
-       long double read_time, write_time;
+       long double read_time, write_time, busy_time, total_duration;
 
        for (retry = 0, dirty = 1; retry < 5 && dirty == 1; retry++) {
                if (snap != NULL)
@@ -631,6 +631,16 @@ static int disk_read (void)
                        disk_submit (disk_name, "disk_time",
                                        (derive_t)(read_time*1000), (derive_t)(write_time*1000));
                }
+               if (devstat_compute_statistics(snap_iter, NULL, 1.0,
+                   DSM_TOTAL_BUSY_TIME, &busy_time,
+                   DSM_TOTAL_DURATION, &total_duration,
+                   DSM_NONE) != 0) {
+                       WARNING("%s", devstat_errbuf);
+               }
+               else
+               {
+                       submit_io_time(disk_name, busy_time, total_duration);
+               }
        }
        geom_stats_snapshot_free(snap);