Service returns the service.Capture description for this capture.
(ctx context.Context, p *path.Capture)
| 176 | |
| 177 | // Service returns the service.Capture description for this capture. |
| 178 | func (c *GraphicsCapture) Service(ctx context.Context, p *path.Capture) *service.Capture { |
| 179 | apis := make([]*path.API, len(c.APIs)) |
| 180 | for i, a := range c.APIs { |
| 181 | apis[i] = &path.API{ID: path.NewID(id.ID(a.ID()))} |
| 182 | } |
| 183 | var observations []*service.MemoryRange |
| 184 | if !p.ExcludeMemoryRanges { |
| 185 | observations = make([]*service.MemoryRange, len(c.Observed)) |
| 186 | for i, o := range c.Observed { |
| 187 | observations[i] = &service.MemoryRange{Base: o.First, Size: o.Count} |
| 188 | } |
| 189 | } |
| 190 | return &service.Capture{ |
| 191 | Type: service.TraceType_Graphics, |
| 192 | Name: c.name, |
| 193 | Device: c.Header.Device, |
| 194 | ABI: c.Header.ABI, |
| 195 | NumCommands: uint64(len(c.Commands)), |
| 196 | APIs: apis, |
| 197 | Observations: observations, |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | // Export encodes the given capture and associated resources |
| 202 | // and writes it to the supplied io.Writer in the .gfxtrace format. |