go(stats): relocate stats to common outdir
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
surtur 2022-07-13 15:41:54 +02:00
parent 96a93788da
commit 2697b296b5
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D

View File

@ -7,6 +7,8 @@
"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 {