MCPcopy Create free account
hub / github.com/OpenBMB/ChatDev / tool_timer

Method tool_timer

utils/logger.py:455–464  ·  view source on GitHub ↗

Context manager that times tool invocations.

(self, node_id: str, tool_name: str)

Source from the content-addressed store, hash-verified

453
454 @contextmanager
455 def tool_timer(self, node_id: str, tool_name: str):
456 """Context manager that times tool invocations."""
457 self.__init_timers__()
458 start_time = time.time()
459 try:
460 yield
461 finally:
462 end_time = time.time()
463 duration = (end_time - start_time)
464 self._timers[f"tool_{node_id}_{tool_name}"] = duration
465
466 @contextmanager
467 def thinking_timer(self, node_id: str, stage: str):

Callers 1

_execute_tool_batchMethod · 0.45

Calls 1

__init_timers__Method · 0.95

Tested by

no test coverage detected