Skip to content

Commit

Permalink
Modify cpu_solaris to support Sorlais 10
Browse files Browse the repository at this point in the history
  • Loading branch information
Chad Harp committed Jun 2, 2019
1 parent 354718b commit 16b37cc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cpu/cpu_solaris.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,13 @@ func TimesWithContext(ctx context.Context, percpu bool) ([]TimesStat, error) {
kern := make(map[float64]float64)
iowt := make(map[float64]float64)
//swap := make(map[float64]float64)
kstatSysOut, err := invoke.CommandWithContext(ctx, kstatSys, "-C", "cpu_stat:*:*:/^idle$|^user$|^kernel$|^iowait$|^swap$/")
kstatSysOut, err := invoke.CommandWithContext(ctx, kstatSys, "-p", "cpu_stat:*:*:/^idle$|^user$|^kernel$|^iowait$|^swap$/")
if err != nil {
return nil, fmt.Errorf("cannot execute kstat: %s", err)
}
re := regexp.MustCompile(`[:\s]+`)
for _, line := range strings.Split(bytes.NewBuffer(kstatSysOut).String(), "\n") {
fields := strings.Split(line, ":")
fields := re.Split(line, -1)
if fields[0] != "cpu_stat" {
continue
}
Expand Down

0 comments on commit 16b37cc

Please sign in to comment.