71 lines
1.9 KiB
Go
71 lines
1.9 KiB
Go
|
// Package performance provides the Chrome Debugging Protocol
|
||
|
// commands, types, and events for the Performance domain.
|
||
|
//
|
||
|
// Generated by the chromedp-gen command.
|
||
|
package performance
|
||
|
|
||
|
// Code generated by chromedp-gen. DO NOT EDIT.
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
|
||
|
cdp "github.com/knq/chromedp/cdp"
|
||
|
)
|
||
|
|
||
|
// EnableParams enable collecting and reporting metrics.
|
||
|
type EnableParams struct{}
|
||
|
|
||
|
// Enable enable collecting and reporting metrics.
|
||
|
func Enable() *EnableParams {
|
||
|
return &EnableParams{}
|
||
|
}
|
||
|
|
||
|
// Do executes Performance.enable against the provided context and
|
||
|
// target handler.
|
||
|
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
||
|
return h.Execute(ctxt, cdp.CommandPerformanceEnable, nil, nil)
|
||
|
}
|
||
|
|
||
|
// DisableParams disable collecting and reporting metrics.
|
||
|
type DisableParams struct{}
|
||
|
|
||
|
// Disable disable collecting and reporting metrics.
|
||
|
func Disable() *DisableParams {
|
||
|
return &DisableParams{}
|
||
|
}
|
||
|
|
||
|
// Do executes Performance.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.CommandPerformanceDisable, nil, nil)
|
||
|
}
|
||
|
|
||
|
// GetMetricsParams retrieve current values of run-time metrics.
|
||
|
type GetMetricsParams struct{}
|
||
|
|
||
|
// GetMetrics retrieve current values of run-time metrics.
|
||
|
func GetMetrics() *GetMetricsParams {
|
||
|
return &GetMetricsParams{}
|
||
|
}
|
||
|
|
||
|
// GetMetricsReturns return values.
|
||
|
type GetMetricsReturns struct {
|
||
|
Metrics []*Metric `json:"metrics,omitempty"` // Current values for run-time metrics.
|
||
|
}
|
||
|
|
||
|
// Do executes Performance.getMetrics against the provided context and
|
||
|
// target handler.
|
||
|
//
|
||
|
// returns:
|
||
|
// metrics - Current values for run-time metrics.
|
||
|
func (p *GetMetricsParams) Do(ctxt context.Context, h cdp.Handler) (metrics []*Metric, err error) {
|
||
|
// execute
|
||
|
var res GetMetricsReturns
|
||
|
err = h.Execute(ctxt, cdp.CommandPerformanceGetMetrics, nil, &res)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return res.Metrics, nil
|
||
|
}
|