2017-01-24 15:09:23 +00:00
|
|
|
// Package profiler provides the Chrome Debugging Protocol
|
2017-02-12 04:59:33 +00:00
|
|
|
// commands, types, and events for the Profiler domain.
|
2017-01-24 15:09:23 +00:00
|
|
|
//
|
|
|
|
// Generated by the chromedp-gen command.
|
|
|
|
package profiler
|
|
|
|
|
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
|
|
|
)
|
|
|
|
|
2017-12-18 00:23:14 +00:00
|
|
|
// DisableParams [no description].
|
|
|
|
type DisableParams struct{}
|
|
|
|
|
|
|
|
// Disable [no description].
|
|
|
|
func Disable() *DisableParams {
|
|
|
|
return &DisableParams{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Do executes Profiler.disable against the provided context and
|
|
|
|
// target handler.
|
|
|
|
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
|
|
|
return h.Execute(ctxt, cdp.CommandProfilerDisable, nil, nil)
|
|
|
|
}
|
|
|
|
|
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 Profiler.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.CommandProfilerEnable, nil, nil)
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
2017-12-18 00:23:14 +00:00
|
|
|
// GetBestEffortCoverageParams collect coverage data for the current isolate.
|
|
|
|
// The coverage data may be incomplete due to garbage collection.
|
|
|
|
type GetBestEffortCoverageParams struct{}
|
2017-01-24 15:09:23 +00:00
|
|
|
|
2017-12-18 00:23:14 +00:00
|
|
|
// GetBestEffortCoverage collect coverage data for the current isolate. The
|
|
|
|
// coverage data may be incomplete due to garbage collection.
|
|
|
|
func GetBestEffortCoverage() *GetBestEffortCoverageParams {
|
|
|
|
return &GetBestEffortCoverageParams{}
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
2017-12-18 00:23:14 +00:00
|
|
|
// GetBestEffortCoverageReturns return values.
|
|
|
|
type GetBestEffortCoverageReturns struct {
|
|
|
|
Result []*ScriptCoverage `json:"result,omitempty"` // Coverage data for the current isolate.
|
|
|
|
}
|
|
|
|
|
|
|
|
// Do executes Profiler.getBestEffortCoverage against the provided context and
|
2017-02-12 04:59:33 +00:00
|
|
|
// target handler.
|
2017-12-18 00:23:14 +00:00
|
|
|
//
|
|
|
|
// returns:
|
|
|
|
// result - Coverage data for the current isolate.
|
|
|
|
func (p *GetBestEffortCoverageParams) Do(ctxt context.Context, h cdp.Handler) (result []*ScriptCoverage, err error) {
|
|
|
|
// execute
|
|
|
|
var res GetBestEffortCoverageReturns
|
|
|
|
err = h.Execute(ctxt, cdp.CommandProfilerGetBestEffortCoverage, nil, &res)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return res.Result, nil
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// SetSamplingIntervalParams changes CPU profiler sampling interval. Must be
|
|
|
|
// called before CPU profiles recording started.
|
|
|
|
type SetSamplingIntervalParams struct {
|
|
|
|
Interval int64 `json:"interval"` // New sampling interval in microseconds.
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetSamplingInterval changes CPU profiler sampling interval. Must be called
|
|
|
|
// before CPU profiles recording started.
|
|
|
|
//
|
|
|
|
// parameters:
|
|
|
|
// interval - New sampling interval in microseconds.
|
|
|
|
func SetSamplingInterval(interval int64) *SetSamplingIntervalParams {
|
|
|
|
return &SetSamplingIntervalParams{
|
|
|
|
Interval: interval,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-12 04:59:33 +00:00
|
|
|
// Do executes Profiler.setSamplingInterval against the provided context and
|
|
|
|
// target handler.
|
|
|
|
func (p *SetSamplingIntervalParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
2017-02-14 08:41:23 +00:00
|
|
|
return h.Execute(ctxt, cdp.CommandProfilerSetSamplingInterval, p, nil)
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
2017-01-26 07:28:34 +00:00
|
|
|
// StartParams [no description].
|
2017-01-24 15:09:23 +00:00
|
|
|
type StartParams struct{}
|
|
|
|
|
2017-01-26 07:28:34 +00:00
|
|
|
// Start [no description].
|
2017-01-24 15:09:23 +00:00
|
|
|
func Start() *StartParams {
|
|
|
|
return &StartParams{}
|
|
|
|
}
|
|
|
|
|
2017-02-12 04:59:33 +00:00
|
|
|
// Do executes Profiler.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.CommandProfilerStart, nil, nil)
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
2017-03-02 01:16:48 +00:00
|
|
|
// StartPreciseCoverageParams enable precise code coverage. Coverage data for
|
|
|
|
// JavaScript executed before enabling precise code coverage may be incomplete.
|
|
|
|
// Enabling prevents running optimized code and resets execution counters.
|
2017-03-24 22:51:18 +00:00
|
|
|
type StartPreciseCoverageParams struct {
|
|
|
|
CallCount bool `json:"callCount,omitempty"` // Collect accurate call counts beyond simple 'covered' or 'not covered'.
|
2017-08-29 02:48:17 +00:00
|
|
|
Detailed bool `json:"detailed,omitempty"` // Collect block-based coverage.
|
2017-03-24 22:51:18 +00:00
|
|
|
}
|
2017-03-02 01:16:48 +00:00
|
|
|
|
|
|
|
// StartPreciseCoverage enable precise code coverage. Coverage data for
|
|
|
|
// JavaScript executed before enabling precise code coverage may be incomplete.
|
|
|
|
// Enabling prevents running optimized code and resets execution counters.
|
2017-03-24 22:51:18 +00:00
|
|
|
//
|
|
|
|
// parameters:
|
2017-03-02 01:16:48 +00:00
|
|
|
func StartPreciseCoverage() *StartPreciseCoverageParams {
|
|
|
|
return &StartPreciseCoverageParams{}
|
|
|
|
}
|
|
|
|
|
2017-03-24 22:51:18 +00:00
|
|
|
// WithCallCount collect accurate call counts beyond simple 'covered' or 'not
|
|
|
|
// covered'.
|
|
|
|
func (p StartPreciseCoverageParams) WithCallCount(callCount bool) *StartPreciseCoverageParams {
|
|
|
|
p.CallCount = callCount
|
|
|
|
return &p
|
|
|
|
}
|
|
|
|
|
2017-08-29 02:48:17 +00:00
|
|
|
// WithDetailed collect block-based coverage.
|
|
|
|
func (p StartPreciseCoverageParams) WithDetailed(detailed bool) *StartPreciseCoverageParams {
|
|
|
|
p.Detailed = detailed
|
|
|
|
return &p
|
|
|
|
}
|
|
|
|
|
2017-03-02 01:16:48 +00:00
|
|
|
// Do executes Profiler.startPreciseCoverage against the provided context and
|
|
|
|
// target handler.
|
|
|
|
func (p *StartPreciseCoverageParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
2017-03-24 22:51:18 +00:00
|
|
|
return h.Execute(ctxt, cdp.CommandProfilerStartPreciseCoverage, p, nil)
|
2017-03-02 01:16:48 +00:00
|
|
|
}
|
|
|
|
|
2017-12-18 00:23:14 +00:00
|
|
|
// StartTypeProfileParams enable type profile.
|
|
|
|
type StartTypeProfileParams struct{}
|
|
|
|
|
|
|
|
// StartTypeProfile enable type profile.
|
|
|
|
func StartTypeProfile() *StartTypeProfileParams {
|
|
|
|
return &StartTypeProfileParams{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Do executes Profiler.startTypeProfile against the provided context and
|
|
|
|
// target handler.
|
|
|
|
func (p *StartTypeProfileParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
|
|
|
return h.Execute(ctxt, cdp.CommandProfilerStartTypeProfile, nil, nil)
|
|
|
|
}
|
|
|
|
|
|
|
|
// StopParams [no description].
|
|
|
|
type StopParams struct{}
|
|
|
|
|
|
|
|
// Stop [no description].
|
|
|
|
func Stop() *StopParams {
|
|
|
|
return &StopParams{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// StopReturns return values.
|
|
|
|
type StopReturns struct {
|
|
|
|
Profile *Profile `json:"profile,omitempty"` // Recorded profile.
|
|
|
|
}
|
|
|
|
|
|
|
|
// Do executes Profiler.stop against the provided context and
|
|
|
|
// target handler.
|
|
|
|
//
|
|
|
|
// returns:
|
|
|
|
// profile - Recorded profile.
|
|
|
|
func (p *StopParams) Do(ctxt context.Context, h cdp.Handler) (profile *Profile, err error) {
|
|
|
|
// execute
|
|
|
|
var res StopReturns
|
|
|
|
err = h.Execute(ctxt, cdp.CommandProfilerStop, nil, &res)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return res.Profile, nil
|
|
|
|
}
|
|
|
|
|
2017-03-02 01:16:48 +00:00
|
|
|
// StopPreciseCoverageParams disable precise code coverage. Disabling
|
|
|
|
// releases unnecessary execution count records and allows executing optimized
|
|
|
|
// code.
|
|
|
|
type StopPreciseCoverageParams struct{}
|
|
|
|
|
|
|
|
// StopPreciseCoverage disable precise code coverage. Disabling releases
|
|
|
|
// unnecessary execution count records and allows executing optimized code.
|
|
|
|
func StopPreciseCoverage() *StopPreciseCoverageParams {
|
|
|
|
return &StopPreciseCoverageParams{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Do executes Profiler.stopPreciseCoverage against the provided context and
|
|
|
|
// target handler.
|
|
|
|
func (p *StopPreciseCoverageParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
|
|
|
return h.Execute(ctxt, cdp.CommandProfilerStopPreciseCoverage, nil, nil)
|
|
|
|
}
|
|
|
|
|
2017-12-18 00:23:14 +00:00
|
|
|
// StopTypeProfileParams disable type profile. Disabling releases type
|
|
|
|
// profile data collected so far.
|
|
|
|
type StopTypeProfileParams struct{}
|
|
|
|
|
|
|
|
// StopTypeProfile disable type profile. Disabling releases type profile data
|
|
|
|
// collected so far.
|
|
|
|
func StopTypeProfile() *StopTypeProfileParams {
|
|
|
|
return &StopTypeProfileParams{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Do executes Profiler.stopTypeProfile against the provided context and
|
|
|
|
// target handler.
|
|
|
|
func (p *StopTypeProfileParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
|
|
|
return h.Execute(ctxt, cdp.CommandProfilerStopTypeProfile, nil, nil)
|
|
|
|
}
|
|
|
|
|
2017-03-02 01:16:48 +00:00
|
|
|
// TakePreciseCoverageParams collect coverage data for the current isolate,
|
|
|
|
// and resets execution counters. Precise code coverage needs to have started.
|
|
|
|
type TakePreciseCoverageParams struct{}
|
|
|
|
|
|
|
|
// TakePreciseCoverage collect coverage data for the current isolate, and
|
|
|
|
// resets execution counters. Precise code coverage needs to have started.
|
|
|
|
func TakePreciseCoverage() *TakePreciseCoverageParams {
|
|
|
|
return &TakePreciseCoverageParams{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// TakePreciseCoverageReturns return values.
|
|
|
|
type TakePreciseCoverageReturns struct {
|
|
|
|
Result []*ScriptCoverage `json:"result,omitempty"` // Coverage data for the current isolate.
|
|
|
|
}
|
|
|
|
|
|
|
|
// Do executes Profiler.takePreciseCoverage against the provided context and
|
|
|
|
// target handler.
|
|
|
|
//
|
|
|
|
// returns:
|
|
|
|
// result - Coverage data for the current isolate.
|
|
|
|
func (p *TakePreciseCoverageParams) Do(ctxt context.Context, h cdp.Handler) (result []*ScriptCoverage, err error) {
|
|
|
|
// execute
|
|
|
|
var res TakePreciseCoverageReturns
|
|
|
|
err = h.Execute(ctxt, cdp.CommandProfilerTakePreciseCoverage, nil, &res)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return res.Result, nil
|
|
|
|
}
|
|
|
|
|
2017-09-15 23:52:13 +00:00
|
|
|
// TakeTypeProfileParams collect type profile.
|
|
|
|
type TakeTypeProfileParams struct{}
|
|
|
|
|
|
|
|
// TakeTypeProfile collect type profile.
|
|
|
|
func TakeTypeProfile() *TakeTypeProfileParams {
|
|
|
|
return &TakeTypeProfileParams{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// TakeTypeProfileReturns return values.
|
|
|
|
type TakeTypeProfileReturns struct {
|
|
|
|
Result []*ScriptTypeProfile `json:"result,omitempty"` // Type profile for all scripts since startTypeProfile() was turned on.
|
|
|
|
}
|
|
|
|
|
|
|
|
// Do executes Profiler.takeTypeProfile against the provided context and
|
|
|
|
// target handler.
|
|
|
|
//
|
|
|
|
// returns:
|
|
|
|
// result - Type profile for all scripts since startTypeProfile() was turned on.
|
|
|
|
func (p *TakeTypeProfileParams) Do(ctxt context.Context, h cdp.Handler) (result []*ScriptTypeProfile, err error) {
|
|
|
|
// execute
|
|
|
|
var res TakeTypeProfileReturns
|
|
|
|
err = h.Execute(ctxt, cdp.CommandProfilerTakeTypeProfile, nil, &res)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return res.Result, nil
|
|
|
|
}
|