timetable-extension #1
@ -1,7 +1,7 @@
|
||||
package background
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
@ -9,6 +9,7 @@ import (
|
||||
"git.fjla.uk/owlboard/timetable-mgr/corpus"
|
||||
"git.fjla.uk/owlboard/timetable-mgr/helpers"
|
||||
"git.fjla.uk/owlboard/timetable-mgr/log"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
const frequency = 2 * time.Hour // Figure out a sensible frequency!
|
||||
@ -60,7 +61,8 @@ func debugLog() {
|
||||
runtime.ReadMemStats(&memStats)
|
||||
|
||||
goroutines := runtime.NumGoroutine()
|
||||
heapMem := float64(memStats.HeapAlloc) / (1024 * 1024)
|
||||
heapMemRound := math.Round(heapMem*100) / 100
|
||||
|
||||
fmt.Printf("\nNumber of goroutines: %d\n", goroutines)
|
||||
fmt.Printf("Heap Allocated memory: %2f MB\n\n", float64(memStats.HeapAlloc)/(1024*1024))
|
||||
log.Msg.Debug("Performance", zap.Int("goroutine-count", goroutines), zap.Float64("heap-mem (MB)", heapMemRound))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user