Commit 00b3627
committed
[vm] Reduce duplication when writing Perfetto packets
Consolidate code populating TracePacket in a single
function instead of multiple helpers. Most of the
duplication in the previous code was caused by
how Duration events were handled - this CL
avoids this duplication by making the core helper
takes event_type, timestamp and timeline event.
This allows to perform Duration split simply by
doing:
PopulateAndWritePacket(TimelineEvent::kBegin, event.TimeOrigin(), event);
PopulateAndWritePacket(TimelineEvent::kEnd, event.TimeEnd(), event);
Instead of duplicating large chunks of code.
TEST=ci
Change-Id: Ica5d00264f3e872b939059ea90fcbfbf6c8768e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/417201
Reviewed-by: Derek Xu <[email protected]>1 parent c513372 commit 00b3627
File tree
7 files changed
+185
-222
lines changed- pkg/vm_service_protos/lib/src/protos/perfetto/trace/track_event
- runtime/vm
- protos/perfetto/trace/track_event
7 files changed
+185
-222
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
| 154 | + | |
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
| |||
50 | 53 | | |
51 | 54 | | |
52 | 55 | | |
| 56 | + | |
53 | 57 | | |
54 | 58 | | |
55 | 59 | | |
| |||
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| |||
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
79 | | - | |
80 | | - | |
81 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
43 | | - | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
50 | 54 | | |
51 | 55 | | |
52 | 56 | | |
| |||
116 | 120 | | |
117 | 121 | | |
118 | 122 | | |
| 123 | + | |
119 | 124 | | |
120 | 125 | | |
121 | 126 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
| 116 | + | |
115 | 117 | | |
116 | 118 | | |
117 | 119 | | |
| |||
0 commit comments