core

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: MIT Imports: 4 Imported by: 24

Documentation

Overview

Package core contains some generic helper functions for the package github.com/florianl/go-tc. Depending on the actual hardware in use, parameters to filters and qdiscs can vary to achieve the same behaviour.

If PROC_ROOT is set it will be used to lookup packet scheduler information from net/psched.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildHandle

func BuildHandle(maj, min uint32) uint32

BuildHandle is a simple helper function to construct the handle for the Tcmsg struct

func Duration2TcTime added in v0.4.2

func Duration2TcTime(d time.Duration) (uint32, error)

Duration2TcTime implements iproute2/tc/q_netem.c:get_ticks(). It converts a given duration into a time value that can be converted to ticks with Time2Tick(). On error it returns syscall.EINVAL.

func Ktime2Time

func Ktime2Time(ktime uint32) uint32

Ktime2Time implements iproute2/tc/tc_core:tc_core_ktime2time().

func SplitHandle

func SplitHandle(handle uint32) (major, minor uint32)

SplitHandle extracts the major and minor part from a given handle

func Tick2Time

func Tick2Time(tick uint32) uint32

Tick2Time implements iproute2/tc/tc_core:tc_core_tick2time(). It returns a time in usec for a given number of CPU ticks.

func Time2Ktime

func Time2Ktime(time uint32) uint32

Time2Ktime implements iproute2/tc/tc_core:tc_core_time2ktime().

func Time2Tick

func Time2Tick(time uint32) uint32

Time2Tick implements iproute2/tc/tc_core:tc_core_time2tick(). It returns the number of CPU ticks for a given time in usec.

func XmitSize

func XmitSize(rate uint64, ticks uint32) uint32

XmitSize implements iproute2/tc/tc_core:tc_calc_xmitsize(). It returns the size that can be transmitted at a given rate during a given time.

func XmitTime

func XmitTime(rate uint64, size uint32) uint32

XmitTime implements iproute2/tc/tc_core:tc_calc_xmittime(). It returns the time, that is needed to transmit a given size for a given rate.

Types

This section is empty.

Jump to

Keyboard shortcuts

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