perftrace

package
v1.44.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package perftrace records timings for scripts/perfbench, only when its environment variables ask for it; unset (always, outside a benchmark) every call returns after reading a package variable.

GODWIT_STARTUP_TRACE names a file that gets "<step> <unix ns>" per Mark: when each step of a backend's start ended.

GODWIT_SQL_TRACE names a file that gets one tab-separated line per database call: start and end (unix ns), kind (q, x, t), the Local API call it serves ("" for background work) and the statement's start. Every call waits for the one SQLite connection, so a reader recovers each call's wait from the order of the ends.

Index

Constants

View Source
const (
	StartupEnv = "GODWIT_STARTUP_TRACE"
	SQLEnv     = "GODWIT_SQL_TRACE"
)

The variables that turn the traces on.

Variables

This section is empty.

Functions

func Mark

func Mark(step string)

Mark records that step has just ended. Best effort.

func SQL

func SQL(ctx context.Context, kind, stmt string, start time.Time)

SQL records a database call that began at start and has just ended. A cancelled call is left out: it may never have held the connection, and its end would cut into the holder's run in perfbench's wait split.

func SQLOn

func SQLOn() bool

SQLOn reports whether database calls are traced.

func WithClient

func WithClient(ctx context.Context, client string) context.Context

WithClient tags a connection's ctx with the client name its hello gave. ctx itself when the SQL trace is off.

func WithRPC

func WithRPC(ctx context.Context, method string) context.Context

WithRPC tags ctx with the Local API method it serves, as "client/method#n", numbered so each call's statements group together. ctx itself when the SQL trace is off.

Types

This section is empty.

Jump to

Keyboard shortcuts

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