pygsti.tools.opttools.timed_block#
- timed_block(label, time_dict=None, printer=None, verbosity=2, round_places=6, pre_message=None, format_str=None)#
Context manager that times a block of code
- Parameters:
label (str) – An identifying label for this timed block.
time_dict (dict, optional) – A dictionary to store the final time in, under the key label.
printer (VerbosityPrinter, optional) – A printer object to log the timer’s message. If None, this message will be printed directly.
verbosity (int, optional) – The verbosity level at which to print the time message (if printer is given).
round_places (int, optional) – How many decimal places of precision to print time with (in seconds).
pre_message (str, optional) – A format string to print out before the timer’s message, which formats the label argument, e.g. “My label is {}”.
format_str (str, optional) – A format string used to format the label before the resulting “rendered label” is used as the first argument in the final formatting string “{} took {} seconds”.