Timer Module with performance profiling features
Project description
📋 Prerequisite:
Requires Python >= 3.10
TimeProfiler makes use of new features from Python's typing module.
🛠️ Installation:
pip install timer-module
🖥️ Timer Usage:
import time
from timer_module import TimerModule
timer_module = TimerModule().start()
timer_module.pause()
time.sleep(2)
timer_module.start()
time.sleep(2)
time_seconds = timer_module.get_time()
print(time_seconds)
Set the timer
timer_module = TimerModule().set_time(5).start()
Refresh time (preserves timer state):
timer_module.refresh()
Reset time (resets everyting)
timer_module.reset()
🖥️ Profiler Usage:
TimeProfiler also includes a "function_profiler" and "async_function_profiler", in a class the asynchronous methods are handled automatically, but for functions you need to select the appropriate decorator.
import time
from timer_module import TimeProfiler
# You only need this line to profile the entire class
# The program is run normally, this decorator will wrap
# The class and its methods in order to track execution time
@TimeProfiler().class_profiler
class ExampleClass:
def __init__(self):
time.sleep(0.1)
def method_1(self):
time.sleep(0.5)
self.method_2()
def method_2(self):
time.sleep(1)
self.method_3()
def method_3(self):
time.sleep(1)
self.method_4()
def method_4(self):
time.sleep(0.1)
self.method_5()
def method_5(self):
time.sleep(0.1)
ec = ExampleClass()
ec.method_1()
Output:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
timer-module-1.1.3.tar.gz
(7.1 kB
view hashes)
Built Distribution
Close
Hashes for timer_module-1.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f1e201288151d4baded85cff97bd997e171dd4b87c6a75fe9c82181d1d05fc9 |
|
MD5 | 16fa1c12e6ed6e8445a5e6519d9da9f3 |
|
BLAKE2b-256 | 4a95123dc7b92346b44b6b3a0a39eb75fc96020d061d016b59f40eb0f4cded09 |