profile

package
v0.38.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package profile turns what a vm.Profiler collected into reports (TODO.md Q78): a text report of the functions and lines that took the time, for kukel profile and the Go API.

Index

Constants

View Source
const (
	MaxFunctions = 40
	MaxLines     = 20
)

MaxFunctions and MaxLines bound the rows of the report's tables.

Variables

This section is empty.

Functions

func Pprof

func Pprof(w io.Writer, p *vm.Profiler) error

Pprof writes what p collected in Go's pprof format (gzipped protocol buffers), for go tool pprof: a function per Kukel function (with its file and first line, so that pprof can show the source), a location per line of it, and per sample the number of samples and the time (wall or cpu, in nanoseconds). Each sample has the label "interpreter" ("main", "worker 1: f"); with workers, each stack starts with a frame named after its interpreter, so that a flame graph shows them apart.

func Report

func Report(w io.Writer, p *vm.Profiler, src Source) error

Report writes the text report of what p collected: the functions by their own time (and their total time, with the functions they call, and their calls), the slowest lines with their source, and the calls of built-ins and Go functions. src gives the source lines (nil: Files()).

Types

type Source added in v0.33.0

type Source func(fn *bytecode.Function, line int) (text, program string)

Source gives the text of a line of fn's file, and names the program fn is of ("" when there is only one, or it is not known): the interpreter that runs it.

func Files added in v0.33.0

func Files() Source

Files is the Source that reads the files (once each).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL