From 38ef4460f9dfb6e7ec7d03bd988c0fcda0656626 Mon Sep 17 00:00:00 2001 From: Tomas Aparicio Date: Thu, 16 Apr 2015 02:25:43 +0200 Subject: [PATCH] feat(version): bump --- debug.go | 59 +----------------------------------------------------- version.go | 2 +- 2 files changed, 2 insertions(+), 59 deletions(-) diff --git a/debug.go b/debug.go index 46155fa..c781668 100644 --- a/debug.go +++ b/debug.go @@ -1,62 +1,5 @@ package bimg -import ( - "github.com/dustin/go-humanize" - . "github.com/tj/go-debug" - "runtime" - "strconv" - "time" -) +import . "github.com/tj/go-debug" var debug = Debug("bimg") - -// Print Go memory and garbage collector stats. Useful for debugging -func PrintMemoryStats() { - log := Debug("memory") - mem := memoryStats() - - log("\u001b[33m---- Memory Stats ----\u001b[39m") - log("Allocated: %s", humanize.Bytes(mem.Alloc)) - log("Total Allocated: %s", humanize.Bytes(mem.TotalAlloc)) - log("Memory Allocations: %d", mem.Mallocs) - log("Memory Frees: %d", mem.Frees) - log("Heap Allocated: %s", humanize.Bytes(mem.HeapAlloc)) - log("Heap System: %s", humanize.Bytes(mem.HeapSys)) - log("Heap In Use: %s", humanize.Bytes(mem.HeapInuse)) - log("Heap Idle: %s", humanize.Bytes(mem.HeapIdle)) - log("Heap OS Related: %s", humanize.Bytes(mem.HeapReleased)) - log("Heap Objects: %s", humanize.Bytes(mem.HeapObjects)) - log("Stack In Use: %s", humanize.Bytes(mem.StackInuse)) - log("Stack System: %s", humanize.Bytes(mem.StackSys)) - log("Stack Span In Use: %s", humanize.Bytes(mem.MSpanInuse)) - log("Stack Cache In Use: %s", humanize.Bytes(mem.MCacheInuse)) - log("Next GC cycle: %s", humanizeNano(mem.NextGC)) - log("Last GC cycle: %s", humanize.Time(time.Unix(0, int64(mem.LastGC)))) - log("\u001b[33m---- Memory Stats ----\u001b[39m") -} - -func memoryStats() runtime.MemStats { - var mem runtime.MemStats - runtime.ReadMemStats(&mem) - return mem -} - -func humanizeNano(n uint64) string { - var suffix string - - switch { - case n > 1e9: - n /= 1e9 - suffix = "s" - case n > 1e6: - n /= 1e6 - suffix = "ms" - case n > 1e3: - n /= 1e3 - suffix = "us" - default: - suffix = "ns" - } - - return strconv.Itoa(int(n)) + suffix -} diff --git a/version.go b/version.go index 3271f26..0cec2e4 100644 --- a/version.go +++ b/version.go @@ -1,3 +1,3 @@ package bimg -const Version = "0.1.9" +const Version = "0.1.10"