Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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)
- }
Add Comment
Please, Sign In to add comment