Skip to content

Commit eb53324

Browse files
Small Improvements
1 parent 6760340 commit eb53324

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

cli/api.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func createProfAuto() *cobra.Command {
7070
profileFlag := "profiles"
7171
tagFlag := "tag"
7272
countFlag := "count"
73-
example := fmt.Sprintf(`prof %s --%s BenchmarkGenPool --%s cpu,memory --%s 10 --%s "tag1"`, shared.AUTOCMD, benchFlag, profileFlag, countFlag, tagFlag)
73+
example := fmt.Sprintf(`prof %s --%s "BenchmarkGenPool" --%s "cpu,memory" --%s 10 --%s "tag1"`, shared.AUTOCMD, benchFlag, profileFlag, countFlag, tagFlag)
7474

7575
cmd := &cobra.Command{
7676
Use: shared.AUTOCMD,
@@ -79,8 +79,8 @@ func createProfAuto() *cobra.Command {
7979
Example: example,
8080
}
8181

82-
cmd.Flags().StringSliceVar(&benchmarks, benchFlag, []string{}, `Benchmarks to run (e.g., "[BenchmarkGenPool]")"`)
83-
cmd.Flags().StringSliceVar(&profiles, profileFlag, []string{}, `Profiles to use (e.g., "[cpu,memory,mutex]")`)
82+
cmd.Flags().StringSliceVar(&benchmarks, benchFlag, []string{}, `Benchmarks to run (e.g., "BenchmarkGenPool")"`)
83+
cmd.Flags().StringSliceVar(&profiles, profileFlag, []string{}, `Profiles to use (e.g., "cpu,memory,mutex")`)
8484
cmd.Flags().StringVar(&tag, tagFlag, "", "The tag is used to organize the results")
8585
cmd.Flags().IntVar(&count, countFlag, 0, "Number of runs")
8686

@@ -114,9 +114,11 @@ func createTrackAutoCmd() *cobra.Command {
114114
outputFormatFlag := "output-format"
115115
example := fmt.Sprintf(`prof track auto --%s "tag1" --%s "tag2" --%s "cpu" --%s "BenchmarkGenPool" --%s "summary"`, baseTagFlag, currentTagFlag, profileTypeFlag, benchNameFlag, outputFormatFlag)
116116
longExplanation := fmt.Sprintf("This command only works if the %s command was used to collect and organize the benchmark and profile data, as it expects a specific directory structure generated by that process.", shared.AUTOCMD)
117+
shortExplanation := "If prof auto was used to collect the data, track auto can be used to analyze it, you just have to pass the tag name."
117118

118119
cmd := &cobra.Command{
119120
Use: shared.TrackAutoCMD,
121+
Short: shortExplanation,
120122
Long: longExplanation,
121123
RunE: runTrackAuto,
122124
Example: example,

engine/benchmark/helpers.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,17 @@ func runBenchmarkCommand(cmd []string, outputFile string) error {
121121
execCmd := exec.Command(cmd[0], cmd[1:]...)
122122

123123
output, err := execCmd.CombinedOutput()
124+
125+
// Always print the output, even if there was an error - it may contain meaningful information
126+
fmt.Println("🚀 ==================== BENCHMARK OUTPUT ==================== 🚀")
127+
fmt.Println(string(output))
128+
fmt.Println("📊 ========================================================== 📊")
129+
124130
if err != nil {
125131
if strings.Contains(string(output), moduleNotFoundMsg) {
126-
return fmt.Errorf("%s - ensure you're in a Go project directory", moduleNotFoundMsg)
132+
return fmt.Errorf("%s - ensure you're in a Go project directory 📁", moduleNotFoundMsg)
127133
}
128-
return errors.New(string(output))
134+
return fmt.Errorf("💥 BENCHMARK COMMAND FAILED 💥\n%s", string(output))
129135
}
130136

131137
return os.WriteFile(outputFile, output, shared.PermFile)

0 commit comments

Comments
 (0)