Created
December 5, 2017 15:35
-
-
Save snicol/89908aafc3d02e24144d37205671a4af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"runtime" | |
"fmt" | |
) | |
type SystemStat struct { | |
Alloc uint64 | |
TotalAlloc uint64 | |
HeapAlloc uint64 | |
HeapSys uint64 | |
NumCPU int | |
NumGoroutine int | |
GoVersion string | |
} | |
func main() { | |
mem := runtime.MemStats{} | |
runtime.ReadMemStats(&mem) | |
stat := SystemStat{ | |
Alloc: mem.Alloc, | |
TotalAlloc: mem.TotalAlloc, | |
HeapAlloc: mem.HeapAlloc, | |
HeapSys: mem.HeapSys, | |
NumCPU: runtime.NumCPU(), | |
NumGoroutine: runtime.NumGoroutine(), | |
GoVersion: runtime.Version(), | |
} | |
fmt.Printf("%+v\n", stat) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment