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.2 ms        (elapsed: 3.06 s)
  📦 Memory    4 KB          (peak: 197 KB)
────────────────────────────────────────────────────────────

How it works

When you pip install cntimer, it 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.

  • ✅ Works with VSCode Run button
  • ✅ Works in terminal
  • ✅ Works on Windows (x86, x64, ARM64), macOS, Linux
  • ✅ No imports needed in your code

Output explained

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

Time shows pure execution time (perfect for competitive programming).
elapsed shows total wait time including delays.


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

Then remove the .pth file:

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

# Windows (run as Administrator)
del "C:\Program Files\Python3xx\Lib\site-packages\cntimer.pth"

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.8.tar.gz (5.8 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.8-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cntimer-0.1.8.tar.gz
  • Upload date:
  • Size: 5.8 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.8.tar.gz
Algorithm Hash digest
SHA256 f407fa109f95a8b0636b21113097782e8d1e78213f76d59c8a70cbb7d97be6eb
MD5 5765c98f64e7ca6b53d6d798ee55f6c0
BLAKE2b-256 7992c64509ecb0fc737e84bceb7462ae05664cd5f51390721e11d326da5b3830

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cntimer-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 6.2 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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 cd2f5d1b36c682a25f2c9c4d595f16448a51a972f689d86d66d280ce27afeb6d
MD5 681537dfebc7c361977e4ab46c45e341
BLAKE2b-256 6c7d8c0440437ac2125db22842226fb575295aa526473364cf805d437c3b7011

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