chandlerc wrote:

> can you explain
> 
> ```
> Because a child's relative start timestamp can round down by 1us less than 
> its parent's start plus elapsed duration, clamp child start timestamps 
> top-down at write time so child intervals never overrun their parent's 
> interval and sibling intervals remain non-overlapping.
> ```
> 
> better? I'm not understanding this. If we round down start and duration, 
> child intervals should never overrun parent intervals and should never 
> overlap sibling intervals?

We can end up with children overrunning parents when its the _parents_ that are 
rounded down and not the children. I generated the following example that I 
think helps illustrate:

>From `StartTime = 0`:
- `Parent`: `[0.5, 3.4]` -> `ts = floor(0.5) = 0`, `dur = floor(2.9) = 2` -> 
**`[0, 2]`**
- `Child1`: `[1.0, 2.0]` -> `ts = floor(1.0) = 1`, `dur = floor(1.0) = 1` -> 
**`[1, 2]`**
- `Child2`: `[2.0, 3.0]` -> `ts = floor(2.0) = 2`, `dur = floor(1.0) = 1` -> 
**`[2, 3]`**

I've also added the example to the code comment, as it seems really hard to 
understand without the example.

https://github.com/llvm/llvm-project/pull/228677
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to