Beispiel #1
0
    def test_clear_timers(self):
        """Test clear timers"""
        t = Timer(matlab_like=False)
        for i in range(10):
            t.start(i)

        t.clear_timers()
        assert len(t._timers_start) == 0, "Timers not restarting"
Beispiel #2
0
elapsed = toc()
print("Elapsed time:", elapsed)

print("\nNested Tic Toc")
tic()
for i in range(2):
    tic()
    time.sleep(1)
    elapsed = toc()
    print("[IN LOOP] Elapsed time:", elapsed)
print("[OUT LOOP] Elapsed time:", toc())

print("\n>>>Using Timer class")
print("\nSimple")
t = Timer()
t.start()
time.sleep(1)
elapsed = t.stop()
print("Elapsed time:", elapsed)

print("\nNested")
t.start()
for i in range(2):
    t.start()
    time.sleep(1)
    elapsed = t.stop()
    print("[IN LOOP] Elapsed time:", elapsed)
print("[OUT LOOP] Elapsed time:", t.stop())

print(">>> Tic Toc, v2 (non matlab-like)")
print("\nSimple Tic Toc")