time

package
v0.22.5 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CLOCK_MONOTONIC = unix.CLOCK_MONOTONIC // Time since a boot (not including time spent in suspend)
	CLOCK_BOOTTIME  = unix.CLOCK_BOOTTIME  // Time since a boot (including time spent in suspend)
)

Common clock IDs

Variables

This section is empty.

Functions

func ClockTicksToNsSinceBootTime

func ClockTicksToNsSinceBootTime(ticks int64) uint64

ClockTicksToNsSinceBootTime converts kernel clock ticks to nanoseconds.

func GetBootTime

func GetBootTime(clockID int32) time.Time

func GetBootTimeNS

func GetBootTimeNS(clockID int32) int64

GetBootTimeNS returns the boot time of the system in nanoseconds.

func GetStartTimeNS

func GetStartTimeNS(clockID int32) int64

GetStartTimeNS returns the elapsed time since system start in nanoseconds. Possible to retrieve from two differents clocks: CLOCK_MONOTONIC or CLOCK_BOOTTIME.

func GetSystemHZ

func GetSystemHZ() int

GetSystemHZ returns an approximation of CONFIG_HZ (the kernel timer interrupt).

func GetUserHZ

func GetUserHZ() int64

GetUserHZ returns USER_HZ (the user-space timer interrupt), the system clock tick rate.

func NsSinceBootTimeToTime

func NsSinceBootTimeToTime(clockID int32, ns uint64) time.Time

NsSinceBootTimeToTime converts nanoseconds timestamp (since boot) to a time.Time object.

func NsSinceEpochToTime

func NsSinceEpochToTime(ns uint64) time.Time

Types

type AbsoluteTimeNormalizer

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

AbsoluteTimeNormalizer normalize the time to be absolute time since epoch

func NewAbsoluteTimeNormalizer

func NewAbsoluteTimeNormalizer(bootTime int) *AbsoluteTimeNormalizer

func (*AbsoluteTimeNormalizer) GetOriginalTime

func (rn *AbsoluteTimeNormalizer) GetOriginalTime(timeNs int) int

func (*AbsoluteTimeNormalizer) NormalizeTime

func (rn *AbsoluteTimeNormalizer) NormalizeTime(timeNs int) int

type RelativeTimeNormalizer

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

RelativeTimeNormalizer normalize the time to be relative to Tracee start time

func NewRelativeTimeNormalizer

func NewRelativeTimeNormalizer(startTime int) *RelativeTimeNormalizer

func (*RelativeTimeNormalizer) GetOriginalTime

func (rn *RelativeTimeNormalizer) GetOriginalTime(timeNs int) int

func (*RelativeTimeNormalizer) NormalizeTime

func (rn *RelativeTimeNormalizer) NormalizeTime(timeNs int) int

type TimeNormalizer

type TimeNormalizer interface {
	NormalizeTime(timeNs int) int
	GetOriginalTime(timeNs int) int
}

TimeNormalizer normalizes the time to be relative to tracee start time or current time in nanoseconds.

func CreateTimeNormalizerByConfig

func CreateTimeNormalizerByConfig(relative bool, startTime uint64, bootTime uint64) TimeNormalizer

CreateTimeNormalizerByConfig create a TimeNormalizer according to given configuration using runtime functions.

Jump to

Keyboard shortcuts

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