summaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorSean E. Russell <ser@ser1.net>2020-06-26 11:50:15 -0500
committerSean E. Russell <ser@ser1.net>2020-06-26 11:50:15 -0500
commit9b176e678e8535bc72bede4f4b95318ce207644a (patch)
tree8b3f6595ffe0074587b5bf5f4b64189c8dc0b7fb /widgets
parent050b62a20a6250bac7bf1549e7cfeaf2bb7c5494 (diff)
Work-around for bug shirou/gopsutil#849, addressing #135
Diffstat (limited to 'widgets')
-rw-r--r--widgets/proc.go5
-rw-r--r--widgets/proc_linux.go1
2 files changed, 3 insertions, 3 deletions
diff --git a/widgets/proc.go b/widgets/proc.go
index f47f646..218ba63 100644
--- a/widgets/proc.go
+++ b/widgets/proc.go
@@ -9,9 +9,8 @@ import (
"strings"
"time"
- psCPU "github.com/shirou/gopsutil/cpu"
-
tui "github.com/gizak/termui/v3"
+ "github.com/xxxserxxx/gotop/v4/devices"
ui "github.com/xxxserxxx/gotop/v4/termui"
"github.com/xxxserxxx/gotop/v4/utils"
)
@@ -49,7 +48,7 @@ type ProcWidget struct {
}
func NewProcWidget() *ProcWidget {
- cpuCount, err := psCPU.Counts(false)
+ cpuCount, err := devices.CpuCount()
if err != nil {
log.Printf("failed to get CPU count from gopsutil: %v", err)
}
diff --git a/widgets/proc_linux.go b/widgets/proc_linux.go
index 164319d..8fb53a0 100644
--- a/widgets/proc_linux.go
+++ b/widgets/proc_linux.go
@@ -19,6 +19,7 @@ func getProcs() ([]Proc, error) {
procs := []Proc{}
for _, line := range linesOfProcStrings {
+ log.Printf("line is '%s', pid is '%s', cpu is '%s', mem is '%s'", line, strings.TrimSpace(line[0:10]), strings.TrimSpace(line[63:68]), strings.TrimSpace(line[69:74]))
pid, err := strconv.Atoi(strings.TrimSpace(line[0:10]))
if err != nil {
log.Printf("failed to convert PID to int: %v. line: %v", err, line)