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

Function NewCostTracker

interpreter/runtimecost.go:199–212  ·  view source on GitHub ↗

NewCostTracker creates a new CostTracker with a given estimator and a set of functional CostTrackerOption values.

(estimator ActualCostEstimator, opts ...CostTrackerOption)

Source from the content-addressed store, hash-verified

197
198// NewCostTracker creates a new CostTracker with a given estimator and a set of functional CostTrackerOption values.
199func NewCostTracker(estimator ActualCostEstimator, opts ...CostTrackerOption) (*CostTracker, error) {
200 tracker := &CostTracker{
201 Estimator: estimator,
202 overloadTrackers: map[string]FunctionTracker{},
203 presenceTestHasCost: true,
204 }
205 for _, opt := range opts {
206 err := opt(tracker)
207 if err != nil {
208 return nil, err
209 }
210 }
211 return tracker, nil
212}
213
214// OverloadCostTracker binds an overload ID to a runtime FunctionTracker implementation.
215//

Callers 2

newProgramFunction · 0.92
computeCostFunction · 0.85

Calls

no outgoing calls

Tested by 1

computeCostFunction · 0.68