Skip to content

Commit 1554ddb

Browse files
committed
Update opt-trace-format.md
1 parent dd8772d commit 1554ddb

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎v3/docs/opt-trace-format.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,17 @@ The `event` field can either be:
755755

756756
As soon as a funcition becomes a parent of another function (i.e., a nested function is defined inside of it), then set the `is_parent` field of its stack entry to `true`. Also change its `unique_hash` by appending `_p` to the end of it. The reason why we want to change the unique hash is that we want the frontend to *refresh* its display, and d3 might not refresh if it sees that the hash is identical to the prior frame. Conceptually, we want `unique_hash` to be different for a function before and after it turns into the parent of another function since we want to display it differently.
757757

758+
For example, when function `foo` is executing, its frame will have `is_parent` set to `false` when its first two lines execute. Then when its third line executes, that defines `bar` as a nested function within itself, so at that step, `foo` should have `is_parent = true` and `unique_hash = foo_f1_p` (or something similar).
759+
760+
```python
761+
def foo(y):
762+
x = 10
763+
y = 20
764+
def bar(x):
765+
return x + y
766+
767+
foo(1)```
768+
758769
[TODO: talk about `parent_frame_id_list`]
759770

760771
[TODO: talk about appending `_z` onto `unique_hash` when the frame becomes a zombie.]

0 commit comments

Comments
 (0)