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: latency_verifier.go
    path of file: ./repos/cockroach/pkg/cmd/roachtest/tests
    
    the code of the file until where you have to start completion: // Copyright 2022 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"
	gosql "database/sql"
	"fmt"
	"time"

	"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/test"
	"github.com/cockroachdb/cockroach/pkg/roachprod/logger"
	"github.com/cockroachdb/cockroach/pkg/util/log"
	"github.com/cockroachdb/cockroach/pkg/util/timeutil"
	"github.com/cockroachdb/errors"
	"github.com/codahale/hdrhistogram"
)

type jobInfo interface {
	GetHighWater() time.Time
	GetFinishedTime() time.Time
	GetStatus() string
	GetError() string
}

type jobFetcher func(db *gosql.DB, jobID int) (jobInfo, error)

type latencyVerifier struct {
	name                     string
	statementTime            time.Time
	targetSteadyLatency      time.Duration
	targetInitialScanLatency time.Duration
	tolerateErrors           bool
	logger                   *logger.Logger
	jobFetcher               jobFetcher
	setTestStatus            func(...interface{})

	initialScanHighwater time.Time
	initialScanLatency   time.Duration

	catchupScanEveryN log.EveryN

	maxSeenSteadyLatency time.Duration
	maxSeenSteadyEveryN  log.EveryN
	latencyBecameSteady  bool

	latencyHist *hdrhistogram.Histogram
}

func makeLatencyVerifier(
	name string,
	targetInitialScanLatency time.Duration,
	targetSteadyLatency time.Duration,
	l *logger.
    
func (lv *latencyVerifier) noteHighwater(highwaterTime time.Time) {
	// Highwater timestamps received before the statement time indicate an initial
	// scan is taking place.
	if highwaterTime.Before(lv.statementTime) {
		return
	}
	if lv.initialScanLatency == 0 && lv.targetInitialScanLatency != 0 {
		lv.initialScanLatency = timeutil.Since(lv.statementTime)
		lv.initialScanHighwater = highwaterTime
		lv.logger.Printf("initial scan completed: latency %s, highwater %s\n", lv.initialScanLatency, lv.initialScanHighwater)
		return
	}

	latency := timeutil.Since(highwaterTime)

	// We assume that the highwater starts far behind and eventually catches up to
	// within lv.targetSteadyLatency of the present time, which is valid. We
	// assert that the lag between then highwater and present decreases until it
	// is below lv.targetSteadyLatency and remains below lv.targetSteadyLatency.
	// This has the implicit assumption of the lag decreasing, which is only valid
	// if the highwater progresses faster than real time. If we measure the lag at
	// two different times without updating the highwater, we will observe an
	// increase in lag.
	//
	// Catchup scans do not update the highwater. If a catchup scan takes longer
	// than lv.initialScanHighwater, we will observe that the lag is higher than
	// lv.targetSteadyLatency, violating the above assertion. For this reason, we
	// wait for catchup scans to finish before asserting latency.
	if highwaterTime.Equal(lv.initialScanHighwater) {
		if lv.catchupScanEveryN.ShouldLog() {
			lv.logger.Printf("catchup scan: latency %s\n", latency.Truncate(time.Millisecond))
		}
		return
	}

	if lv.targetSteadyLatency == 0 || latency < lv.targetSteadyLatency/2 {
		lv.latencyBecameSteady = true
	}
	if !lv.latencyBecameSteady {
		// Before we have RangeFeed, the polls just get
		// progressively smaller after the initial one. Start
		// tracking the max latency once we seen a latency
		// that's less than the max allowed. Verify at the end
		// of the test that this happens at some point.
		if lv.maxSeenSteadyEveryN.ShouldLog() {
			lv.setTestStatus(fmt.Sprintf(
				"watching %s: end-to-end latency %s not yet below target steady latency %s",
				lv.name, latency.Truncate(time.Millisecond), lv.targetSteadyLatency.Truncate(time.Millisecond)))
		}
		return
	}
	if err := lv.latencyHist.RecordValue(latency.Nanoseconds()); err != nil {
		lv.logger.Printf("could not record value %s: %s\n", latency, err)
	}
	if latency > lv.maxSeenSteadyLatency {
		lv.maxSeenSteadyLatency = latency
	}
	if lv.maxSeenSteadyEveryN.ShouldLog() {
		lv.setTestStatus(fmt.Sprintf(
			"watching %s: end-to-end steady latency %s; max steady latency so far %s; highwater %s",
			lv.name, latency.Truncate(time.Millisecond), lv.maxSeenSteadyLatency.Truncate(time.Millisecond), highwaterTime))
	}
}