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

Method buildTracker

common/cost/model.go:1273–1298  ·  view source on GitHub ↗
(strategy SizingStrategy, version uint32)

Source from the content-addressed store, hash-verified

1271}
1272
1273func (m OverloadModel) buildTracker(strategy SizingStrategy, version uint32) FunctionTracker {
1274 if prior, ok := priorForVersion(m.priors, version); ok {
1275 return m.resolvePrior(prior).buildTracker(strategy, version)
1276 }
1277 if m.manual {
1278 return m.tracker
1279 }
1280 isMember := m.hasTarget()
1281 cost := normalize(m.Cost)
1282 floor := m.hasCallFloor(version)
1283 return func(args []ref.Val, result ref.Val) *uint64 {
1284 ctx := trackerCtxPool.Get().(*trackerEvalContext)
1285 ctx.strategy = strategy
1286 ctx.version = version
1287 ctx.args = args
1288 ctx.result = result
1289 ctx.isMember = isMember
1290 costVal := cost.track(ctx)
1291 *ctx = trackerEvalContext{}
1292 trackerCtxPool.Put(ctx)
1293 if floor {
1294 costVal = max(costVal, minCallCost)
1295 }
1296 return &costVal
1297 }
1298}
1299
1300// versionOf reports the cost model version of an EstimateContext.
1301func versionOf(ctx EstimateContext) uint32 {

Callers 2

FunctionTrackerMethod · 0.95

Calls 7

resolvePriorMethod · 0.95
hasTargetMethod · 0.95
hasCallFloorMethod · 0.95
priorForVersionFunction · 0.85
normalizeFunction · 0.70
GetMethod · 0.65
trackMethod · 0.65

Tested by

no test coverage detected