From bec2ee3046f6f7c83c93b76d20af53c5deaecee5 Mon Sep 17 00:00:00 2001 From: surtur Date: Fri, 8 Jul 2022 19:22:09 +0200 Subject: [PATCH] go(plot): track plotting execution time --- algo/plot.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/algo/plot.go b/algo/plot.go index 50eb189..3836f3c 100644 --- a/algo/plot.go +++ b/algo/plot.go @@ -6,6 +6,7 @@ package algo import ( "fmt" "log" + "time" "git.dotya.ml/wanderer/math-optim/stats" "gonum.org/v1/gonum/floats" @@ -20,6 +21,7 @@ const preferredFontStyle = "Mono" // violating the limit of 30, TODO(me): split this up. // nolint: gocognit func plotAllDims(algoStats []stats.Stats, fPrefix, fExt string) { + start := time.Now() pWidth := 13 * vg.Centimeter pHeight := 13 * vg.Centimeter @@ -95,7 +97,9 @@ func plotAllDims(algoStats []stats.Stats, fPrefix, fExt string) { fmt.Sprint(len(dim.Solution)) + "I" + fExt - info := "saving img to file: " + filename + elapsed := time.Since(start) + info := "saving img to file: " + filename + + " [generated in " + fmt.Sprint(elapsed) + "]" if s.Algo == "Random Search" { printRandomSearch(info)