locks: add process-wide lock hold time tracking
TrackedMutex and TrackedRwLock wrappers that record hold durations by source location using #[track_caller]. Stats written to ~/.consciousness/lock-stats.json every second, sorted by max hold time. Re-exported as crate::Mutex so all locks are instrumented. To disable, swap the re-export back to tokio::sync::Mutex. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
b94e056372
commit
f56fc3a7c7
9 changed files with 286 additions and 17 deletions
|
|
@ -410,7 +410,7 @@ impl Subconscious {
|
|||
/// Late-init: push the output tool onto each agent's tool list.
|
||||
/// Called after Subconscious is wrapped in Arc<Mutex<>> so the
|
||||
/// closure can capture a reference back.
|
||||
pub fn init_output_tool(&mut self, self_arc: std::sync::Arc<tokio::sync::Mutex<Self>>) {
|
||||
pub fn init_output_tool(&mut self, self_arc: std::sync::Arc<crate::Mutex<Self>>) {
|
||||
for agent in &mut self.agents {
|
||||
let Some(ref mut auto) = agent.auto else { continue };
|
||||
let sub = self_arc.clone();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue