2017-01-24 15:09:23 +00:00
// Package tracing provides the Chrome Debugging Protocol
2017-02-12 04:59:33 +00:00
// commands, types, and events for the Tracing domain.
2017-01-24 15:09:23 +00:00
//
// Generated by the chromedp-gen command.
package tracing
2017-07-09 02:05:19 +00:00
// Code generated by chromedp-gen. DO NOT EDIT.
2017-01-24 15:09:23 +00:00
import (
"context"
2017-01-26 07:28:34 +00:00
cdp "github.com/knq/chromedp/cdp"
2017-01-24 15:09:23 +00:00
)
// StartParams start trace events collection.
type StartParams struct {
BufferUsageReportingInterval float64 ` json:"bufferUsageReportingInterval,omitempty" ` // If set, the agent will issue bufferUsage events at this interval, specified in milliseconds
TransferMode TransferMode ` json:"transferMode,omitempty" ` // Whether to report trace events as series of dataCollected events or to save trace to a stream (defaults to ReportEvents).
TraceConfig * TraceConfig ` json:"traceConfig,omitempty" `
}
// Start start trace events collection.
//
// parameters:
func Start ( ) * StartParams {
return & StartParams { }
}
// WithBufferUsageReportingInterval if set, the agent will issue bufferUsage
// events at this interval, specified in milliseconds.
func ( p StartParams ) WithBufferUsageReportingInterval ( bufferUsageReportingInterval float64 ) * StartParams {
p . BufferUsageReportingInterval = bufferUsageReportingInterval
return & p
}
// WithTransferMode whether to report trace events as series of dataCollected
// events or to save trace to a stream (defaults to ReportEvents).
func ( p StartParams ) WithTransferMode ( transferMode TransferMode ) * StartParams {
p . TransferMode = transferMode
return & p
}
2017-01-26 07:28:34 +00:00
// WithTraceConfig [no description].
2017-01-24 15:09:23 +00:00
func ( p StartParams ) WithTraceConfig ( traceConfig * TraceConfig ) * StartParams {
p . TraceConfig = traceConfig
return & p
}
2017-02-12 04:59:33 +00:00
// Do executes Tracing.start against the provided context and
// target handler.
func ( p * StartParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandTracingStart , p , nil )
2017-01-24 15:09:23 +00:00
}
// EndParams stop trace events collection.
type EndParams struct { }
// End stop trace events collection.
func End ( ) * EndParams {
return & EndParams { }
}
2017-02-12 04:59:33 +00:00
// Do executes Tracing.end against the provided context and
// target handler.
func ( p * EndParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandTracingEnd , nil , nil )
2017-01-24 15:09:23 +00:00
}
// GetCategoriesParams gets supported tracing categories.
type GetCategoriesParams struct { }
// GetCategories gets supported tracing categories.
func GetCategories ( ) * GetCategoriesParams {
return & GetCategoriesParams { }
}
// GetCategoriesReturns return values.
type GetCategoriesReturns struct {
Categories [ ] string ` json:"categories,omitempty" ` // A list of supported tracing categories.
}
2017-02-12 04:59:33 +00:00
// Do executes Tracing.getCategories against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
// categories - A list of supported tracing categories.
2017-02-12 04:59:33 +00:00
func ( p * GetCategoriesParams ) Do ( ctxt context . Context , h cdp . Handler ) ( categories [ ] string , err error ) {
2017-01-24 15:09:23 +00:00
// execute
2017-02-14 08:41:23 +00:00
var res GetCategoriesReturns
err = h . Execute ( ctxt , cdp . CommandTracingGetCategories , nil , & res )
if err != nil {
return nil , err
2017-01-24 15:09:23 +00:00
}
2017-02-14 08:41:23 +00:00
return res . Categories , nil
2017-01-24 15:09:23 +00:00
}
// RequestMemoryDumpParams request a global memory dump.
type RequestMemoryDumpParams struct { }
// RequestMemoryDump request a global memory dump.
func RequestMemoryDump ( ) * RequestMemoryDumpParams {
return & RequestMemoryDumpParams { }
}
// RequestMemoryDumpReturns return values.
type RequestMemoryDumpReturns struct {
DumpGUID string ` json:"dumpGuid,omitempty" ` // GUID of the resulting global memory dump.
Success bool ` json:"success,omitempty" ` // True iff the global memory dump succeeded.
}
2017-02-12 04:59:33 +00:00
// Do executes Tracing.requestMemoryDump against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
2017-01-26 07:28:34 +00:00
// dumpGUID - GUID of the resulting global memory dump.
2017-01-24 15:09:23 +00:00
// success - True iff the global memory dump succeeded.
2017-02-12 04:59:33 +00:00
func ( p * RequestMemoryDumpParams ) Do ( ctxt context . Context , h cdp . Handler ) ( dumpGUID string , success bool , err error ) {
2017-01-24 15:09:23 +00:00
// execute
2017-02-14 08:41:23 +00:00
var res RequestMemoryDumpReturns
err = h . Execute ( ctxt , cdp . CommandTracingRequestMemoryDump , nil , & res )
if err != nil {
return "" , false , err
2017-01-24 15:09:23 +00:00
}
2017-02-14 08:41:23 +00:00
return res . DumpGUID , res . Success , nil
2017-01-24 15:09:23 +00:00
}
// RecordClockSyncMarkerParams record a clock sync marker in the trace.
type RecordClockSyncMarkerParams struct {
SyncID string ` json:"syncId" ` // The ID of this clock sync marker
}
// RecordClockSyncMarker record a clock sync marker in the trace.
//
// parameters:
2017-01-26 07:28:34 +00:00
// syncID - The ID of this clock sync marker
func RecordClockSyncMarker ( syncID string ) * RecordClockSyncMarkerParams {
2017-01-24 15:09:23 +00:00
return & RecordClockSyncMarkerParams {
2017-01-26 07:28:34 +00:00
SyncID : syncID ,
2017-01-24 15:09:23 +00:00
}
}
2017-02-12 04:59:33 +00:00
// Do executes Tracing.recordClockSyncMarker against the provided context and
// target handler.
func ( p * RecordClockSyncMarkerParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandTracingRecordClockSyncMarker , p , nil )
2017-01-24 15:09:23 +00:00
}