timing

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: Apache-2.0 Imports: 4 Imported by: 21

README

timing

timing provides simple timing utilities and instrumentation helpers.

It’s used across the codebase to log durations (typically via logHandler.TimingLogger).

Stopwatch

  • Start(domain, activity, notes string) Stopwatch
  • (*Stopwatch).Stop(count int)

Typical usage:

import "github.com/mt1976/frantic-core/timing"

func doWork() {
    sw := timing.Start("users", "load", "")
    // ... work ...
    sw.Stop(1)
}

Snooze helpers

  • SnoozeFor(noSeconds int)
  • Snooze() (random 0..10 seconds)

Documentation

Overview

Package timing provides simple timing utilities and instrumentation helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Snooze

func Snooze()

Snooze snoozes for a random period The Snooze function generates a random number between 0 and 10 and then calls the snooze function

func SnoozeFor

func SnoozeFor(noSeconds int)

SnoozeFor snoozes the application for a given amount of time The function SnoozeFor takes in a polling interval and calls the snooze function with that interval.

Types

type Stopwatch

type Stopwatch struct {
	// contains filtered or unexported fields
}

func Start

func Start(domain, activity, notes string) Stopwatch

func (*Stopwatch) Stop

func (w *Stopwatch) Stop(count int)

Jump to

Keyboard shortcuts

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