timestamp

package
v0.0.0-...-4cb4cf9 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompleteTiming

func CompleteTiming() (err error)

Marks the end of collecting timing data. Perform any cleanup needed by the timestamp manager object

func FlushAndCleanUpResources

func FlushAndCleanUpResources()

Close the event queue, wait for the processor to finish and flush the remaining buffered data to disk

func ResumeTiming

func ResumeTiming(toolName, outputFile string) error

Begins appending timing data for a high level component 'toolName' into the file at 'outputFile'

Types

type EventType

type EventType int
const (
	EventStart EventType = iota
	EventStop
	EventPause
	EventResume
)

Types of event for a timestamped step. E.g start, stop

type TimeStamp

type TimeStamp struct {
	ID             int64      `json:"ID"`             // Unique ID for timestamp object
	Name           string     `json:"Name"`           // Name of the step
	StartTime      *time.Time `json:"StartTime"`      // Start time of the step
	EndTime        *time.Time `json:"EndTime"`        // End time of the step
	ElapsedSeconds float64    `json:"ElapsedSeconds"` // Total elapsed time in seconds
	ParentID       int64      `json:"ParentID"`       // ID of the parent step
	// contains filtered or unexported fields
}

func BeginTiming

func BeginTiming(toolName, outputFile string) (*TimeStamp, error)

Begins collecting timing data for a high level component 'toolName' into the file at 'outputFile'

func PauseEvent

func PauseEvent(ts *TimeStamp) (*TimeStamp, error)

Pause a step

func ResumeEvent

func ResumeEvent(ts *TimeStamp) (*TimeStamp, error)

Resume a step

func StartEvent

func StartEvent(name string, parentTS *TimeStamp) (ts *TimeStamp, err error)

Add an event that marks the start of a timestamped step, if parentTS is nil, use lastVisited as parentTS

func StartEventByPath

func StartEventByPath(path string) (ts *TimeStamp, err error)

Add an event that marks the start of a timestamped step using full name

func StopEvent

func StopEvent(ts *TimeStamp) (*TimeStamp, error)

Add an event that marks the end of a timestamped step, if ts is nil, use lastVisited as ts

func StopEventByPath

func StopEventByPath(path string) (ts *TimeStamp, err error)

Add an event that marks the end of a timestamped step using full name

func (*TimeStamp) DisplayName

func (ts *TimeStamp) DisplayName() string

Returns full name of the step starting from the root, i.e A/B/C

func (*TimeStamp) ElapsedTime

func (ts *TimeStamp) ElapsedTime() time.Duration

Calculates the elapsed time of a step, returns -1 if the end time is not yet available

type TimeStampManager

type TimeStampManager struct {
	EventQueue chan *TimeStampRecord // events to be processed and recorded to file

	TimeStampWriteManager // interface to handle all file writing
	TimeStampReadManager  // interface to handle all in-memory structures
	// contains filtered or unexported fields
}

The TimeStampManager provides the main interface for actions taken on timestamp objects.

type TimeStampReadManager

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

The read manager is responsible for holding an in-memory data structure for the timestamps, starting from the root node. Read manager provides interface for querying the current state of the timestamps.

type TimeStampRecord

type TimeStampRecord struct {
	EventType EventType `json:"EventType"`
	*TimeStamp
	// contains filtered or unexported fields
}

Represents an event during recording of a timestamped step

type TimeStampWriteManager

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

The write manager is responsible for holding a write buffer and flushing it to file periodically. It is supposed to be running in a separate goroutine so the main build process performance is not affected.

Jump to

Keyboard shortcuts

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