stats retrieves bcache runtime statistics for each bcache and priorityStats flag controls if we need to read priority_stats.
(priorityStats bool)
| 65 | // stats retrieves bcache runtime statistics for each bcache and |
| 66 | // priorityStats flag controls if we need to read priority_stats. |
| 67 | func (fs FS) stats(priorityStats bool) ([]*Stats, error) { |
| 68 | matches, err := filepath.Glob(fs.sys.Path("fs/bcache/*-*")) |
| 69 | if err != nil { |
| 70 | return nil, err |
| 71 | } |
| 72 | |
| 73 | stats := make([]*Stats, 0, len(matches)) |
| 74 | for _, uuidPath := range matches { |
| 75 | // "*-*" in glob above indicates the name of the bcache. |
| 76 | name := filepath.Base(uuidPath) |
| 77 | |
| 78 | // stats |
| 79 | s, err := GetStats(uuidPath, priorityStats) |
| 80 | if err != nil { |
| 81 | return nil, err |
| 82 | } |
| 83 | |
| 84 | s.Name = name |
| 85 | stats = append(stats, s) |
| 86 | } |
| 87 | |
| 88 | return stats, nil |
| 89 | } |
| 90 | |
| 91 | // ParsePseudoFloat parses the peculiar format produced by bcache's bch_hprint. |
| 92 | func parsePseudoFloat(str string) (float64, error) { |
no test coverage detected