time

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 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 BootToEpochNS added in v0.22.6

func BootToEpochNS(ns uint64) uint64

BootToEpochNS converts time since boot to the epoch time

func ClockTicksToNsSinceBootTime

func ClockTicksToNsSinceBootTime(ticks uint64) uint64

ClockTicksToNsSinceBootTime converts kernel clock ticks to nanoseconds.

func EpochToBootTimeNS added in v0.22.6

func EpochToBootTimeNS(ns uint64) uint64

EpochToBootTimeNS converts time since epoch to relative time from boot

func GetBootTime

func GetBootTime() time.Time

func GetBootTimeNS

func GetBootTimeNS() int64

GetBootTimeNS returns the boot time of the system in nanoseconds since epoch.

func GetStartTimeNS

func GetStartTimeNS() int64

relative to it.

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 Init added in v0.22.6

func Init(clockID int32) error

Init sets the reference points for (approximate) system and process start time. Run this function ASAP. Not running this function first will cause wrong behaviour in other functions of the package.

Reference points can be set from two differents clocks: CLOCK_MONOTONIC or CLOCK_BOOTTIME. Tracee bpf code tries to use boottime clock if available, otherwise uses monotonic clock. ClockGettime get time elapsed since start (boot) so tracee can calculate event timestamps.

func NsSinceBootTimeToTime

func NsSinceBootTimeToTime(ns uint64) time.Time

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

func NsSinceEpochToTime

func NsSinceEpochToTime(ns uint64) time.Time

Types

This section is empty.

Jump to

Keyboard shortcuts

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