From 2697b296b54810f9980aa240c77d74ce870509de Mon Sep 17 00:00:00 2001 From: surtur Date: Wed, 13 Jul 2022 15:41:54 +0200 Subject: [PATCH] go(stats): relocate stats to common outdir --- stats/stats.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/stats/stats.go b/stats/stats.go index 5d2342e..ce6d6cb 100644 --- a/stats/stats.go +++ b/stats/stats.go @@ -7,6 +7,8 @@ import ( "encoding/json" "io/ioutil" "log" + + "git.dotya.ml/wanderer/math-optim/util" ) // BenchRound holds the iteration couter value and Results of size 'maxFES'. @@ -50,9 +52,14 @@ func GetStats(algo string, dimens int, benchFuncStats []FuncStats, iterations, g } func SaveStats(stats []Stats, fName string) { - prefix := "res/stats/" + prefix := "out/stats/" ext := ".json" + // create required folders, bail early in case of an error. + if err := util.CreatePath(prefix); err != nil { + log.Fatalln("went to create stats dir, there was an issue: ", err) + } + if j, err := json.MarshalIndent(stats, "", " "); err != nil { log.Fatal(err) } else {