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)
────────────────────────────────────────────────────────────

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 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

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"

Changelog

0.1.3

  • Added cpu time alongside wall time
  • Added peak memory alongside current memory
  • Improved cross-platform support (Windows x86, x64, ARM64, macOS, Linux)
  • Better error messages with exact fix commands when auto-install fails

0.1.2

  • Fixed .pth auto-install
  • Self-contained _autostart.py — no import errors on startup

0.1.1

  • Initial release

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.3.tar.gz (6.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.3-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cntimer-0.1.3.tar.gz
  • Upload date:
  • Size: 6.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.3.tar.gz
Algorithm Hash digest
SHA256 64ca5f2d0d7477210498142fc0d2e744734b2ba8db6943bb6f6e68f2b50aef5a
MD5 8cca6bc2a66b0376fe897b5a207db1f6
BLAKE2b-256 3b4624a8cbb630b99215c5f05e7d6fffa3cb2243c30812136b2fcd828df244f9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cntimer-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 6.3 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3380e0aa80df5f5d1f721bcb11c6acb6caf9513dd2aa25201fd27f9f852313d7
MD5 6dafa480e39c711a6b6ecba5275d5653
BLAKE2b-256 4ec74aa17d0c9ca734fda465690e81e057449d5ee3b81a7c9eb5c3c47add5742

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