code: func (cmd *BenchCommand) Run(args ...string) error {
  	// Parse CLI arguments.
  	options, err := cmd.ParseFlags(args)
  	if err != nil {
  		return err
  	}
  
  	// Remove path if "-work" is not set. Otherwise keep path.
  	if options.Work {
  		fmt.Fprintf(cmd.Stdout, "work: %s\n", options.Path)
  	} else {
  		defer os.Remove(options.Path)
  	}
  
  	// Create database.
  	db, err := bolt.Open(options.Path, 0666, nil)
  	if err != nil {
  		return err
  	}
  	db.NoSync = options.NoSync
  	defer db.Close()
  
  	// Write to the database.
  	var results BenchResults
  	if err := cmd.runWrites(db, options, &results); err != nil {
  		return fmt.Errorf("write: %v", err)
  	}
  
  	// Read from the database.
  	if err := cmd.runReads(db, options, &results); err != nil {
  		return fmt.Errorf("bench: read: %s", err)
  	}
  
  	// Print results.
  	fmt.Fprintf(os.Stderr, "# Write\t%v\t(%v/op)\t(%v op/sec)\n", results.WriteDuration, results.WriteOpDuration(), results.WriteOpsPerSecond())
  	fmt.Fprintf(os.Stderr, "# Read\t%v\t(%v/op)\t(%v op/sec)\n", results.ReadDuration, results.ReadOpDuration(), results.ReadOpsPerSecond())
  	fmt.Fprintln(os.Stderr, "")
  	return nil
  }
docs: // Run executes the "bench" command.