Skip to content

Commit e230f52

Browse files
authored
Merge pull request #1612 from eric1234/correct-process-counts
Total Processes in `MiscStat` Corrected
2 parents ce0395f + cded180 commit e230f52

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

load/load_linux.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func MiscWithContext(ctx context.Context) (*MiscStat, error) {
107107

108108
}
109109

110-
procsTotal, err := getProcsTotal(ctx)
110+
procsTotal, err := common.NumProcsWithContext(ctx)
111111
if err != nil {
112112
return ret, err
113113
}
@@ -116,14 +116,6 @@ func MiscWithContext(ctx context.Context) (*MiscStat, error) {
116116
return ret, nil
117117
}
118118

119-
func getProcsTotal(ctx context.Context) (int64, error) {
120-
values, err := readLoadAvgFromFile(ctx)
121-
if err != nil {
122-
return 0, err
123-
}
124-
return strconv.ParseInt(strings.Split(values[3], "/")[1], 10, 64)
125-
}
126-
127119
func readLoadAvgFromFile(ctx context.Context) ([]string, error) {
128120
loadavgFilename := common.HostProcWithContext(ctx, "loadavg")
129121
line, err := os.ReadFile(loadavgFilename)

0 commit comments

Comments
 (0)