diff --git a/.gitignore b/.gitignore index 5e2ee3e..760fb97 100644 --- a/.gitignore +++ b/.gitignore @@ -25,4 +25,7 @@ go.work result/ #tmp folder which contains .yaml files -tmp/ \ No newline at end of file +tmp/ + +#.txt files which contain response stats +.txt diff --git a/cmd/kperf/commands/runner/runner.go b/cmd/kperf/commands/runner/runner.go index dc4692b..7de7d09 100644 --- a/cmd/kperf/commands/runner/runner.go +++ b/cmd/kperf/commands/runner/runner.go @@ -3,8 +3,8 @@ package runner import ( "context" "fmt" - "log" "os" + "path/filepath" "sort" "github.com/Azure/kperf/api/types" @@ -83,9 +83,9 @@ var runCommand = cli.Command{ var f *os.File = os.Stdout if outputFilePath != "" { - err := os.MkdirAll(outputFilePath, os.ModePerm) + err := os.MkdirAll(filepath.Dir(outputFilePath), 0600) if err != nil { - log.Default().Printf("failed to create directory %s: %v", outputFilePath, err) + return err } f, err = os.Create(outputFilePath) if err != nil { @@ -136,6 +136,10 @@ func printResponseStats(f *os.File, stats *types.ResponseStats) { fmt.Fprintf(f, " Total Failures: %d\n", len(stats.FailureList)) + for _, v := range stats.FailureList { + fmt.Fprintf(f, " %v\n", v) + } + fmt.Fprintf(f, " Observed Bytes: %v\n", stats.TotalReceivedBytes) fmt.Fprintf(f, " Duration: %v\n", stats.Duration.String())