@@ -590,12 +590,16 @@ module Stats_value = struct
590590 type t = {
591591 rd_bytes : int64
592592 ; wr_bytes : int64
593+ ; ds_bytes : int64
593594 ; rd_avg_usecs : int64
594595 ; wr_avg_usecs : int64
596+ ; ds_avg_usecs : int64
595597 ; io_throughput_read_mb : float
596598 ; io_throughput_write_mb : float
599+ ; io_throughput_discard_mb : float
597600 ; iops_read : int64
598601 ; iops_write : int64
602+ ; iops_discard : int64
599603 ; iowait : float
600604 ; inflight : int64
601605 }
@@ -604,12 +608,16 @@ module Stats_value = struct
604608 {
605609 rd_bytes= 0L
606610 ; wr_bytes= 0L
611+ ; ds_bytes= 0L
607612 ; rd_avg_usecs= 0L
608613 ; wr_avg_usecs= 0L
614+ ; ds_avg_usecs= 0L
609615 ; io_throughput_read_mb= 0.
610616 ; io_throughput_write_mb= 0.
617+ ; io_throughput_discard_mb= 0.
611618 ; iops_read= 0L
612619 ; iops_write= 0L
620+ ; iops_discard= 0L
613621 ; iowait= 0.
614622 ; inflight= 0L
615623 }
@@ -632,6 +640,7 @@ module Stats_value = struct
632640 {
633641 rd_bytes= stats_diff_get 13
634642 ; wr_bytes= stats_diff_get 14
643+ ; ds_bytes= 0L
635644 ; rd_avg_usecs=
636645 ( if stats_diff_get 0 > 0L then
637646 Int64. div (stats_diff_get 3 ) (stats_diff_get 0 )
@@ -644,10 +653,13 @@ module Stats_value = struct
644653 else
645654 0L
646655 )
656+ ; ds_avg_usecs= 0L
647657 ; io_throughput_read_mb= to_float (stats_diff_get 13 ) /. 1048576.
648658 ; io_throughput_write_mb= to_float (stats_diff_get 14 ) /. 1048576.
659+ ; io_throughput_discard_mb= 0.
649660 ; iops_read= stats_diff_get 0
650661 ; iops_write= stats_diff_get 4
662+ ; iops_discard= 0L
651663 ; iowait= to_float (stats_diff_get 10 ) /. 1000.
652664 ; inflight= stats_get 8
653665 }
@@ -686,12 +698,16 @@ module Stats_value = struct
686698 {
687699 rd_bytes= Int64. mul (get_stats_read_sectors s3) 512L
688700 ; wr_bytes= Int64. mul (get_stats_write_sectors s3) 512L
701+ ; ds_bytes= Int64. mul (get_stats_discard_sectors s3) 512L
689702 ; rd_avg_usecs=
690703 avg_reqs_completed_last_five_secs get_stats_read_reqs_completed
691704 get_stats_read_total_ticks
692705 ; wr_avg_usecs=
693706 avg_reqs_completed_last_five_secs get_stats_write_reqs_completed
694707 get_stats_write_total_ticks
708+ ; ds_avg_usecs=
709+ avg_reqs_completed_last_five_secs get_stats_discard_reqs_completed
710+ get_stats_discard_total_ticks
695711 ; io_throughput_read_mb=
696712 to_float
697713 (get_stats_read_sectors s3 -- opt get_stats_read_sectors last_s3)
@@ -702,12 +718,22 @@ module Stats_value = struct
702718 (get_stats_write_sectors s3 -- opt get_stats_write_sectors last_s3)
703719 *. 512.
704720 /. 1048576.
721+ ; io_throughput_discard_mb=
722+ to_float
723+ (get_stats_discard_sectors s3
724+ -- opt get_stats_discard_sectors last_s3
725+ )
726+ *. 512.
727+ /. 1048576.
705728 ; iops_read=
706729 get_stats_read_reqs_completed s3
707730 -- opt get_stats_read_reqs_completed last_s3
708731 ; iops_write=
709732 get_stats_write_reqs_completed s3
710733 -- opt get_stats_write_reqs_completed last_s3
734+ ; iops_discard=
735+ get_stats_discard_reqs_completed s3
736+ -- opt get_stats_discard_reqs_completed last_s3
711737 ; iowait=
712738 to_float
713739 (get_stats_read_total_ticks s3
@@ -736,12 +762,17 @@ module Stats_value = struct
736762 ; rd_avg_usecs= acc.rd_avg_usecs ++ v.rd_avg_usecs
737763 ; wr_bytes= acc.wr_bytes ++ v.wr_bytes
738764 ; wr_avg_usecs= acc.wr_avg_usecs ++ v.wr_avg_usecs
765+ ; ds_bytes= acc.ds_bytes ++ v.ds_bytes
766+ ; ds_avg_usecs= acc.ds_avg_usecs ++ v.ds_avg_usecs
739767 ; io_throughput_read_mb=
740768 acc.io_throughput_read_mb +. v.io_throughput_read_mb
741769 ; io_throughput_write_mb=
742770 acc.io_throughput_write_mb +. v.io_throughput_write_mb
771+ ; io_throughput_discard_mb=
772+ acc.io_throughput_discard_mb +. v.io_throughput_discard_mb
743773 ; iops_read= acc.iops_read ++ v.iops_read
744774 ; iops_write= acc.iops_write ++ v.iops_write
775+ ; iops_discard= acc.iops_discard ++ v.iops_discard
745776 ; iowait= acc.iowait +. v.iowait
746777 ; inflight= acc.inflight ++ v.inflight
747778 }
@@ -763,6 +794,12 @@ module Stats_value = struct
763794 ~value: (Rrd. VT_Int64 value.wr_bytes) ~ty: Rrd. Derive ~units: " B/s"
764795 ~min: 0.0 ()
765796 )
797+ ; ( owner
798+ , ds_make ~name: (key_format " discard" )
799+ ~description: (" Discards from device " ^ name ^ " , in B/s" )
800+ ~value: (Rrd. VT_Int64 value.ds_bytes) ~ty: Rrd. Derive ~units: " B/s"
801+ ~min: 0.0 ()
802+ )
766803 ; ( owner
767804 , ds_make
768805 ~name: (key_format " read_latency" )
@@ -778,6 +815,14 @@ module Stats_value = struct
778815 ~value: (Rrd. VT_Int64 value.wr_avg_usecs) ~ty: Rrd. Gauge ~units: " μs"
779816 ~min: 0.0 ()
780817 )
818+ ; ( owner
819+ , ds_make
820+ ~name: (key_format " discard_latency" )
821+ ~description:
822+ (" Discard latency from device " ^ name ^ " , in microseconds" )
823+ ~value: (Rrd. VT_Int64 value.ds_avg_usecs) ~ty: Rrd. Gauge ~units: " μs"
824+ ~min: 0.0 ()
825+ )
781826 ; ( owner
782827 , ds_make
783828 ~name: (key_format " io_throughput_read" )
@@ -792,6 +837,13 @@ module Stats_value = struct
792837 ~value: (Rrd. VT_Float value.io_throughput_write_mb) ~ty: Rrd. Absolute
793838 ~units: " MiB/s" ~min: 0. ()
794839 )
840+ ; ( owner
841+ , ds_make
842+ ~name: (key_format " io_throughput_discard" )
843+ ~description: (" Data discard to the " ^ name ^ " , in MiB/s" )
844+ ~value: (Rrd. VT_Float value.io_throughput_discard_mb) ~ty: Rrd. Absolute
845+ ~units: " MiB/s" ~min: 0. ()
846+ )
795847 ; ( owner
796848 , ds_make
797849 ~name: (key_format " io_throughput_total" )
@@ -814,10 +866,22 @@ module Stats_value = struct
814866 ~value: (Rrd. VT_Int64 value.iops_write) ~ty: Rrd. Absolute
815867 ~units: " requests/s" ~min: 0. ()
816868 )
869+ ; ( owner
870+ , ds_make
871+ ~name: (key_format " iops_discard" )
872+ ~description: " Discard requests per second"
873+ ~value: (Rrd. VT_Int64 value.iops_discard) ~ty: Rrd. Absolute
874+ ~units: " requests/s" ~min: 0. ()
875+ )
817876 ; ( owner
818877 , ds_make ~name: (key_format " iops_total" )
819878 ~description: " I/O Requests per second"
820- ~value: (Rrd. VT_Int64 (Int64. add value.iops_read value.iops_write))
879+ ~value:
880+ (Rrd. VT_Int64
881+ (Int64. add value.iops_read
882+ (Int64. add value.iops_write value.iops_discard)
883+ )
884+ )
821885 ~ty: Rrd. Absolute ~units: " requests/s" ~min: 0. ()
822886 )
823887 ; ( owner
@@ -855,15 +919,19 @@ module Iostats_value = struct
855919 let s3_usecs =
856920 get_stats_read_total_ticks s3
857921 ++ get_stats_write_total_ticks s3
922+ ++ get_stats_discard_total_ticks s3
858923 -- (opt get_stats_read_total_ticks last_s3
859924 ++ opt get_stats_write_total_ticks last_s3
925+ ++ opt get_stats_discard_total_ticks last_s3
860926 )
861927 in
862928 let s3_count =
863929 get_stats_read_reqs_completed s3
864930 ++ get_stats_write_reqs_completed s3
931+ ++ get_stats_discard_reqs_completed s3
865932 -- (opt get_stats_read_reqs_completed last_s3
866933 ++ opt get_stats_write_reqs_completed last_s3
934+ ++ opt get_stats_discard_reqs_completed last_s3
867935 )
868936 in
869937 let s3_latency_average =
@@ -874,8 +942,10 @@ module Iostats_value = struct
874942 to_float
875943 (get_stats_read_total_ticks s3
876944 ++ get_stats_write_total_ticks s3
945+ ++ get_stats_discard_total_ticks s3
877946 -- (opt get_stats_read_total_ticks last_s3
878947 ++ opt get_stats_write_total_ticks last_s3
948+ ++ opt get_stats_discard_total_ticks last_s3
879949 )
880950 )
881951 /. 1000_000.0
0 commit comments