mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 18:35:51 +02:00
refactor(analytic): improved network stat #913
This commit is contained in:
parent
ec29a77f99
commit
789698a0d4
6 changed files with 247 additions and 108 deletions
|
@ -2,14 +2,15 @@ package test
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/0xJacky/Nginx-UI/internal/analytic"
|
||||
"github.com/shirou/gopsutil/v4/cpu"
|
||||
"github.com/shirou/gopsutil/v4/disk"
|
||||
"github.com/shirou/gopsutil/v4/load"
|
||||
"github.com/shirou/gopsutil/v4/mem"
|
||||
"github.com/shirou/gopsutil/v4/net"
|
||||
"runtime"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestGoPsutil(t *testing.T) {
|
||||
|
@ -35,9 +36,9 @@ func TestGoPsutil(t *testing.T) {
|
|||
diskUsage, _ := disk.Usage(".")
|
||||
fmt.Println(diskUsage.String())
|
||||
|
||||
network, _ := net.IOCounters(false)
|
||||
network, _ := analytic.GetNetworkStat()
|
||||
fmt.Println(network)
|
||||
time.Sleep(time.Second)
|
||||
network, _ = net.IOCounters(false)
|
||||
network, _ = analytic.GetNetworkStat()
|
||||
fmt.Println(network)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue