MCPcopy Create free account
hub / github.com/Niko1221/Strata / park_live_

Method park_live_

engine/src/split/src/session.cpp:310–324  ·  view source on GitHub ↗

the live sequence to host memory, if it is long enough to be worth the copy

Source from the content-addressed store, hash-verified

308
309// the live sequence to host memory, if it is long enough to be worth the copy
310void Session::park_live_() {
311 const std::vector<int>& hist = e_.history();
312 if (cache_->budget == 0 || hist.size() < PARK_MIN) return;
313 for (const Conv& p : cache_->parked) // already parked as it is (a conversation brought back and left unchanged)
314 if (p.kv->tokens == hist) return;
315 Conv c;
316 const auto t_park = std::chrono::steady_clock::now();
317 c.kv = e_.save_state(true);
318 c.ckpts = live_.ckpts;
319 c.len = hist.size();
320 c.used = live_.used;
321 cache_->parked.push_back(std::move(c));
322 std::fprintf(stderr, "conversation cache: parked %zu tokens in %.0f ms, parked=%zu bytes=%zu\n", hist.size(), ms_since(t_park),
323 cache_->parked.size(), bytes_held());
324}
325
326void Session::park() {
327 e_.use_lane(lane_);

Callers

nothing calls this directly

Calls 7

moveFunction · 0.85
historyMethod · 0.80
save_stateMethod · 0.80
push_backMethod · 0.80
ms_sinceFunction · 0.70
nowFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected