Skip to main content

A simple process timer for python scripts.

Project description

checkpointe

A simple progress timer/memory tracker for debugging python scripts.

Overview

Checkpointe is a tool for locating areas of code that are time or memory-intensive. This allows the user to:

  • Track specific function calls in real-time
  • Tag specific checkpoints with an identifying message
  • Analyze a final output that shows time and percentage of time between each checkpoint
  • Reorder checkpoints easily without having to refactor code
  • Analyze memory usage to determine where usage is peaking

Requires

  • datetime
  • tracemalloc (for memory tracking)

Installation

Checkpointe is available for download using pip:

pip install checkpointe

Using Checkpointe

Start

To start tracking time and/or memory, initialize checkpointe with the .start() function

import checkpointe as check

check.start(summary=True, verbose=True, memory=True)

Setting these defaults determines the level of detail checkpointe prints to stdout:

  • summary (default = True): prints a summary after calling the .stop() method
  • verbose (default = False): if enabled, outputs data at each check point
  • memory (default = False): if enabled, tracks and outputs information about system memory usage

Point

Call the .point() method to create a marker at any point in the code.

add = 2 + 2

check.point("ADDITION")

mult = 2 * 2

check.point("MULTIPLICATION")

exp = 2 ** 2

check.point("EXPONENTIAL")

If verbose=True, a statement will be printed at each checkpoint.

Stop

When you are ready to stop tracking, call the .stop() method.

check.stop()

If summary=True, a summary statement will be printed. Each marker will be displayed, along with the time elapsed since the previous marker and the percentage of overall time elapsed.

If memory=True, a final memory statement will be printed, with memory usage at each marker, along with the peak memory usage noted at each marker.

Future Development

Future versions will enable integration with logging to an output file.

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

checkpointe-0.2.5.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

checkpointe-0.2.5-py2.py3-none-any.whl (7.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file checkpointe-0.2.5.tar.gz.

File metadata

  • Download URL: checkpointe-0.2.5.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.9.0

File hashes

Hashes for checkpointe-0.2.5.tar.gz
Algorithm Hash digest
SHA256 5bcfd2f5f6af3d840972cf81ddef2a10aa2cf39f8b87dc7e1509fe3118d402e0
MD5 8ea98b69f88da434cf7509e2819ff957
BLAKE2b-256 5b88e46101a8b82bf3cbbf573fefa5c15bf5d19a8e6322f290af09856ecad40f

See more details on using hashes here.

File details

Details for the file checkpointe-0.2.5-py2.py3-none-any.whl.

File metadata

  • Download URL: checkpointe-0.2.5-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.9.0

File hashes

Hashes for checkpointe-0.2.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5af98edba66c4828f4310b100725d5763b7e91c6ff9582451343a6d0350a171b
MD5 3baba15244ab77076a9526c1ab28ee2a
BLAKE2b-256 8e4f8a0dbb2af4757ab351b54fc985c5225dc59e889ba7d8e5fc9b425f9a7a92

See more details on using hashes here.

Supported by

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