Commit 7ca53f2f authored by Austin Clements's avatar Austin Clements

cmd/trace: show swept and reclaimed bytes

This displays the swept and reclaimed bytes for sweep events in the
lower panel of the trace viewer.

Change-Id: If1665a1c02bbc47700e0d9f515e574f013f3f285
Reviewed-on: https://go-review.googlesource.com/40812
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarHyang-Ah Hana Kim <hyangah@gmail.com>
parent 22000f54
......@@ -481,7 +481,13 @@ func generateTrace(params *traceParams) (ViewerData, error) {
}
ctx.emitSlice(&fakeMarkStart, text)
case trace.EvGCSweepStart:
ctx.emitSlice(ev, "SWEEP")
slice := ctx.emitSlice(ev, "SWEEP")
if done := ev.Link; done != nil && done.Args[0] != 0 {
slice.Arg = struct {
Swept uint64 `json:"Swept bytes"`
Reclaimed uint64 `json:"Reclaimed bytes"`
}{done.Args[0], done.Args[1]}
}
case trace.EvGoStart, trace.EvGoStartLabel:
info := getGInfo(ev.G)
if ev.Type == trace.EvGoStartLabel {
......@@ -574,8 +580,8 @@ func (ctx *traceContext) proc(ev *trace.Event) uint64 {
}
}
func (ctx *traceContext) emitSlice(ev *trace.Event, name string) {
ctx.emit(&ViewerEvent{
func (ctx *traceContext) emitSlice(ev *trace.Event, name string) *ViewerEvent {
sl := &ViewerEvent{
Name: name,
Phase: "X",
Time: ctx.time(ev),
......@@ -583,7 +589,9 @@ func (ctx *traceContext) emitSlice(ev *trace.Event, name string) {
Tid: ctx.proc(ev),
Stack: ctx.stack(ev.Stk),
EndStack: ctx.stack(ev.Link.Stk),
})
}
ctx.emit(sl)
return sl
}
type heapCountersArg struct {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment