]> Cypherpunks repositories - gostls13.git/commit
internal/trace: fix double counting in span analysis
authorHana Kim <hakim@google.com>
Wed, 28 Mar 2018 18:19:09 +0000 (14:19 -0400)
committerHyang-Ah Hana Kim <hyangah@gmail.com>
Wed, 28 Mar 2018 20:18:41 +0000 (20:18 +0000)
commitad638fbfb5acf1e9ced976067961e5e62360484a
tree9176088ce1c38cf32d13e3cbad9e3250170e748e
parentdafca7de0f71a06d23ad31f397c2f054b670b822
internal/trace: fix double counting in span analysis

When snapshotting the execution time stats of a goroutine
we take into account the intermediate values kepts in the GDesc's
gdesc field. At the end of goroutine analysis, we go through all
goroutines and replace the GExecutionStat with the new snapshot.
Here the mistake was that we replaced the GExecutionStat with
the value that reflects the intermediate values, but did clear
the intermediate values. So, when the following finalizeActiveSpans
runs, it trieds to add the intermediate values again (double-counting)
when taking a snapshot.

Fix the issue by using the finalized GExecutionStat instead of
recomputing the snapshot. While we are here, refactor the finalization
logic so it can be used when processing GoEnd, GoStop events.

Change-Id: Ibdb342214c29b65d4ea37e52b1f8b83f1fb20143
Reviewed-on: https://go-review.googlesource.com/103157
Reviewed-by: Peter Weinberger <pjw@google.com>
src/internal/trace/goroutines.go