explorer

package
v0.0.0-...-668de4a Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2020 License: BSD-2-Clause Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LogLevel int
)

Functions

func CalcCoverageScore

func CalcCoverageScore(coverage *CovStats, obj Objective) float64

CalcCoverageScore calculates the coverage score for the coverage of 1 single node for a given objective

func CalcFullCoverageScore

func CalcFullCoverageScore(allCoverage map[int]*CovStats, obj Objective) float64

CalcFullCoverageScore calculates the total coverage across all nodes Currently, 3 objective functions are supported. UNIQUE: Score is calculated as total number of unique blocks covered across all nodes (Union-Count) FREQUENCY: Score is calculated as \Sum_{b \in Blocks} \frac{1}{frequency(b)}. Higher score will be for coverage

where all the blocks covered have fewer duplicate blocks

NODE_FREQUENCY: Score is calculated as \Sum_{b \in Blocks} \frac{1}{frequency(b)} * NodeCount(b). Higher score will

be for coverage where more nodes cover a lot of unique blocks without any duplication

func CoverageUnion

func CoverageUnion(cov1, cov2 *CovStats)

CoverageUnion merges the coverage information from cov2 into cov1 cov1 is modified as part of the execution of this function

func GetCoverageEstimate

func GetCoverageEstimate(allCoverage map[int]*CovStats, newCoverage *CovStats, procID int, obj Objective) float64

Types

type Action

type Action struct {
	Type ActionType
	Arg  interface{}
}

Action represents an action that can be scheduled by the system

func (*Action) String

func (a *Action) String() string

type ActionType

type ActionType int

ActionType represents the various actions that can be taken by the explorer

const (
	RESTART ActionType = iota
	SCHEDULE
	TIMER
)

Possible Actions

type BlockInfo

type BlockInfo struct {
	NumNodes  int
	Frequency uint64
}

BlockInfo represents the information necessary for calculating the coverage score for the block. Currently, it has 2 fields: (i) NumNodes : Number of nodes that covered this block (ii) Frequency : Total number of times this block was covered

type CovStats

type CovStats map[string]uint64

CovStats represents the coverage information captured during runtime. It is essentially a pseudonym for a map[string]uint64 Each key is a unique BlockID and value is the # of times the block was reached.

func CoverageDifference

func CoverageDifference(cov1, cov2 *CovStats) *CovStats

CoverageDifference returns the set difference between cov1 and cov2. For input coverage A, B the output is the set difference A - B.

type Explorer

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

Explorer is the exploration unit that performs the exploration

func MountExplorer

func MountExplorer(logFilePath string, explorationStrategy Strategy, seed *dara.Schedule, numProcs int, level int) (*Explorer, error)

MountExplorer initializes an explorer

func (*Explorer) BuildActionStats

func (e *Explorer) BuildActionStats()

BuildActionStats builds the action history from the seed schedule. This is important as it prevents

func (*Explorer) GetNextAction

func (e *Explorer) GetNextAction(threads *[]ProcThread, events *[]dara.Event, coverage *CovStats, clocks *map[int]*VirtualClock, isblocked map[int]bool) Action

GetNextAction gets the next action to be executed threads: List of all goroutines in the system events: Events that were executed by the last action coverage: Coverage statistics of the last action clocks: Virtual Clocks of all the processes allCoverage: Total Coverage across all nodes across all runs

func (*Explorer) GetNextProcess

func (e *Explorer) GetNextProcess(numProcs int) int

GetNextProcess returns the next process to be scheduled based on the selected strategy

func (*Explorer) GetNextThread

func (e *Explorer) GetNextThread(nextPossibleThreads *[]ProcThread, events *[]dara.Event, coverage *CovStats) *ProcThread

GetNextThread returns the next goroutine to be scheduled based on the previously selected strategy

func (*Explorer) GetNextTimer

func (e *Explorer) GetNextTimer(clock *VirtualClock, ProcID int) *ProcTimer

func (*Explorer) PrintCurrentCoverage

func (e *Explorer) PrintCurrentCoverage()

func (*Explorer) RestartExploration

func (e *Explorer) RestartExploration()

RestartExploration restarts the exploration from scratch Explorer essentially resets its state.

func (*Explorer) SaveStateSpaceResults

func (e *Explorer) SaveStateSpaceResults(filename string) error

func (*Explorer) SaveVisitedSchedules

func (e *Explorer) SaveVisitedSchedules() error

SaveVisitedSchedules saves the already seen schedules in a log file This is to persist state of the explorer across multiple invocations Currently not enabled. TODO: Make saving/using of old run files an option.

func (*Explorer) SetMaxDepth

func (e *Explorer) SetMaxDepth(depth int)

SetMaxDepth sets the maximum depth for Depth-Based Exploration

func (*Explorer) UpdateActionCoverage

func (e *Explorer) UpdateActionCoverage(events *[]dara.Event, coverage *CovStats)

func (*Explorer) UpdateCurrentActionStats

func (e *Explorer) UpdateCurrentActionStats(events *[]dara.Event, coverage *CovStats)

UpdateCurrentActionStats merge the statistics for coverage for all the actions

type Objective

type Objective int

Objective is the type that encapsulates the type of scoring function that needs to be applied

const (
	UNIQUE Objective = iota
	FREQUENCY
	NODE_FREQUENCY
)

type ProcThread

type ProcThread struct {
	ProcID int
	Thread dara.RoutineInfo
}

ProcThread represents a unique goroutine in the system The uniqueness is given by a combination of the ProcessID and Goroutine ID

func (*ProcThread) GetStatus

func (p *ProcThread) GetStatus() dara.DaraProcStatus

GetStatus returns the status of the specific goroutine

func (*ProcThread) String

func (p *ProcThread) String() string

String returns a unique string representation for a goroutine in the distributed system The unique string is "P" + DaraProcessID + "T" + goroutineID + "H" + hex_representation of Gpc

type ProcTimer

type ProcTimer struct {
	ProcID int
	ID     int64
}

ProcTimer represents a unique timer in the system The unique ness is given by a combination of the ProcessID and Timer ID

func (*ProcTimer) String

func (p *ProcTimer) String() string

String returns a unique representation for a goroutine in the distributed system The unique string is "P" + DaraProcessID + "Ti" + timerID

type State

type State string

State represents a unique state in the system

type Strategy

type Strategy int

Strategy represents the exploration strategy currently deployed

const (
	// RANDOM strategy does random exploration
	RANDOM Strategy = iota
	COVERAGE_UNIQUE
	COVERAGE_FREQUENCY
	COVERAGE_NODE_FREQUENCY
)

Possible enum values for Strategy

type TimeEvent

type TimeEvent struct {
	Type        TimeEventType
	When        uint64 // When do we need to perform the time related action
	Period      uint64 // if it is a periodic event then it must be fired, well, periodically.
	GoRoutineID int64  // if it is a sleeping event, we need to know which goroutine to wake up!
	TimerID     int64  // Need to know which timer to fire off
}

type TimeEventType

type TimeEventType int
const (
	Sleep TimeEventType = iota
	Timer
)

type VirtualClock

type VirtualClock struct {
	CurrentTick uint64
	WaitingQ    map[int]*TimeEvent // The queues are mainly arrays
	ReadyQ      []*TimeEvent
	// contains filtered or unexported fields
}

func NewClock

func NewClock() *VirtualClock

func (*VirtualClock) AddTimerEvent

func (v *VirtualClock) AddTimerEvent(eventID int, eventType TimeEventType, when uint64, period uint64, gid int64, timerID int64)

func (*VirtualClock) GetNextEvent

func (v *VirtualClock) GetNextEvent() *TimeEvent

func (*VirtualClock) IsSleeping

func (v *VirtualClock) IsSleeping(gid int) bool

func (*VirtualClock) SetTick

func (v *VirtualClock) SetTick(amount uint64)

func (*VirtualClock) Tick

func (v *VirtualClock) Tick(amount uint64)

Jump to

Keyboard shortcuts

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