[ Agent ] [ Status ] - refresh status part

This commit is contained in:
zeaslity
2023-12-20 15:50:08 +08:00
parent 3312052645
commit 4d56083b5a
15 changed files with 423 additions and 68 deletions

View File

@@ -14,10 +14,31 @@ func TestGetMemoryStatus(t *testing.T) {
}
fmt.Printf("Total Memory: %s\n", FormatMemorySize(memoryStatus.TotalMemory))
fmt.Printf("Used Memory: %s\n", FormatMemorySize(memoryStatus.UsedMemory))
fmt.Printf("Available Memory: %s\n", FormatMemorySize(memoryStatus.AvailableMemory))
fmt.Printf("Total Virtual Memory: %s\n", FormatMemorySize(memoryStatus.TotalVirtualMemory))
fmt.Printf("Used Virtual Memory: %s\n", FormatMemorySize(memoryStatus.UsedVirtualMemory))
fmt.Printf("Used Memory: %s\n ", FormatMemorySize(memoryStatus.UsedMemory))
fmt.Printf("UsedPercent: %.2f %%\n", memoryStatus.UsedPercent)
fmt.Printf("Free Memory: %s\n", FormatMemorySize(memoryStatus.FreeMemory))
marshalIndent, err := json.MarshalIndent(memoryStatus, "", " ")
if err != nil {
fmt.Printf("error")
}
fmt.Println(string(marshalIndent))
}
func TestGetMemoryInfo(t *testing.T) {
memoryStatus, err := GetMemoryInfo()
if err != nil {
return
}
fmt.Printf("Total Memory: %s\n", FormatMemorySize(memoryStatus.TotalMemory))
fmt.Printf("Used Memory: %s\n", FormatMemorySize(memoryStatus.UsedMemory))
fmt.Printf("Available Memory: %s\n", FormatMemorySize(memoryStatus.AvailableMemory))
fmt.Printf("UsedPercent: %.2f %%\n", memoryStatus.UsedPercent)
fmt.Printf("Free Memory: %s\n", FormatMemorySize(memoryStatus.FreeMemory))
marshalIndent, err := json.MarshalIndent(memoryStatus, "", " ")
if err != nil {