Add ntro timing utility and integrate into agent loop

This commit is contained in:
Dita Aji Pratama 2026-05-19 10:35:18 +07:00
parent de89ad2706
commit 1c6fdf2a40

View File

@ -1,12 +1,12 @@
import time import time
def start(): def start():
return {"_start": time.perf_counter_ns()} return {"start": time.perf_counter_ns()}
def end(stamp): def end(stamp):
elapsed_ns = time.perf_counter_ns() - stamp["_start"] elapsed_ns = time.perf_counter_ns() - stamp["start"]
elapsed_ms = elapsed_ns / 1_000_000 elapsed_ms = elapsed_ns / 1_000_000
print(f"[ntropy] {elapsed_ms:.2f}ms") stamp["start"] = time.perf_counter_ns() # For start with multi end
stamp["_start"] = time.perf_counter_ns() # print(f"[ntropy] {elapsed_ms:.2f}ms")
return elapsed_ms return elapsed_ms