mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-03-04 21:07:30 +00:00
chore: remove depend of gopsutil
This commit is contained in:
@@ -6,8 +6,7 @@ import (
|
||||
|
||||
"github.com/metacubex/mihomo/common/atomic"
|
||||
"github.com/metacubex/mihomo/common/xsync"
|
||||
|
||||
"github.com/shirou/gopsutil/v4/process"
|
||||
"github.com/metacubex/mihomo/component/memory"
|
||||
)
|
||||
|
||||
var DefaultManager *Manager
|
||||
@@ -20,7 +19,7 @@ func init() {
|
||||
downloadBlip: atomic.NewInt64(0),
|
||||
uploadTotal: atomic.NewInt64(0),
|
||||
downloadTotal: atomic.NewInt64(0),
|
||||
process: &process.Process{Pid: int32(os.Getpid())},
|
||||
pid: int32(os.Getpid()),
|
||||
}
|
||||
|
||||
go DefaultManager.handle()
|
||||
@@ -34,7 +33,7 @@ type Manager struct {
|
||||
downloadBlip atomic.Int64
|
||||
uploadTotal atomic.Int64
|
||||
downloadTotal atomic.Int64
|
||||
process *process.Process
|
||||
pid int32
|
||||
memory uint64
|
||||
}
|
||||
|
||||
@@ -93,7 +92,7 @@ func (m *Manager) Snapshot() *Snapshot {
|
||||
}
|
||||
|
||||
func (m *Manager) updateMemory() {
|
||||
stat, err := m.process.MemoryInfo()
|
||||
stat, err := memory.GetMemoryInfo(m.pid)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user