Skip to content

cmd/trace: SWEEP events' swept/reclaimed bytes info is not emitted #27711

@hyangah

Description

@hyangah

https://golang.org/cl/92375 changed emitted ViewerEvents to be processed in a streaming fashion - traceContext.emit, called as soon as a ViewerEvent is produced, encodes and writes the ViewerEvent as a json object. This helped use creating a big slice of ViewerEvent.

This doesn't work for trace.EvGCSweepStart which depends on modification of the ViewerEvent object after the traceContext.emit call.

case trace.EvGCSweepStart:
   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]}
  }

This caused to drop the useful information about the sweep process in Arg field.

@aclements

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions