https://github.com/carvetighter/timer
A simple wrapper to time how long methods occur. This is designed for methods that take seconds not micro-seconds.
https://github.com/carvetighter/timer
python python-3 python3 timer timers
Last synced: 2 months ago
JSON representation
A simple wrapper to time how long methods occur. This is designed for methods that take seconds not micro-seconds.
- Host: GitHub
- URL: https://github.com/carvetighter/timer
- Owner: carvetighter
- Created: 2018-02-24T05:06:47.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-21T04:42:14.000Z (about 6 years ago)
- Last Synced: 2025-05-17T14:42:40.514Z (5 months ago)
- Topics: python, python-3, python3, timer, timers
- Language: Python
- Homepage:
- Size: 40 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# TimerWrapper
This is a very small package and is designed to time different parts of code that take more than a second. This package is not intended to replace ``timeit`` or any other timer. This is intended for developers to make debugging a bit easier.
### Installation
```pip install TimerWrapper```
### Usage
**Example 01:**
```python
from TimerWrapper import Timertimer_00 = Timer()
float_time = timer_00.stop()
print(float_time)
```**Example 01 Output (5 seconds):**
```
5.0
```**Example 02:**
```pythonfrom TimerWrapper import Timer
timer_01 = Timer('added text')
timer_01.stop_timer(m_bool_print = True)
```**Example 02 Output (5 seconds):**
```
process time is: 00:00:05 added text
```**Clearing the timer:**
You can use the same instance to time additonal code blocks. You must clear the timer first.
```python
from TimerWrapper import Timertimer_01 = Timer()
float_time_00 = timer_01.stop_timer()
timer_01.clear_timer()
timer_01.start_timer()float_time_01 = timer_01.stop_timer()
``````float_time_00``` and ```float_time_01``` are different.