Documentation
¶
Index ¶
- Constants
- func FloatAsUint32(val float64) uint32
- func MmapShmpData(fd uintptr) (unsafe.Pointer, error)
- func MmapShmpDataV2(fd uintptr) (unsafe.Pointer, error)
- func StoreFBClockData(fd uintptr, d Data) error
- func StoreFBClockDataV2(fd uintptr, d DataV2) error
- func Uint32AsFloat(val uint32) float64
- func Uint64ToUint32(val uint64) uint32
- type Data
- type DataV2
- type FBClock
- type Shm
- type Stats
- type StatsCollector
- type TrueTime
Constants ¶
const PTPPath = C.FBCLOCK_PTPPATH
PTPPath is the path we set for PTP device
Variables ¶
This section is empty.
Functions ¶
func FloatAsUint32 ¶
FloatAsUint32 stores float as multiplier of 2**16. Effectively this means we can store max 65k like this.
func MmapShmpData ¶
MmapShmpData mmaps open file as fbclock shared memory. Used in tests only.
func MmapShmpDataV2 ¶
MmapShmpDataV2 mmaps open file as fbclock shared memory. Used in tests only.
func StoreFBClockData ¶
StoreFBClockData will store fbclock data in shared mem, fd param should be open file descriptor of that shared mem.
func StoreFBClockDataV2 ¶
StoreFBClockDataV2 will store fbclock data in shared mem, fd param should be open file descriptor of that shared mem.
func Uint32AsFloat ¶
Uint32AsFloat restores float that was stored as a multiplier of 2**16.
func Uint64ToUint32 ¶
Uint64ToUint32 converts uint64 to uint32, handling the overflow. If the uint64 value is more than MaxUint32, result is set to MaxUint32.
Types ¶
type Data ¶
type Data struct {
IngressTimeNS int64
ErrorBoundNS uint64
HoldoverMultiplierNS float64 // float stored as multiplier of 2**16
SmearingStartS uint64 // Smearing starts before the Leap Second Event Time (midnight on June-30 or Dec-31)
SmearingEndS uint64 // Smearing ends after the Leap Second Event Time (midnight on June-30 or Dec-31)
UTCOffsetPreS int32 // UTC Offset before Leap Second Event
UTCOffsetPostS int32 // UTC Offset after Leap Second Event
}
Data is a Go equivalent of what we want to store in shared memory for fbclock to use
type DataV2 ¶
type DataV2 struct {
IngressTimeNS int64
ErrorBoundNS uint64
HoldoverMultiplierNS float64 // float stored as multiplier of 2**16
SmearingStartS uint64 // Smearing starts before the Leap Second Event Time (midnight on June-30 or Dec-31)
UTCOffsetPreS int16 // UTC Offset before Leap Second Event
UTCOffsetPostS int16 // UTC Offset after Leap Second Event
ClockID uint32 // Clock ID of SysclockTimeNS (MONOTONIC_RAW or REALTIME)
PHCTimeNS int64 // Periodically updated PHC time used to calculate real PHC time
SysclockTimeNS int64 // Periodically updated system clock time (MONOTONIC_RAW or REALTIME) received with PHC time
CoefPPB int64 // Coefficient of the approximation of the PHC time
}
DataV2 is a Go equivalent of what we want to store in shared memory for fbclock to use
type FBClock ¶
type FBClock struct {
// contains filtered or unexported fields
}
FBClock wraps around fbclock C lib
func NewFBClockCustom ¶
NewFBClockCustom returns new FBClock wrapper with custom path
func NewFBClockV2 ¶
NewFBClockV2 returns new FBClock wrapper using v2 data structure
func (*FBClock) GetTimeUTC ¶
GetTimeUTC returns TrueTime in UTC
type Shm ¶
Shm is POSIX shared memory
func OpenFBClockSHM ¶
OpenFBClockSHM returns opened POSIX shared mem used by fbclock
func OpenFBClockSHMv2 ¶
OpenFBClockSHMv2 returns opened POSIX shared mem used by fbclock
func OpenFBClockShmCustom ¶
OpenFBClockShmCustom returns opened POSIX shared mem used by fbclock, with custom path and version specified
func OpenFBClockShmCustomVer ¶
OpenFBClockShmCustomVer returns opened POSIX shared mem used by fbclock, with custom path and version specified
type Stats ¶
type Stats struct {
Requests int64
Errors int64
WOUAvg int64
WOUMax int64
WOUlt10us int64
WOUlt100us int64
WOUlt1000us int64
WOUge1000us int64
}
Stats aggregate stats for fbclock GetTime results
type StatsCollector ¶
type StatsCollector struct {
// contains filtered or unexported fields
}
StatsCollector collects stats based on GetTime results
func (*StatsCollector) Update ¶
func (s *StatsCollector) Update(tt *TrueTime, err error)
Update processes result of GetTime call and updates Stats
