(cmd *cobra.Command)
| 271 | } |
| 272 | |
| 273 | func mustSetupProfile(cmd *cobra.Command) profileData { |
| 274 | p := profileData{} |
| 275 | mpp := cmd.Flag("memprofile") |
| 276 | p.memPath = mpp.Value.String() |
| 277 | cpp := cmd.Flag("cpuprofile") |
| 278 | v := cpp.Value.String() |
| 279 | if v != "" { |
| 280 | f, err := os.Create(v) |
| 281 | if err != nil { |
| 282 | fmt.Fprintf(os.Stderr, "Could not open CPU profile file %s\n", v) |
| 283 | os.Exit(1) |
| 284 | } |
| 285 | p.cpuProfile = f |
| 286 | pprof.StartCPUProfile(f) |
| 287 | } |
| 288 | return p |
| 289 | } |
| 290 | |
| 291 | func mustFinishProfile(p profileData) { |
| 292 | if p.cpuProfile != nil { |
no test coverage detected