timetable-extension #1

Open
fred.boniface wants to merge 160 commits from timetable-extension into main
Showing only changes of commit 16fa1c5354 - Show all commits

View File

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