2017-01-24 15:09:23 +00:00
// Package heapprofiler provides the Chrome Debugging Protocol
2017-02-12 04:59:33 +00:00
// commands, types, and events for the HeapProfiler domain.
2017-01-24 15:09:23 +00:00
//
// Generated by the chromedp-gen command.
package heapprofiler
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
"github.com/knq/chromedp/cdp/runtime"
)
2017-01-26 07:28:34 +00:00
// EnableParams [no description].
2017-01-24 15:09:23 +00:00
type EnableParams struct { }
2017-01-26 07:28:34 +00:00
// Enable [no description].
2017-01-24 15:09:23 +00:00
func Enable ( ) * EnableParams {
return & EnableParams { }
}
2017-02-12 04:59:33 +00:00
// Do executes HeapProfiler.enable against the provided context and
// target handler.
func ( p * EnableParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandHeapProfilerEnable , nil , nil )
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
// DisableParams [no description].
2017-01-24 15:09:23 +00:00
type DisableParams struct { }
2017-01-26 07:28:34 +00:00
// Disable [no description].
2017-01-24 15:09:23 +00:00
func Disable ( ) * DisableParams {
return & DisableParams { }
}
2017-02-12 04:59:33 +00:00
// Do executes HeapProfiler.disable against the provided context and
// target handler.
func ( p * DisableParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandHeapProfilerDisable , nil , nil )
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
// StartTrackingHeapObjectsParams [no description].
2017-01-24 15:09:23 +00:00
type StartTrackingHeapObjectsParams struct {
TrackAllocations bool ` json:"trackAllocations,omitempty" `
}
2017-01-26 07:28:34 +00:00
// StartTrackingHeapObjects [no description].
//
2017-01-24 15:09:23 +00:00
// parameters:
func StartTrackingHeapObjects ( ) * StartTrackingHeapObjectsParams {
return & StartTrackingHeapObjectsParams { }
}
2017-01-26 07:28:34 +00:00
// WithTrackAllocations [no description].
2017-01-24 15:09:23 +00:00
func ( p StartTrackingHeapObjectsParams ) WithTrackAllocations ( trackAllocations bool ) * StartTrackingHeapObjectsParams {
p . TrackAllocations = trackAllocations
return & p
}
2017-02-12 04:59:33 +00:00
// Do executes HeapProfiler.startTrackingHeapObjects against the provided context and
// target handler.
func ( p * StartTrackingHeapObjectsParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandHeapProfilerStartTrackingHeapObjects , p , nil )
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
// StopTrackingHeapObjectsParams [no description].
2017-01-24 15:09:23 +00:00
type StopTrackingHeapObjectsParams struct {
ReportProgress bool ` json:"reportProgress,omitempty" ` // If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken when the tracking is stopped.
}
2017-01-26 07:28:34 +00:00
// StopTrackingHeapObjects [no description].
//
2017-01-24 15:09:23 +00:00
// parameters:
func StopTrackingHeapObjects ( ) * StopTrackingHeapObjectsParams {
return & StopTrackingHeapObjectsParams { }
}
// WithReportProgress if true 'reportHeapSnapshotProgress' events will be
// generated while snapshot is being taken when the tracking is stopped.
func ( p StopTrackingHeapObjectsParams ) WithReportProgress ( reportProgress bool ) * StopTrackingHeapObjectsParams {
p . ReportProgress = reportProgress
return & p
}
2017-02-12 04:59:33 +00:00
// Do executes HeapProfiler.stopTrackingHeapObjects against the provided context and
// target handler.
func ( p * StopTrackingHeapObjectsParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandHeapProfilerStopTrackingHeapObjects , p , nil )
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
// TakeHeapSnapshotParams [no description].
2017-01-24 15:09:23 +00:00
type TakeHeapSnapshotParams struct {
ReportProgress bool ` json:"reportProgress,omitempty" ` // If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken.
}
2017-01-26 07:28:34 +00:00
// TakeHeapSnapshot [no description].
//
2017-01-24 15:09:23 +00:00
// parameters:
func TakeHeapSnapshot ( ) * TakeHeapSnapshotParams {
return & TakeHeapSnapshotParams { }
}
// WithReportProgress if true 'reportHeapSnapshotProgress' events will be
// generated while snapshot is being taken.
func ( p TakeHeapSnapshotParams ) WithReportProgress ( reportProgress bool ) * TakeHeapSnapshotParams {
p . ReportProgress = reportProgress
return & p
}
2017-02-12 04:59:33 +00:00
// Do executes HeapProfiler.takeHeapSnapshot against the provided context and
// target handler.
func ( p * TakeHeapSnapshotParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandHeapProfilerTakeHeapSnapshot , p , nil )
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
// CollectGarbageParams [no description].
2017-01-24 15:09:23 +00:00
type CollectGarbageParams struct { }
2017-01-26 07:28:34 +00:00
// CollectGarbage [no description].
2017-01-24 15:09:23 +00:00
func CollectGarbage ( ) * CollectGarbageParams {
return & CollectGarbageParams { }
}
2017-02-12 04:59:33 +00:00
// Do executes HeapProfiler.collectGarbage against the provided context and
// target handler.
func ( p * CollectGarbageParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandHeapProfilerCollectGarbage , nil , nil )
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
// GetObjectByHeapObjectIDParams [no description].
2017-01-24 15:09:23 +00:00
type GetObjectByHeapObjectIDParams struct {
ObjectID HeapSnapshotObjectID ` json:"objectId" `
ObjectGroup string ` json:"objectGroup,omitempty" ` // Symbolic group name that can be used to release multiple objects.
}
2017-01-26 07:28:34 +00:00
// GetObjectByHeapObjectID [no description].
//
2017-01-24 15:09:23 +00:00
// parameters:
2017-01-26 07:28:34 +00:00
// objectID
func GetObjectByHeapObjectID ( objectID HeapSnapshotObjectID ) * GetObjectByHeapObjectIDParams {
2017-01-24 15:09:23 +00:00
return & GetObjectByHeapObjectIDParams {
2017-01-26 07:28:34 +00:00
ObjectID : objectID ,
2017-01-24 15:09:23 +00:00
}
}
// WithObjectGroup symbolic group name that can be used to release multiple
// objects.
func ( p GetObjectByHeapObjectIDParams ) WithObjectGroup ( objectGroup string ) * GetObjectByHeapObjectIDParams {
p . ObjectGroup = objectGroup
return & p
}
// GetObjectByHeapObjectIDReturns return values.
type GetObjectByHeapObjectIDReturns struct {
Result * runtime . RemoteObject ` json:"result,omitempty" ` // Evaluation result.
}
2017-02-12 04:59:33 +00:00
// Do executes HeapProfiler.getObjectByHeapObjectId against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
// result - Evaluation result.
2017-02-12 04:59:33 +00:00
func ( p * GetObjectByHeapObjectIDParams ) Do ( ctxt context . Context , h cdp . Handler ) ( result * runtime . RemoteObject , err error ) {
2017-02-14 08:41:23 +00:00
// execute
var res GetObjectByHeapObjectIDReturns
err = h . Execute ( ctxt , cdp . CommandHeapProfilerGetObjectByHeapObjectID , p , & res )
2017-01-24 15:09:23 +00:00
if err != nil {
return nil , err
}
2017-02-14 08:41:23 +00:00
return res . Result , nil
2017-01-24 15:09:23 +00:00
}
// AddInspectedHeapObjectParams enables console to refer to the node with
// given id via $x (see Command Line API for more details $x functions).
type AddInspectedHeapObjectParams struct {
HeapObjectID HeapSnapshotObjectID ` json:"heapObjectId" ` // Heap snapshot object id to be accessible by means of $x command line API.
}
// AddInspectedHeapObject enables console to refer to the node with given id
// via $x (see Command Line API for more details $x functions).
//
// parameters:
2017-01-26 07:28:34 +00:00
// heapObjectID - Heap snapshot object id to be accessible by means of $x command line API.
func AddInspectedHeapObject ( heapObjectID HeapSnapshotObjectID ) * AddInspectedHeapObjectParams {
2017-01-24 15:09:23 +00:00
return & AddInspectedHeapObjectParams {
2017-01-26 07:28:34 +00:00
HeapObjectID : heapObjectID ,
2017-01-24 15:09:23 +00:00
}
}
2017-02-12 04:59:33 +00:00
// Do executes HeapProfiler.addInspectedHeapObject against the provided context and
// target handler.
func ( p * AddInspectedHeapObjectParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandHeapProfilerAddInspectedHeapObject , p , nil )
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
// GetHeapObjectIDParams [no description].
2017-01-24 15:09:23 +00:00
type GetHeapObjectIDParams struct {
ObjectID runtime . RemoteObjectID ` json:"objectId" ` // Identifier of the object to get heap object id for.
}
2017-01-26 07:28:34 +00:00
// GetHeapObjectID [no description].
//
2017-01-24 15:09:23 +00:00
// parameters:
2017-01-26 07:28:34 +00:00
// objectID - Identifier of the object to get heap object id for.
func GetHeapObjectID ( objectID runtime . RemoteObjectID ) * GetHeapObjectIDParams {
2017-01-24 15:09:23 +00:00
return & GetHeapObjectIDParams {
2017-01-26 07:28:34 +00:00
ObjectID : objectID ,
2017-01-24 15:09:23 +00:00
}
}
// GetHeapObjectIDReturns return values.
type GetHeapObjectIDReturns struct {
HeapSnapshotObjectID HeapSnapshotObjectID ` json:"heapSnapshotObjectId,omitempty" ` // Id of the heap snapshot object corresponding to the passed remote object id.
}
2017-02-12 04:59:33 +00:00
// Do executes HeapProfiler.getHeapObjectId against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
2017-01-26 07:28:34 +00:00
// heapSnapshotObjectID - Id of the heap snapshot object corresponding to the passed remote object id.
2017-02-12 04:59:33 +00:00
func ( p * GetHeapObjectIDParams ) Do ( ctxt context . Context , h cdp . Handler ) ( heapSnapshotObjectID HeapSnapshotObjectID , err error ) {
2017-02-14 08:41:23 +00:00
// execute
var res GetHeapObjectIDReturns
err = h . Execute ( ctxt , cdp . CommandHeapProfilerGetHeapObjectID , p , & res )
2017-01-24 15:09:23 +00:00
if err != nil {
return "" , err
}
2017-02-14 08:41:23 +00:00
return res . HeapSnapshotObjectID , nil
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
// StartSamplingParams [no description].
2017-01-24 15:09:23 +00:00
type StartSamplingParams struct {
SamplingInterval float64 ` json:"samplingInterval,omitempty" ` // Average sample interval in bytes. Poisson distribution is used for the intervals. The default value is 32768 bytes.
}
2017-01-26 07:28:34 +00:00
// StartSampling [no description].
//
2017-01-24 15:09:23 +00:00
// parameters:
func StartSampling ( ) * StartSamplingParams {
return & StartSamplingParams { }
}
// WithSamplingInterval average sample interval in bytes. Poisson
// distribution is used for the intervals. The default value is 32768 bytes.
func ( p StartSamplingParams ) WithSamplingInterval ( samplingInterval float64 ) * StartSamplingParams {
p . SamplingInterval = samplingInterval
return & p
}
2017-02-12 04:59:33 +00:00
// Do executes HeapProfiler.startSampling against the provided context and
// target handler.
func ( p * StartSamplingParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandHeapProfilerStartSampling , p , nil )
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
// StopSamplingParams [no description].
2017-01-24 15:09:23 +00:00
type StopSamplingParams struct { }
2017-01-26 07:28:34 +00:00
// StopSampling [no description].
2017-01-24 15:09:23 +00:00
func StopSampling ( ) * StopSamplingParams {
return & StopSamplingParams { }
}
// StopSamplingReturns return values.
type StopSamplingReturns struct {
Profile * SamplingHeapProfile ` json:"profile,omitempty" ` // Recorded sampling heap profile.
}
2017-02-12 04:59:33 +00:00
// Do executes HeapProfiler.stopSampling against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
// profile - Recorded sampling heap profile.
2017-02-12 04:59:33 +00:00
func ( p * StopSamplingParams ) Do ( ctxt context . Context , h cdp . Handler ) ( profile * SamplingHeapProfile , err error ) {
2017-01-24 15:09:23 +00:00
// execute
2017-02-14 08:41:23 +00:00
var res StopSamplingReturns
err = h . Execute ( ctxt , cdp . CommandHeapProfilerStopSampling , 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 . Profile , nil
2017-01-24 15:09:23 +00:00
}