You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: kvbench.go
    path of file: ./repos/cockroach/pkg/cmd/roachtest/tests
    
    the code of the file until where you have to start completion: // Copyright 2019 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package tests

import (
	"context"
	"fmt"
	"math"
	"os"
	"path/filepath"
	"strings"
	"time"

	"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/cluster"
	"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/option"
	"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/registry"
	"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/spec"
	"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/test"
	"github.com/cockroachdb/cockroach/pkg/roachprod/install"
	"github.com/cockroachdb/cockroach/pkg/util/search"
	"github.com/cockroachdb/cockroach/pkg/workload/histogram"
	"github.com/cockroachdb/errors"
	"github.com/cockroachd
    
func registerKVBenchSpec(r registry.Registry, b kvBenchSpec) {
	nameParts := []string{
		"kv0bench",
		fmt.Sprintf("nodes=%d", b.Nodes),
		fmt.Sprintf("cpu=%d", b.CPUs),
	}
	if b.NumShards > 0 {
		nameParts = append(nameParts, fmt.Sprintf("shards=%d", b.NumShards))
	}
	opts := []spec.Option{spec.CPU(b.CPUs)}
	switch b.KeyDistribution {
	case sequential:
		nameParts = append(nameParts, "sequential")
	case random:
		nameParts = append(nameParts, "random")
	case zipfian:
		nameParts = append(nameParts, "zipfian")
	default:
		panic("unexpected")
	}

	if b.SecondaryIndex {
		nameParts = append(nameParts, "2nd_idx")
	}

	name := strings.Join(nameParts, "/")
	nodes := r.MakeClusterSpec(b.Nodes+1, opts...)
	r.Add(registry.TestSpec{
		Name: name,
		// These tests don't have pass/fail conditions so we don't want to run them
		// nightly. Currently they're only good for printing the results of a search
		// for --max-rate.
		// TODO(andrei): output something to roachperf and start running them
		// nightly.
		CompatibleClouds: registry.AllClouds,
		Suites:           registry.ManualOnly,
		Owner:            registry.OwnerKV,
		Benchmark:        true,
		Cluster:          nodes,
		Run: func(ctx context.Context, t test.Test, c cluster.Cluster) {
			runKVBench(ctx, t, c, b)
		},
	})
}