Skip to content

Commit

Permalink
Implement ?t command to see how much time is spent in a query
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed May 9, 2024
1 parent bfa0851 commit bda670f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions r2ai/repl.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from .const import R2AI_HISTFILE, R2AI_HOMEDIR, R2AI_RCFILE, R2AI_USERDIR
from .web import start_http_server
import r2ai
from datetime import datetime
import sys
import os

Expand Down Expand Up @@ -41,6 +42,7 @@ def r2_cmd(x):
r2ai ..([script]) list or run r2ai user script
r2ai :aa run a r2 command
r2ai ' [prompt] auto mode; query LLM that can interact with r2
r2ai ?t [query] run an query and show it's timing
r2ai !ls run a system command
r2ai -a query with audio voice
r2ai -A enter the voice chat loop
Expand Down Expand Up @@ -146,6 +148,11 @@ def runline(ai, usertext):
if usertext.startswith("?V") or usertext.startswith("-v"):
print(r2ai.VERSION)
r2ai_version()
elif usertext.startswith("?t"):
tstart = datetime.now()
runline(ai, usertext[2:].strip())
tend = datetime.now()
print(tend - tstart)
elif usertext.startswith("?") or usertext.startswith("-h"):
print(help_message)
elif usertext.startswith("clear") or usertext.startswith("-k"):
Expand Down

0 comments on commit bda670f

Please sign in to comment.