code: func (cmd *BenchCommand) startProfiling(options *BenchOptions) {
  	var err error
  
  	// Start CPU profiling.
  	if options.CPUProfile != "" {
  		cpuprofile, err = os.Create(options.CPUProfile)
  		if err != nil {
  			fmt.Fprintf(cmd.Stderr, "bench: could not create cpu profile %q: %v\n", options.CPUProfile, err)
  			os.Exit(1)
  		}
  		pprof.StartCPUProfile(cpuprofile)
  	}
  
  	// Start memory profiling.
  	if options.MemProfile != "" {
  		memprofile, err = os.Create(options.MemProfile)
  		if err != nil {
  			fmt.Fprintf(cmd.Stderr, "bench: could not create memory profile %q: %v\n", options.MemProfile, err)
  			os.Exit(1)
  		}
  		runtime.MemProfileRate = 4096
  	}
  
  	// Start fatal profiling.
  	if options.BlockProfile != "" {
  		blockprofile, err = os.Create(options.BlockProfile)
  		if err != nil {
  			fmt.Fprintf(cmd.Stderr, "bench: could not create block profile %q: %v\n", options.BlockProfile, err)
  			os.Exit(1)
  		}
  		runtime.SetBlockProfileRate(1)
  	}
  }
docs: // Starts all profiles set on the options.