MCPcopy Create free account
hub / github.com/FEniCS/dolfinx / test_timer

Function test_timer

python/test/unit/common/test_timer.py:16–34  ·  view source on GitHub ↗

Test that named Timer works.

()

Source from the content-addressed store, hash-verified

14
15
16def test_timer():
17 """Test that named Timer works."""
18 dt = 0.05
19 task = "test_named_str"
20 t = common.Timer(task)
21 t.start()
22 sleep(dt)
23 t.stop()
24 assert t.elapsed().total_seconds() > 0.9 * dt
25
26 t.resume()
27 sleep(dt)
28 t.stop()
29 assert t.elapsed().total_seconds() > 2 * 0.9 * dt
30
31 t.flush()
32 t = common.timing(task)
33 assert t[0] == 1
34 assert t[1].total_seconds() > 0.045
35
36
37def test_timer_flush_stop():

Callers

nothing calls this directly

Calls 7

startMethod · 0.95
stopMethod · 0.95
elapsedMethod · 0.95
resumeMethod · 0.95
flushMethod · 0.95
TimerMethod · 0.80
timingMethod · 0.45

Tested by

no test coverage detected