def print_summary()

in src/graphing/summary.py [0:0]


def print_summary(pauses_milliseconds, label=None, print_title=True, total_runtime_seconds=0, timestamps=None):
    # Parameters:
    #   pauses_milliseconds    : list of pauses (floats)
    #   label                 : label for this row in the table
    #   print_title(optional) : bool, True => print recorded values
    pauses_milliseconds = list(pauses_milliseconds)
    if type(timestamps) != type(None):
        timestamps = list(timestamps)
    if pauses_milliseconds:
        max_pause = round(max(pauses_milliseconds, key=lambda i: float(i)), 4)
        sum_pauses = round(sum(float(i) for i in pauses_milliseconds), 4)
        average_wait = round(sum_pauses / len(pauses_milliseconds), 4)
        std_deviation = round(np.std(pauses_milliseconds), 4)
    else:
        max_pause, sum_pauses, average_wait, std_deviation = 0, 0, 0, 0
    throughput = None
    if total_runtime_seconds:
        print(total_runtime_seconds)
        throughput = round(((total_runtime_seconds * 1000) - sum_pauses) / (total_runtime_seconds * 1000), 4) * 100
    elif timestamps:
        throughput = round(((timestamps[-1] * 1000) - sum_pauses) / (timestamps[-1] * 1000), 4) * 100

    # Print title with formatting
    if print_title:
        title = "  summary (ms)   | "  # 15 + 3 characters
        title += "Event Count   | "
        title += "Max Duration  | "
        title += "Sum Duration  | "
        title += "Mean Duration | "
        title += "Std Dev.      |"
        if throughput:
            title += " Throughput    |"
        print(title)
        print("-" * len(title))
    num_chars = 13
    if not label:
        label = "Run:"
    # print with correct formatting the values
    number_label_chars = 15
    label = label[-number_label_chars:]
    line = __string_const_chars(label, number_label_chars) + " | "
    line += float_constant_chars(str(len(pauses_milliseconds)), num_chars) + " | "
    line += float_constant_chars(str(max_pause), num_chars) + " | "
    line += float_constant_chars(str(sum_pauses), num_chars) + " | "
    line += float_constant_chars(str(average_wait), num_chars) + " | "
    line += float_constant_chars(str(std_deviation), num_chars) + " | "
    if throughput:
        line += float_constant_chars(str(round(throughput, 7)), num_chars) + " % "
    print(line)