opa: github.com/open-policy-agent/opa/profiler Index | Files

package profiler

import "github.com/open-policy-agent/opa/profiler"

Package profiler computes and reports on the time spent on expressions.

Index

Package Files

profiler.go

type ExprStats Uses

type ExprStats struct {
    ExprTimeNs int64         `json:"total_time_ns"`
    NumEval    int           `json:"num_eval"`
    NumRedo    int           `json:"num_redo"`
    Location   *ast.Location `json:"location"`
}

ExprStats represents the result of profiling an expression.

type FileReport Uses

type FileReport struct {
    Result []ExprStats `json:"result"`
}

FileReport represents a profiler report for a single file.

type Profiler Uses

type Profiler struct {
    // contains filtered or unexported fields
}

Profiler computes and reports on the time spent on expressions.

func New Uses

func New() *Profiler

New returns a new Profiler object.

func (*Profiler) Config Uses

func (p *Profiler) Config() topdown.TraceConfig

Config returns the standard Tracer configuration for the profiler

func (*Profiler) Enabled Uses

func (p *Profiler) Enabled() bool

Enabled returns true if profiler is enabled.

func (*Profiler) ReportByFile Uses

func (p *Profiler) ReportByFile() (report Report)

ReportByFile returns a profiler report for expressions grouped by the file name. For each file the results are sorted by increasing row number.

func (*Profiler) ReportTopNResults Uses

func (p *Profiler) ReportTopNResults(numResults int, criteria []string) []ExprStats

ReportTopNResults returns the top N results based on the given criteria. If N <= 0, all the results based on the criteria are returned.

func (*Profiler) Trace Uses

func (p *Profiler) Trace(event *topdown.Event)

Trace updates the profiler state.

type Report Uses

type Report struct {
    Files map[string]*FileReport `json:"files"`
}

Report represents the profiler report for a set of files.

Package profiler imports 4 packages (graph) and is imported by 6 packages. Updated 2020-05-21. Refresh now. Tools for package owners.