MCPcopy Create free account
hub / github.com/cel-expr/cel-go / captureCostTracker

Function captureCostTracker

cel/program.go:236–246  ·  view source on GitHub ↗

captureCostTracker records the frame's cost tracker within the evaluation details, allocating the details when cost tracking is enabled and no details have been created yet. The details must be fully populated before they are handed off to the caller, as any mutation after the hand-off would race w

(det *EvalDetails, frame *interpreter.ExecutionFrame)

Source from the content-addressed store, hash-verified

234// The details must be fully populated before they are handed off to the caller, as any mutation
235// after the hand-off would race with the caller's reads.
236func captureCostTracker(det *EvalDetails, frame *interpreter.ExecutionFrame) *EvalDetails {
237 tracker := frame.CostTracker()
238 if tracker == nil {
239 return det
240 }
241 if det == nil {
242 det = &EvalDetails{}
243 }
244 det.costTracker = tracker
245 return det
246}
247
248// prog is the internal implementation of the Program interface.
249type prog struct {

Callers 2

EvalMethod · 0.85
ConcurrentEvalMethod · 0.85

Calls 1

CostTrackerMethod · 0.80

Tested by

no test coverage detected