...
1
16
17 package v2
18
19 import "fmt"
20
21 type IOType string
22
23 const (
24 ReadBPS IOType = "rbps"
25 WriteBPS IOType = "wbps"
26 ReadIOPS IOType = "riops"
27 WriteIOPS IOType = "wiops"
28 )
29
30 type BFQ struct {
31 Weight uint16
32 }
33
34 type Entry struct {
35 Type IOType
36 Major int64
37 Minor int64
38 Rate uint64
39 }
40
41 func (e Entry) String() string {
42 return fmt.Sprintf("%d:%d %s=%d", e.Major, e.Minor, e.Type, e.Rate)
43 }
44
45 type IO struct {
46 BFQ BFQ
47 Max []Entry
48 }
49
50 func (i *IO) Values() (o []Value) {
51 if i.BFQ.Weight != 0 {
52 o = append(o, Value{
53 filename: "io.bfq.weight",
54 value: i.BFQ.Weight,
55 })
56 }
57 for _, e := range i.Max {
58 o = append(o, Value{
59 filename: "io.max",
60 value: e.String(),
61 })
62 }
63 return o
64 }
65
View as plain text