Files
releases/profiler/profiler.go
T
Johan Fylling a179a24c48 v1 API
All packages, except for `cmd` and `internal`, have been moved into a new `v1` root package.

Old packages are kept for backwards-compatibility reasons. All contained code is replaced with simple type aliases and proxy functions to `v1` implementations.

Old packages default to the Rego v0 syntax, new `v1` packages default to the Rego v1 syntax.

Signed-off-by: Johan Fylling <johan.dev@fylling.se>
2024-12-12 15:27:34 +01:00

36 lines
1.0 KiB
Go

// Copyright 2018 The OPA Authors. All rights reserved.
// Use of this source code is governed by an Apache2
// license that can be found in the LICENSE file.
// Package profiler computes and reports on the time spent on expressions.
package profiler
import (
v1 "github.com/open-policy-agent/opa/v1/profiler"
)
// Profiler computes and reports on the time spent on expressions.
type Profiler = v1.Profiler
// New returns a new Profiler object.
func New() *Profiler {
return v1.New()
}
// ExprStats represents the result of profiling an expression.
type ExprStats = v1.ExprStats
// ExprStatsAggregated represents the result of profiling an expression
// by aggregating `n` profiles.
type ExprStatsAggregated = v1.ExprStatsAggregated
func AggregateProfiles(profiles ...[]ExprStats) []ExprStatsAggregated {
return v1.AggregateProfiles(profiles...)
}
// Report represents the profiler report for a set of files.
type Report = v1.Report
// FileReport represents a profiler report for a single file.
type FileReport = v1.FileReport