pyrc.tools.timing#
- class Timing(name: str = '', print_init: bool = True, print_results: bool = True, no_logging: bool = False, result_path: str = None)#
Bases:
objectClass for simple timing.
This class was originally written by Joel Kimmich in his Fraqualex-project.
- Parameters:
name (str, optional) – Possible prefix
print_init (bool, optional) – If True the dialog ‘Started Timing’ will be printed out of init
print_results (bool, optional) – If False no prints will be done
no_logging (bool, optional) – If True no logging will be done, which speeds up the timing a bit.
result_path (str, optional) – The path to save a result file with all events. If None the result will not be saved.
Examples
>>> time = Timing() >>> time.catch_time() # prints out the current time and the difference to the last catch_time call >>> time.end_timing() # ends the timing with a last print out (if print_results is True) >>> log: dict = time.log # in the log you can find all times deltas in a dict (if no_logging is False)
- __init__(name: str = '', print_init: bool = True, print_results: bool = True, no_logging: bool = False, result_path: str = None)#
Class for simple timing.
This class was originally written by Joel Kimmich in his Fraqualex-project.
- Parameters:
name (str, optional) – Possible prefix
print_init (bool, optional) – If True the dialog ‘Started Timing’ will be printed out of init
print_results (bool, optional) – If False no prints will be done
no_logging (bool, optional) – If True no logging will be done, which speeds up the timing a bit.
result_path (str, optional) – The path to save a result file with all events. If None the result will not be saved.
Examples
>>> time = Timing() >>> time.catch_time() # prints out the current time and the difference to the last catch_time call >>> time.end_timing() # ends the timing with a last print out (if print_results is True) >>> log: dict = time.log # in the log you can find all times deltas in a dict (if no_logging is False)
- catch_time(message=None)#
- property clock#
- end_timing(return_times: bool = False)#
- property log: dict#
- property log_hr#
- property seconds#
- property time#
- ns_to_hr_time(nanoseconds: int)#
Parses a value in nanoseconds to a human-readable time string.
Use this function only for relative values because the absolute value isn’t defined.
- Parameters:
nanoseconds (int)
- Returns:
The human-readable time string with hours:minutes:seconds. Seconds has four decimal digits.
- Return type:
str