code: func (p *criStatsProvider) getAndUpdateContainerUsageNanoCores(stats *runtimeapi.ContainerStats) *uint64 {
  	if stats == nil || stats.Attributes == nil || stats.Cpu == nil || stats.Cpu.UsageCoreNanoSeconds == nil {
  		return nil
  	}
  	id := stats.Attributes.Id
  	usage, err := func() (*uint64, error) {
  		p.mutex.Lock()
  		defer p.mutex.Unlock()
  
  		cached, ok := p.cpuUsageCache[id]
  		if !ok || cached.stats.UsageCoreNanoSeconds == nil {
  			// Cannot compute the usage now, but update the cached stats anyway
  			p.cpuUsageCache[id] = &cpuUsageRecord{stats: stats.Cpu, usageNanoCores: nil}
  			return nil, nil
  		}
  
  		newStats := stats.Cpu
  		cachedStats := cached.stats
  		nanoSeconds := newStats.Timestamp - cachedStats.Timestamp
  		if nanoSeconds <= 0 {
  			return nil, fmt.Errorf("zero or negative interval (%v - %v)", newStats.Timestamp, cachedStats.Timestamp)
  		}
  		usageNanoCores := (newStats.UsageCoreNanoSeconds.Value - cachedStats.UsageCoreNanoSeconds.Value) * uint64(time.Second/time.Nanosecond) / uint64(nanoSeconds)
  
  		// Update cache with new value.
  		usageToUpdate := usageNanoCores
  		p.cpuUsageCache[id] = &cpuUsageRecord{stats: newStats, usageNanoCores: &usageToUpdate}
  
  		return &usageNanoCores, nil
  	}()
  
  	if err != nil {
  		// This should not happen. Log now to raise visiblity
  		klog.Errorf("failed updating cpu usage nano core: %v", err)
  	}
  	return usage
  }
docs: // getContainerUsageNanoCores computes usageNanoCores based on the given and
  // the cached usageCoreNanoSeconds, updates the cache with the computed
  // usageNanoCores, and returns the usageNanoCores.