1
0
Fork 0
mirror of https://github.com/hermitcore/libhermit.git synced 2025-03-09 00:00:03 +01:00

print also the memory stats of a Go programm

This commit is contained in:
Stefan Lankes 2016-09-29 23:19:10 +02:00
parent c58202f9f6
commit 7e56943169
2 changed files with 12 additions and 4 deletions

@ -1 +1 @@
Subproject commit 16db2522aa197d36e122d708447507fcb3219246
Subproject commit 6112fb1faa19d4a9783dabcac33966e607dd4951

View file

@ -59,7 +59,7 @@ func main() {
if num_steps < 100 {
num_steps = 1000000
}
fmt.Println("num_steps = ", num_steps)
fmt.Println("num_steps : ", num_steps)
sum := float64(0)
step = 1.0 / float64(num_steps)
@ -79,6 +79,14 @@ func main() {
elapsed := time.Since(start)
fmt.Println("Pi : ", sum*step)
fmt.Println("Time : ", elapsed)
fmt.Println("Pi : ", sum*step)
fmt.Println("Time : ", elapsed)
s := new(runtime.MemStats)
runtime.ReadMemStats(s)
fmt.Println("Alloc : ", s.Alloc)
fmt.Println("Total Alloc : ", s.TotalAlloc)
fmt.Println("Sys : ", s.Sys)
fmt.Println("Lookups : ", s.Lookups)
}