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: cpu_usage.go
    path of file: ./repos/cockroach/pkg/multitenant/multitenantcpu
    
    the code of the file until where you have to start completion: // Copyright 2022 The Cockroach Authors.
//
// Use of this software is governed b
    
func (h *CPUUsageHelper) EndCollection(ctx context.Context) (ruFomCPU float64) {
	if h.costController == nil || h.costController.GetCostConfig() == nil {
		return 0
	}
	cpuDelta := GetCPUSeconds(ctx) - h.startCPU
	timeElapsed := timeutil.Since(h.startTime).Seconds()
	expectedCPUDelta := timeElapsed * h.avgCPUPerSecond
	cpuUsageSeconds := cpuDelta - expectedCPUDelta
	if cpuUsageSeconds < 0 {
		cpuUsageSeconds = 0
	}
	if cpuUsageSeconds > timeElapsed {
		// It's unlikely that any single query will have such high CPU usage, so
		// bound the estimate above to reduce the possibility of gross error.
		cpuUsageSeconds = timeElapsed
	}
	return float64(h.costController.GetCostConfig().PodCPUCost(cpuUsageSeconds))
}