1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 """Contains the Monitoring class."""
19
20 from timelinelib.timer import Timer
24 """
25 * Kepp track of the number of times the timeline has been redrawn.
26 * Measure the time it takes to redraw.
27 """
29 self._timeline_redraw_count = 0
30 self._category_redraw_count = 0
31 if timer is None:
32 self._timer = Timer()
33 else:
34 self._timer = timer
35
37 """Increment counter."""
38 self._timeline_redraw_count += 1
39
41 """Increment counter."""
42 self._category_redraw_count += 1
43
45 """Start time measurement."""
46 self._timer.start()
47
49 """Stop time measurement."""
50 self._timer.end()
51
52 @property
54 "return the elapsed time in milliseconds."
55 return self._timer.elapsed_ms
56