Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Total Processes in MiscStat Corrected #1612

Merged
merged 1 commit into from
Mar 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions load/load_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func MiscWithContext(ctx context.Context) (*MiscStat, error) {

}

procsTotal, err := getProcsTotal(ctx)
procsTotal, err := common.NumProcsWithContext(ctx)
if err != nil {
return ret, err
}
Expand All @@ -116,14 +116,6 @@ func MiscWithContext(ctx context.Context) (*MiscStat, error) {
return ret, nil
}

func getProcsTotal(ctx context.Context) (int64, error) {
values, err := readLoadAvgFromFile(ctx)
if err != nil {
return 0, err
}
return strconv.ParseInt(strings.Split(values[3], "/")[1], 10, 64)
}

func readLoadAvgFromFile(ctx context.Context) ([]string, error) {
loadavgFilename := common.HostProcWithContext(ctx, "loadavg")
line, err := os.ReadFile(loadavgFilename)
Expand Down
Loading