import time
from collections.abc import Callable

from matrix import Matrix
from random import random

_THREADS = 20


def measure_time(func: Callable, *args) -> float:
    t1 = time.process_time()
    func(*args)
    t2 = time.process_time()
    return round(t2 - t1, 5)


tests = [50 * i for i in range(1, 21)]

for test in tests:
    mt1 = Matrix(size=test, suplyer=random)
    mt2 = Matrix(size=test, suplyer=random)

    t1 = measure_time(lambda: mt1 * mt2)
    t5 = measure_time(lambda: mt1 * (mt2, 5))
    t20 = measure_time(lambda: mt1 * (mt2, 20))

    print(f"|{f'{test}x{test}':<16}|{t1:^11}|{t5:^11}|{t20:^12}|")