# 1. Install latest version
cargo install --path .
# 2. Run a few commands to populate data
rtk git status
rtk ls .
rtk grep "tracking" src/
# 3. Check gain stats (should show execution times)
rtk gain
# Expected output:
# Total exec time: XX.Xs (avg XXms)
# By Command table should show Time column# Run commands with different execution times
rtk git log -10 # Fast (~10ms)
rtk cargo test # Slow (~300ms)
rtk vitest run # Very slow (seconds)
# Verify times are recorded
rtk gain
# Should show different avg times per commandrtk gain --daily
# Expected:
# Date column + Time column showing avg time per day
# Today should have non-zero times
# Historical data shows 0ms (no time recorded)JSON Export:
rtk gain --daily --format json | jq '.summary'
# Should include:
# "total_time_ms": 12345,
# "avg_time_ms": 67CSV Export:
rtk gain --daily --format csv
# Headers should include:
# date,commands,input_tokens,...,total_time_ms,avg_time_ms# Run 10 commands and measure total time
for i in {1..10}; do rtk git status; done
rtk gain
# Total exec time should be ~10-50ms (10 × 1-5ms)-
rtk gainshows "Total exec time: X (avg Yms)" - By Command table has "Time" column
-
rtk gain --dailyshows time per day - JSON export includes
total_time_msandavg_time_ms - CSV export has time columns
- New commands show realistic times (not 0ms)
- Historical data preserved (old entries show 0ms)
# Check SQLite schema includes exec_time_ms
sqlite3 ~/.local/share/rtk/history.db "PRAGMA table_info(commands);"
# Should show:
# ...
# 7|exec_time_ms|INTEGER|0|0|0The timer adds negligible overhead:
Instant::now()→ ~10-50nselapsed()→ ~10-50ns- SQLite insert with extra column → ~1-5µs
Total overhead: < 0.1ms per command