Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnableTaskMap ¶
func EnableTaskMap()
EnableTaskMap sets up tracking of calls to LockOSThread for the purpose of understanding the timing between the Threads with the TaskTiming function. Call this before calling LockOSThread or TaskTiming will be missing information.
Types ¶
type DurationStat ¶
type DurationStat struct { Last time.Duration Min time.Duration Max time.Duration Average time.Duration Total time.Duration // Used for calculating Average Count int // Used for calculating Average }
DurationStat holds various useful stats about a duration measurement
type Task ¶
type Task struct { Name string // Name of thread when supported. CPU []int // CPU affinity, empty to allow all CPUs Period time.Duration Runtime time.Duration Deadline time.Duration }
A Task represents the configuration for an os thread.
type TaskTimingElem ¶
type TaskTimingElem struct { Name string Runtime time.Duration Deadline time.Duration PercentPeriod float64 Affinity []int }
TaskTimingElem contains the timing information for a single Thread.
type TaskTimingInformation ¶
type TaskTimingInformation map[TaskTimingInformationKey]TaskTimingInformationValue
TaskTimingInformation contains a list of all registered tasks and their properties
func TaskTiming ¶
func TaskTiming() TaskTimingInformation
TaskTiming will return timing information for the Threads created after calling EnableTaskMap.
func (TaskTimingInformation) EncodeToString ¶
func (t TaskTimingInformation) EncodeToString() string
EncodeToString will create an ASCII art plot of a TaskTimingInformation
type TaskTimingInformationKey ¶
TaskTimingInformationKey is the key for the TaskTimingInformation map containing the properties that, combined, make sense to maintain a seperate TaskTimingInformationValue.
type TaskTimingInformationValue ¶
type TaskTimingInformationValue []TaskTimingElem
TaskTimingInformationValue contains the timing information for Threads created after calling EnableTaskMap.
type Thread ¶
type Thread interface { // Yield should be called when you're done requiring CPU time this period. Otherwise, if the // os thread blocks and resumes before its deadline hits, it will continue. If it tries to // resume after its deadline, it will have a low priority. The best way to ensure the os // thread resumes correctly is to call Yield. Yield() error // Returns the name passed to LockOSThread Name() string EnableStats(bool) bool Stats() *ThreadStats }
A Thread represents an existing os thread as created by this package's LockOSThread.
func LockOSThread ¶
LockOSThread calls runtime.LockOSThread, then calls OS specific functions to set the thread name and setup realtime scheduling. This will use SCHED_DEADLINE on linux. Goroutines that call this can launch other goroutines, but the new ones will not have the same prorities and will not be locked to an os thread.
type ThreadStats ¶
type ThreadStats struct { LastYieldTime time.Time LastYieldWakeTime time.Time NextExpectedWakeTime time.Time `;not handled` RunTime DurationStat YieldTime DurationStat MeasuredPeriod DurationStat YieldCount int DeadlineMissCount int `;not handled` MissedLastDeadline bool `;not handled` }
ThreadStats contains statistics about a Thread.