getMapsCount returns the number of memory map ares the process has allocated.
()
| 77 | |
| 78 | // getMapsCount returns the number of memory map ares the process has allocated. |
| 79 | func (c *processCollector) getMapsCount() (float64, error) { |
| 80 | file, err := os.Open(processMapsPath(c.procMountPoint, c.pid)) |
| 81 | if err != nil { |
| 82 | return 0, err |
| 83 | } |
| 84 | defer file.Close() |
| 85 | |
| 86 | count := 0 |
| 87 | scan := bufio.NewScanner(file) |
| 88 | for scan.Scan() { |
| 89 | count++ |
| 90 | } |
| 91 | |
| 92 | return float64(count), scan.Err() |
| 93 | } |
| 94 | |
| 95 | // getMapsCountLimit returns the maximum of memory map ares the process can allocate. |
| 96 | func (c *processCollector) getMapsCountLimit() (float64, error) { |
no test coverage detected