Unverified Commit 373b8ffb authored by Yongming Ding's avatar Yongming Ding Committed by GitHub
Browse files

feat(mocker): enable KV cache trace for decode workers (#6207)


Signed-off-by: default avatarYongming Ding <yongmingd@nvidia.com>
parent 5ff88b33
...@@ -119,10 +119,6 @@ impl KvManager { ...@@ -119,10 +119,6 @@ impl KvManager {
return; return;
} }
let Some(ref sink) = self.kv_event_sink else {
return;
};
if *KV_CACHE_TRACE_ENABLED { if *KV_CACHE_TRACE_ENABLED {
let timestamp_ms = SystemTime::now() let timestamp_ms = SystemTime::now()
.duration_since(UNIX_EPOCH) .duration_since(UNIX_EPOCH)
...@@ -149,6 +145,10 @@ impl KvManager { ...@@ -149,6 +145,10 @@ impl KvManager {
); );
} }
let Some(ref sink) = self.kv_event_sink else {
return;
};
let event_data = if is_store { let event_data = if is_store {
let num_blocks = full_blocks.len(); let num_blocks = full_blocks.len();
let local_hashes_slice = &local_hashes[local_hashes let local_hashes_slice = &local_hashes[local_hashes
...@@ -236,9 +236,8 @@ impl KvManager { ...@@ -236,9 +236,8 @@ impl KvManager {
// Now insert the new block in active blocks with reference count 1 // Now insert the new block in active blocks with reference count 1
self.active_blocks.insert(hash.clone(), 1); self.active_blocks.insert(hash.clone(), 1);
if self.kv_event_sink.is_some() // Track blocks for trace/event
&& let UniqueBlock::FullBlock(stored_full_block) = hash if let UniqueBlock::FullBlock(stored_full_block) = hash {
{
blocks_stored.push(*stored_full_block); blocks_stored.push(*stored_full_block);
} }
} }
...@@ -259,9 +258,7 @@ impl KvManager { ...@@ -259,9 +258,7 @@ impl KvManager {
self.active_blocks.remove(hash).unwrap(); self.active_blocks.remove(hash).unwrap();
// Track blocks for batch sending // Track blocks for batch sending
if self.kv_event_sink.is_some() if let UniqueBlock::FullBlock(destroyed_full_block) = hash {
&& let UniqueBlock::FullBlock(destroyed_full_block) = hash
{
blocks_destroyed.push(*destroyed_full_block); blocks_destroyed.push(*destroyed_full_block);
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment