not change

This commit is contained in:
huangsimin 2018-12-03 20:01:19 +08:00
parent 8452db76d1
commit 886e2dc188

View File

@ -5,10 +5,12 @@ import (
"fmt"
"log"
"regexp"
"runtime"
"strconv"
"strings"
"testing"
"time"
"unsafe"
"github.com/davecgh/go-spew/spew"
)
@ -232,6 +234,24 @@ func TestParseCrontab(t *testing.T) {
t.Error(NewCrontab(crontab))
PrintMemUsage()
ty := CreateTrieYear(2018)
log.Println(ty.Month[2].MaxDay)
log.Println(unsafe.Sizeof(ty))
PrintMemUsage()
}
func PrintMemUsage() {
var m runtime.MemStats
runtime.ReadMemStats(&m)
// For info on each, see: https://golang.org/pkg/runtime/#MemStats
fmt.Printf("Alloc = %v MiB", bToMb(m.Alloc))
fmt.Printf("\tTotalAlloc = %v MiB", bToMb(m.TotalAlloc))
fmt.Printf("\tSys = %v MiB", bToMb(m.Sys))
fmt.Printf("\tNumGC = %v\n", m.NumGC)
}
func bToMb(b uint64) uint64 {
return b / 1024 / 1024
}