mirror of
https://github.com/golang/go
synced 2024-11-05 16:06:10 -07:00
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: Hyang-Ah Hana Kim <hyangah@gmail.com>
This commit is contained in:
parent
22000f5407
commit
7ca53f2f8b
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user