(strategy SizingStrategy, version uint32)
| 1271 | } |
| 1272 | |
| 1273 | func (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. |
| 1301 | func versionOf(ctx EstimateContext) uint32 { |
no test coverage detected