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 {