• Hana Kim's avatar
    internal/trace: fix GC time computation of short goroutines · 61f92ee5
    Hana Kim authored
    Goroutine analysis reports the sum of all overlapping GC intervals as
    the GCTime of a goroutine. The computation is done by adding the length
    of a completed GC interval to 'active' goroutines when processing the
    corresponding EvGCDone event. This change fixes the two corner cases
    the current implementation ignores:
    
    1) Goroutine that ends during GC. Previously, this goroutine was ignored
    and GC time was undercounted. We handle this case by setting the
    gcStartTime only when GC is active and handling non-zero gcStartTime
    when processing EvGoStop and EvGoStart.
    
    2) Goroutine that starts during GC. Previously, the entire GC interval
    length was added to the Goroutine's GCTime which resulted in overcount
    of GC time. We handle this case by computing the length of overlapped
    period precisely.
    
    Change-Id: Ifa8e82672ec341b5ff87837209f4311fa7262b7f
    Reviewed-on: https://go-review.googlesource.com/100842Reviewed-by: 's avatarHeschi Kreinick <heschi@google.com>
    Run-TryBot: Heschi Kreinick <heschi@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    61f92ee5
Name
Last commit
Last update
..
testdata Loading commit data...
goroutines.go Loading commit data...
mkcanned.bash Loading commit data...
order.go Loading commit data...
parser.go Loading commit data...
parser_test.go Loading commit data...
writer.go Loading commit data...