MCPcopy Create free account
hub / github.com/cortexproject/cortex / getMapsCount

Method getMapsCount

pkg/util/process/collector.go:79–93  ·  view source on GitHub ↗

getMapsCount returns the number of memory map ares the process has allocated.

()

Source from the content-addressed store, hash-verified

77
78// getMapsCount returns the number of memory map ares the process has allocated.
79func (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.
96func (c *processCollector) getMapsCountLimit() (float64, error) {

Callers 1

CollectMethod · 0.95

Calls 4

processMapsPathFunction · 0.85
CloseMethod · 0.65
ScanMethod · 0.65
ErrMethod · 0.65

Tested by

no test coverage detected