Performance profiling
Measure SDK operation timings.
Performance profiling
import time
from contextlib import contextmanager
@contextmanager
def profile(operation_name):
start = time.time()
try:
yield
finally:
duration = time.time() - start
print(f"{operation_name}: {duration:.3f}s")
# Profile operations
with profile("capture_plan"):
captured = client.capture_plan(llm="gpt-4", prompt="Analyze data")
with profile("get_token"):
token_response = client.get_intent_token(captured)
with profile("invoke"):
result = client.invoke("analytics-mcp", "analyze", token, params)