<commit_before># Lauda
[![Build Status][travis-image]][travis-url] [![Codecov.io Status][codecovio-image]][codecovio-url]
[![Latest Version](https://img.shields.io/pypi/v/lauda.svg)](https://pypi.python.org/pypi/lauda/)
[![Supported Python versions](https://img.shields.io/badge/python-2.6%2C%202.7%2C%203.3%2C%203.4-blue.svg)](https://pypi.python.org/pypi/lauda/)
[![License](https://img.shields.io/github/license/astagi/lauda.svg)](https://pypi.python.org/pypi/lauda/)
[![Downloads](https://img.shields.io/pypi/dm/lauda.svg)](https://pypi.python.org/pypi/lauda/)

A very simple python module for measuring time.

## Install

    pip install lauda

## Usage
You can use lauda `StopWatch` to measure a portion of code

```python
from lauda import StopWatch

watch = StopWatch()
watch.start()
for i in range(10000000):
    pass
watch.stop()
print ('Time spent in range {0}'.format(watch.elapsed_time))
```
If you want to measure an entire function execution, you can decorate it using the `stopwatch` decorator

```python
from lauda import stopwatch

@stopwatch
def awesome_mul(a, b):
    return a * b
```

By default `stopwatch` decorator will print the time spent inside the decorated function, if you want more control you can pass to your decorator a callback that will receive a `StopWatch` instance and the decorated function.

```python
from lauda import stopwatch

def stopwatch_sum_cb(watch, function):
    print ('Time spent {0}'.format(watch.elapsed_time))
<commit_msg>Add some doc for the new elapsed_time property<commit_after># Lauda
[![Build Status][travis-image]][travis-url] [![Codecov.io Status][codecovio-image]][codecovio-url]
[![Latest Version](https://img.shields.io/pypi/v/lauda.svg)](https://pypi.python.org/pypi/lauda/)
[![Supported Python versions](https://img.shields.io/badge/python-2.6%2C%202.7%2C%203.3%2C%203.4-blue.svg)](https://pypi.python.org/pypi/lauda/)
[![License](https://img.shields.io/github/license/astagi/lauda.svg)](https://pypi.python.org/pypi/lauda/)
[![Downloads](https://img.shields.io/pypi/dm/lauda.svg)](https://pypi.python.org/pypi/lauda/)

A very simple python module for measuring time.

## Install

    pip install lauda

## Usage
You can use lauda `StopWatch` to measure a portion of code

```python
from lauda import StopWatch

watch = StopWatch()
watch.start()
for i in range(10000000):
    pass
watch.stop()
print ('Time spent in range {0}'.format(watch.elapsed_time))
```
You can also get the `elapsed_time` when the stopwatch is running

If you want to measure an entire function execution, you can decorate it using the `stopwatch` decorator

```python
from lauda import stopwatch

@stopwatch
def awesome_mul(a, b):
    return a * b
```

By default `stopwatch` decorator will print the time spent inside the decorated function, if you want more control you can pass to your decorator a callback that will receive a `StopWatch` instance and the decorated function.

```python
from lauda import stopwatch

def stopwatch_sum_cb(watch, function):
    print ('Time spent {0}'.format(watch.elapsed_time))

{'fraction_non_alphanumeric': 0.1419228253760628, 'fraction_numerical': 0.01765860039241334, 'mean_word_length': 4.974609375, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 16, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6659022', 'n_tokens_mistral': 1084, 'n_tokens_neox': 1012, 'n_words': 286}