1
0
Fork 0
golang-github-gofiber-fiber/internal/gopsutil/load/load_solaris.go
Daniel Baumann 6d002e9543
Adding upstream version 2.52.6.
Signed-off-by: Daniel Baumann <daniel@debian.org>
2025-05-17 06:50:16 +02:00

44 lines
794 B
Go

//go:build solaris
package load
import (
"context"
"os/exec"
"strings"
"github.com/gofiber/fiber/v2/internal/gopsutil/common"
)
func Avg() (*AvgStat, error) {
return AvgWithContext(context.Background())
}
func AvgWithContext(ctx context.Context) (*AvgStat, error) {
return nil, common.ErrNotImplementedError
}
func Misc() (*MiscStat, error) {
return MiscWithContext(context.Background())
}
func MiscWithContext(ctx context.Context) (*MiscStat, error) {
bin, err := exec.LookPath("ps")
if err != nil {
return nil, err
}
out, err := invoke.CommandWithContext(ctx, bin, "-efo", "s")
if err != nil {
return nil, err
}
lines := strings.Split(string(out), "\n")
ret := MiscStat{}
for _, l := range lines {
if l == "O" {
ret.ProcsRunning++
}
}
return &ret, nil
}