You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds time.perf_counter() timing to both the forward thread and background gather/commit thread in AsyncDataTransferContext to pinpoint where latency is spent in the async KV store path.
Forward thread — [FWD <request_id>] log per submit_store() call
Field
Measures
lock
inflight_lock acquire + _is_closing check
prepare
prepare_store()
block_ids
_single_group_block_ids()
alloc
SHM view lookup or pinned staging allocation
submit
commit_executor.submit()
bookkeep
inflight_commits add + callback registration
total
full forward thread time (_t_entry → _t_exit)
Background thread — [BG <request_id>] log per gather/commit task
thread_start · stream_enter · event_wait · gather_launch · record · stream_exit · lock · sync · commit · total
Also instrumented
flush_inflight_gathers() — logs event count and sync duration
close() — logs gather drain and executor shutdown durations
Fixes
import time moved to module level (was inside submit_store)
Fixed missing total argument in [FWD] log call (format string had 10 specifiers, only 9 args — would raise TypeError at runtime)
used_shm_direct (outer scope) used in log instead of _used_shm_direct (closure-captured copy)
CopilotAI
changed the title
[WIP] Add comprehensive profiling instrumentation to async_data.py
Add comprehensive profiling instrumentation to async_data.py
Jun 16, 2026
This was already fixed in commit 5d74074 — the [FWD] log call was missing the total argument (10 specifiers but only 9 args). The current HEAD has (_t_exit - _t_entry) * 1000 as the 8th positional arg, making the count correct. The error you hit was from the intermediate commit 5101739 that had the bug. Please pull the latest and retry.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
time.perf_counter()timing to both the forward thread and background gather/commit thread inAsyncDataTransferContextto pinpoint where latency is spent in the async KV store path.Forward thread —
[FWD <request_id>]log persubmit_store()calllock_is_closingcheckprepareprepare_store()block_ids_single_group_block_ids()allocsubmitcommit_executor.submit()bookkeeptotal_t_entry→_t_exit)Background thread —
[BG <request_id>]log per gather/commit taskthread_start·stream_enter·event_wait·gather_launch·record·stream_exit·lock·sync·commit·totalAlso instrumented
flush_inflight_gathers()— logs event count and sync durationclose()— logs gather drain and executor shutdown durationsFixes
import timemoved to module level (was insidesubmit_store)totalargument in[FWD]log call (format string had 10 specifiers, only 9 args — would raiseTypeErrorat runtime)used_shm_direct(outer scope) used in log instead of_used_shm_direct(closure-captured copy)No functional changes.