stats

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package stats provides functions for measuring different runtime statistics (e.g. time taken to execute, memory being used etc.)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMemoryUsage

func GetMemoryUsage() runtime.MemStats

Get the memory usage stats.

func MeasureElapsedTime

func MeasureElapsedTime(w io.Writer, name string, start time.Time)

Used to time how long a function takes to execute and print to the writer. Example usage: defer stats.MeasureTimeTaken(os.Stdout, "reading entire database and building a cache", time.Now()).

func PrintMemoryUsage

func PrintMemoryUsage(w io.Writer, msg string, m runtime.MemStats)

Print out the memory usage.

func PrintTimeTaken

func PrintTimeTaken(w io.Writer, name string, start time.Time, end time.Time)

Print the elapsed time between two times. Use this version when defer is not possible.

Types

This section is empty.

Jump to

Keyboard shortcuts

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