Skip to main content

Automatic execution time and memory tracker for Python scripts — works with VSCode, terminal, and every Python runner automatically.

Project description

cntimer ⏱

PyPI version License: MIT Python 3.7+ Platform

Automatic execution time and memory tracker for Python scripts.

No code changes. No config. Just pip install cntimer — every script you run will automatically show timing and memory at the end, whether you use VSCode, terminal, or any Python runner.


Install

pip install cntimer

That's it. Every Python script you run will show this automatically:

────────────────────────────────────────────────────────────
  🕐 Time      1.52 s        (cpu: 1.44 s)
  📦 Memory    31.2 MB       (peak: 62.4 MB)
────────────────────────────────────────────────────────────

✅ Works in base Python, virtual environments (venv), conda, and pipx — no extra steps needed.


How it works

cntimer places a cntimer.pth file into your Python's site-packages directory. Python automatically reads all .pth files on every startup — which is what makes tracking work with zero code changes.

When you uninstall with pip uninstall cntimer, the .pth hook removes itself automatically on the next Python startup — no orphaned files, no errors.

  • ✅ Works with VSCode Run button
  • ✅ Works in terminal
  • ✅ Works in virtual environments (venv, conda, pipx)
  • ✅ Works on Windows (x86, x64, ARM64), macOS, Linux
  • ✅ No imports needed in your code
  • ✅ Cleans up after itself on uninstall

Output explained

Field Meaning
🕐 Time Total wall-clock time (how long you waited)
cpu CPU time — excludes sleep, I/O, network wait
📦 Memory Memory still in use when script finished
peak Highest memory used at any point during execution

If Time is much bigger than cpu, your script spent time waiting (file I/O, network, sleep).
If they're close, your script is CPU-bound (pure computation).


Manual install (if auto-install failed)

Find your site-packages path:

# Mac / Linux
python3 -c "import site; print(site.getsitepackages()[0])"

# Windows
python -c "import site; print(site.getsitepackages()[0])"

Then copy the file:

macOS

cp cntimer.pth $(python3 -c "import site; print(site.getsitepackages()[0])")/cntimer.pth

Linux

sudo cp cntimer.pth $(python3 -c "import site; print(site.getsitepackages()[0])")/cntimer.pth

Windows 64-bit / ARM64 — run Command Prompt as Administrator

copy cntimer.pth "C:\Program Files\Python3xx\Lib\site-packages\cntimer.pth"

Windows 32-bit — run Command Prompt as Administrator

copy cntimer.pth "C:\Program Files (x86)\Python3xx\Lib\site-packages\cntimer.pth"

Replace 3xx with your Python version (e.g. 312 for Python 3.12).


Uninstall

pip uninstall cntimer

The .pth hook removes itself automatically on the next Python startup. No manual cleanup needed.


License

MIT © 2026 tokitahmidtoufa

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cntimer-0.1.7.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cntimer-0.1.7-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file cntimer-0.1.7.tar.gz.

File metadata

  • Download URL: cntimer-0.1.7.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for cntimer-0.1.7.tar.gz
Algorithm Hash digest
SHA256 79ecaea34911f323c4f56e55c1c9aaa83520bd6b17c7a9519557dadb642f4358
MD5 4f17773a216782ef2f239c6a7c0f874c
BLAKE2b-256 0c428a04723a728b92d52cd64610c368fbf86b95d99f4ebbf0194b6f8edda096

See more details on using hashes here.

File details

Details for the file cntimer-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: cntimer-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for cntimer-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 57fcf00f62092b63a78126daac14af10b9010e6df32ea5ea4e48fea95ee52626
MD5 29d27124a492f891096214d6d44d1975
BLAKE2b-256 ef77087f7686c22633e985e2f143e355fe45c5702d28a825a05e3ddd6ec89eee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page