diff options
| author | Hana Kim <hakim@google.com> | 2018-02-22 13:27:39 -0500 |
|---|---|---|
| committer | Hyang-Ah Hana Kim <hyangah@gmail.com> | 2018-03-02 20:15:57 +0000 |
| commit | 16398894dccf06e34af8fb1c7cff6eed9b163057 (patch) | |
| tree | f36991b9d4fea859e4b0af0f80c1236e639d40d1 /src/internal/trace/parser.go | |
| parent | 644b2dafc2885d0780605fa66061431fef55645a (diff) | |
| download | go-16398894dccf06e34af8fb1c7cff6eed9b163057.tar.xz | |
internal/trace: remove backlinks from span/task end to start
Even though undocumented, the assumption is the Event's link field
points to the following event in the future. The new span/task event
processing breaks the assumption.
Change-Id: I4ce2f30c67c4f525ec0a121a7e43d8bdd2ec3f77
Reviewed-on: https://go-review.googlesource.com/96395
Reviewed-by: Heschi Kreinick <heschi@google.com>
Diffstat (limited to 'src/internal/trace/parser.go')
| -rw-r--r-- | src/internal/trace/parser.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/internal/trace/parser.go b/src/internal/trace/parser.go index 155c23940a..29ba73c761 100644 --- a/src/internal/trace/parser.go +++ b/src/internal/trace/parser.go @@ -56,8 +56,7 @@ type Event struct { // for GoSysExit: the next GoStart // for GCMarkAssistStart: the associated GCMarkAssistDone // for UserTaskCreate: the UserTaskEnd - // for UsetTaskEnd: the UserTaskCreate - // for UserSpan: the corresponding span start or end event + // for UserSpan: if the start span, the corresponding UserSpan end event Link *Event } @@ -810,9 +809,10 @@ func postProcessTrace(ver int, events []*Event) error { } tasks[ev.Args[0]] = ev case EvUserTaskEnd: - if prevEv, ok := tasks[ev.Args[0]]; ok { - prevEv.Link = ev - ev.Link = prevEv + taskid := ev.Args[0] + if taskCreateEv, ok := tasks[taskid]; ok { + taskCreateEv.Link = ev + delete(tasks, taskid) } case EvUserSpan: mode := ev.Args[1] @@ -828,7 +828,6 @@ func postProcessTrace(ver int, events []*Event) error { } // Link span start event with span end event s.Link = ev - ev.Link = s if n > 1 { activeSpans[ev.G] = spans[:n-1] |
