func (c *Tracing) Start(ctx context.Context, categories string, options string, bufferUsageReportingInterval float64, transferMode string, streamFormat string, streamCompression string, traceConfig *TracingTraceConfig, perfettoConfig string, tracingBackend string) (*gcdmessage.ChromeResponse, error) {
	var v TracingStartParams
	v.Categories = categories
	v.Options = options
	v.BufferUsageReportingInterval = bufferUsageReportingInterval
	v.TransferMode = transferMode
	v.StreamFormat = streamFormat
	v.StreamCompression = streamCompression
	v.TraceConfig = traceConfig
	v.PerfettoConfig = perfettoConfig
	v.TracingBackend = tracingBackend
	return c.StartWithParams(ctx, &v)
}
Start - Start trace events collection.
categories - Category/tag filter
options - Tracing options
bufferUsageReportingInterval - If set, the agent will issue bufferUsage events at this interval, specified in milliseconds
transferMode - Whether to report trace events as series of dataCollected events or to save trace to a stream (defaults to `ReportEvents`).
streamFormat - Trace data format to use. This only applies when using `ReturnAsStream` transfer mode (defaults to `json`). enum values: json, proto
streamCompression - Compression format to use. This only applies when using `ReturnAsStream` transfer mode (defaults to `none`) enum values: none, gzip
traceConfig -
perfettoConfig - Base64-encoded serialized perfetto.protos.TraceConfig protobuf message When specified, the parameters `categories`, `options`, `traceConfig` are ignored. (Encoded as a base64 string when passed over JSON)
tracingBackend - Backend type (defaults to `auto`) enum values: auto, chrome, system
package gcdapi
import (
	"context"
	"github.com/wirepair/gcd/v2/gcdmessage"
)
type TracingTraceConfig struct {
	RecordMode           string                 `json:"recordMode,omitempty"`            
	EnableSampling       bool                   `json:"enableSampling,omitempty"`        
	EnableSystrace       bool                   `json:"enableSystrace,omitempty"`        
	EnableArgumentFilter bool                   `json:"enableArgumentFilter,omitempty"`  
	IncludedCategories   []string               `json:"includedCategories,omitempty"`    
	ExcludedCategories   []string               `json:"excludedCategories,omitempty"`    
	SyntheticDelays      []string               `json:"syntheticDelays,omitempty"`       
	MemoryDumpConfig     map[string]interface{} `json:"memoryDumpConfig,omitempty"`      
}
type TracingBufferUsageEvent struct {
	Method string `json:"method"`
	Params struct {
		PercentFull float64 `json:"percentFull,omitempty"`  
		EventCount  float64 `json:"eventCount,omitempty"`   
		Value       float64 `json:"value,omitempty"`        
	} `json:"Params,omitempty"`
}
type TracingTracingCompleteEvent struct {
	Method string `json:"method"`
	Params struct {
		DataLossOccurred  bool   `json:"dataLossOccurred"`             
		Stream            string `json:"stream,omitempty"`             
		TraceFormat       string `json:"traceFormat,omitempty"`        
		StreamCompression string `json:"streamCompression,omitempty"`  
	} `json:"Params,omitempty"`
}
type Tracing struct {
	target gcdmessage.ChromeTargeter
}
func NewTracing(target gcdmessage.ChromeTargeter) *Tracing {
	c := &Tracing{target: target}
	return c
}
func (c *Tracing) End(ctx context.Context) (*gcdmessage.ChromeResponse, error) {
	return c.target.SendDefaultRequest(ctx, &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Tracing.end"})
}
func (c *Tracing) GetCategories(ctx context.Context) ([]string, error) {
	resp, err := c.target.SendCustomReturn(ctx, &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Tracing.getCategories"})
	if err != nil {
		return nil, err
	}
	var chromeData struct {
		Result struct {
			Categories []string
		}
	}
	if resp == nil {
		return nil, &gcdmessage.ChromeEmptyResponseErr{}
	}
	cerr := &gcdmessage.ChromeErrorResponse{}
	json.Unmarshal(resp.Data, cerr)
	if cerr != nil && cerr.Error != nil {
		return nil, &gcdmessage.ChromeRequestErr{Resp: cerr}
	}
	if err := json.Unmarshal(resp.Data, &chromeData); err != nil {
		return nil, err
	}
	return chromeData.Result.Categories, nil
}
type TracingRecordClockSyncMarkerParams struct {
	SyncId string `json:"syncId"`
}
func (c *Tracing) RecordClockSyncMarkerWithParams(ctx context.Context, v *TracingRecordClockSyncMarkerParams) (*gcdmessage.ChromeResponse, error) {
	return c.target.SendDefaultRequest(ctx, &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Tracing.recordClockSyncMarker", Params: v})
}
func (c *Tracing) RecordClockSyncMarker(ctx context.Context, syncId string) (*gcdmessage.ChromeResponse, error) {
	var v TracingRecordClockSyncMarkerParams
	v.SyncId = syncId
	return c.RecordClockSyncMarkerWithParams(ctx, &v)
}
type TracingRequestMemoryDumpParams struct {
	Deterministic bool `json:"deterministic,omitempty"`
	LevelOfDetail string `json:"levelOfDetail,omitempty"`
}
func (c *Tracing) RequestMemoryDumpWithParams(ctx context.Context, v *TracingRequestMemoryDumpParams) (string, bool, error) {
	resp, err := c.target.SendCustomReturn(ctx, &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Tracing.requestMemoryDump", Params: v})
	if err != nil {
		return "", false, err
	}
	var chromeData struct {
		Result struct {
			DumpGuid string
			Success  bool
		}
	}
	if resp == nil {
		return "", false, &gcdmessage.ChromeEmptyResponseErr{}
	}
	cerr := &gcdmessage.ChromeErrorResponse{}
	json.Unmarshal(resp.Data, cerr)
	if cerr != nil && cerr.Error != nil {
		return "", false, &gcdmessage.ChromeRequestErr{Resp: cerr}
	}
	if err := json.Unmarshal(resp.Data, &chromeData); err != nil {
		return "", false, err
	}
	return chromeData.Result.DumpGuid, chromeData.Result.Success, nil
}
func (c *Tracing) RequestMemoryDump(ctx context.Context, deterministic bool, levelOfDetail string) (string, bool, error) {
	var v TracingRequestMemoryDumpParams
	v.Deterministic = deterministic
	v.LevelOfDetail = levelOfDetail
	return c.RequestMemoryDumpWithParams(ctx, &v)
}
type TracingStartParams struct {
	Categories string `json:"categories,omitempty"`
	Options string `json:"options,omitempty"`
	BufferUsageReportingInterval float64 `json:"bufferUsageReportingInterval,omitempty"`
	TransferMode string `json:"transferMode,omitempty"`
	StreamFormat string `json:"streamFormat,omitempty"`
	StreamCompression string `json:"streamCompression,omitempty"`
	TraceConfig *TracingTraceConfig `json:"traceConfig,omitempty"`
	PerfettoConfig string `json:"perfettoConfig,omitempty"`
	TracingBackend string `json:"tracingBackend,omitempty"`
}
func (c *Tracing) StartWithParams(ctx context.Context, v *TracingStartParams) (*gcdmessage.ChromeResponse, error) {
	return c.target.SendDefaultRequest(ctx, &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Tracing.start", Params: v})
}