Skip to content

Commit c004298

Browse files
committed
Render Timer diagrams with svgbob
This uses a syntax that is more friendly with svgbob and make the diagrams render nicely. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent a40be5c commit c004298

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

src/frequenz/channels/timer.py

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,16 @@ class TriggerAllMissed(MissedTickPolicy):
8787
`T5`, happens at 5.1 (0.1 seconds late), so it triggers immediately
8888
again. The seventh tick, `T6`, happens at 6.0, right on time.
8989
90-
```
91-
0 1 2 3 4 o 5 6
92-
o---------|-o-------|--o------|---------|--o------|o--------o-----> time
90+
<center>
91+
```bob
92+
0 1 2 3 4 T4 5 6
93+
*---------o-*-------o--*------o---------o--**-----o*--------*-----> time
9394
T0 T1 T2 T3 T5 T6
94-
T4
95+
96+
-o- "Expected ticks"
97+
-*- "Delivered ticks"
9598
```
99+
</center>
96100
"""
97101

98102
def calculate_next_tick_time(
@@ -134,11 +138,17 @@ class SkipMissedAndResync(MissedTickPolicy):
134138
`T5`, happens at 5.1 (0.1 seconds late), so it triggers immediately
135139
again. The seventh tick, `T6`, happens at 6.0, right on time.
136140
141+
<center>
142+
```bob
143+
0 1 2 3 4 T4 5 6
144+
*---------o-*-------o--*------o---------o--*O-----o-*-------*-----> time
145+
T0 T1 T2 T3 T5 T6
146+
147+
-o- "Expected ticks"
148+
-*- "Delivered ticks"
149+
-O- "Undelivered ticks (skipped)"
137150
```
138-
0 1 2 3 4 o 5 6
139-
o---------|-o-------|--o------|---------|--o------|o--------o-----> time
140-
T0 T1 T2 T3 T5 T6
141-
```
151+
</center>
142152
"""
143153

144154
def calculate_next_tick_time(
@@ -187,11 +197,17 @@ class SkipMissedAndDrift(MissedTickPolicy):
187197
so is right on time (no drift) and the same happens for tick `T6.3`,
188198
which triggers at 6.3 seconds.
189199
190-
```
200+
<center>
201+
```bob
191202
0 1 2 3 4 5 6
192-
o---------|-o-------|--o------|---------|--o------|--o------|--o--> time
193-
T0 T1 T2.2 T3.2 T5.3 T6.3
203+
*---------o-*-------|-o*------|-O-------|-o*------|--*------|--*--> time
204+
T0 T1.2 T2.2 T3.2 T4.2 T5.3 T6.3
205+
206+
-o- "Expected ticks"
207+
-*- "Delivered ticks"
208+
-O- "Undelivered ticks (skipped)"
194209
```
210+
</center>
195211
"""
196212

197213
def __init__(self, *, delay_tolerance: timedelta = timedelta(0)):

0 commit comments

Comments
 (0)