startuptime

package
v0.4.0-rc.1 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: 5 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 startuptime shares startup milestones between the game loop, asset groups, and development tools.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarkFirstDraw

func MarkFirstDraw()

MarkFirstDraw records the first completed draw callback.

func MarkFirstGroup

func MarkFirstGroup(name string, d time.Duration)

MarkFirstGroup records the load duration of the first assets.Group that finishes loading.

func MarkFirstUpdate

func MarkFirstUpdate()

MarkFirstUpdate records the first completed update callback.

func MarkPlayable

func MarkPlayable()

MarkPlayable records when the game first accepts play.

Types

type Mark

type Mark struct {
	Elapsed  time.Duration
	Recorded bool
}

Mark is the elapsed time to a recorded startup milestone.

On native targets each milestone is measured from Go package initialization. On the web, when the browser exposes performance.timeOrigin and performance.now(), milestones are measured from navigation start so Wasm download and compilation are included, and Snapshot.GoInit records when Go package initialization ran.

type Snapshot

type Snapshot struct {
	// GoInit is the elapsed time from navigation start to Go package
	// initialization. Recorded is false when no navigation origin is available.
	GoInit Mark
	// FirstUpdate is the elapsed time to the first completed game.Loop.Update callback.
	FirstUpdate Mark
	// FirstDraw is the elapsed time to the first completed game.Loop.Draw callback.
	FirstDraw Mark
	// Playable is the elapsed time to the first gamedebug.MarkPlayable call.
	Playable Mark
	// FirstGroup is the load duration of the first assets.Group that completed loading.
	FirstGroup Mark
	// FirstGroupName is the name of the first assets.Group that completed loading.
	FirstGroupName string
}

Snapshot contains the first occurrence of each startup milestone.

func Current

func Current() Snapshot

Current returns the process's recorded startup milestones.

func (Snapshot) Format

func (s Snapshot) Format() string

Format renders the recorded milestones as a single compact summary string, or "" when no milestone has been recorded.

func (Snapshot) HasMarks

func (s Snapshot) HasMarks() bool

HasMarks reports whether at least one startup milestone has been recorded.

Jump to

Keyboard shortcuts

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