go: update SaveStats func to take ([]Stats, fName)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
a80b6660e5
commit
a121a1eb4b
@ -5,10 +5,8 @@ package stats
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
// BenchRound holds the iteration couter value and Results of size 'maxFES'.
|
||||
@ -51,15 +49,16 @@ func GetStats(algo string, dimens int, benchFuncStats []FuncStats, iterations, g
|
||||
return s
|
||||
}
|
||||
|
||||
func SaveStats(stats Stats) {
|
||||
func SaveStats(stats []Stats, fName string) {
|
||||
prefix := "res/stats/"
|
||||
ext := ".json"
|
||||
|
||||
if j, err := json.MarshalIndent(stats, "", " "); err != nil {
|
||||
log.Fatal(err)
|
||||
} else {
|
||||
fmt.Fprintln(os.Stderr, j)
|
||||
log.Println("saving json stats to:", prefix+fName+ext)
|
||||
|
||||
log.Println("saving json stats to: test.json")
|
||||
|
||||
if err = ioutil.WriteFile("test.json", j, 0o600); err != nil {
|
||||
if err = ioutil.WriteFile(prefix+fName+ext, j, 0o600); err != nil {
|
||||
log.Println("error saving stats to file:", err)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user