evaluate

package
v0.0.0-...-82acd0e Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2021 License: BSD-3-Clause Imports: 22 Imported by: 1

Documentation

Overview

Implements Experiments and their methods

detectors

Main file for evaluation

Implements Experiments and their methods

Implements Experiments and their methods

detectors

Generates tables and reports

Utility functions for package evaluate

Index

Constants

View Source
const (
	BUILTINDL = iota
	GOLEAK
	LOCKDL
	GOAT_M
	GOAT_U
	GOAT_D1
	GOAT_D2
	GOAT_D3
	TOOL_COUNT
)
View Source
const (
	ORDER_BUG = iota
	ORDER_CAUSE
	ORDER_SUBCAUSE
)
View Source
const CPU = 0
View Source
const EVENT_BOUND = 200000000
View Source
const GOVER_GOAT = "/home/saeed/go-builds/go-goat-1.15.6"
View Source
const GOVER_ORIG = "/home/saeed/go-builds/go-orig-1.15.6"
View Source
const RESDIR = "/home/saeed/goatws/results"
View Source
const TERMINATION = "hitBug"
View Source
const TO = 30 // second
View Source
const WORKDIR = ""

Variables

This section is empty.

Functions

func CoverageSummary

func CoverageSummary(ex Ex) []interface{}

func CoverageSummaryPerExp

func CoverageSummaryPerExp(ex Ex)

func EvaluateComparison

func EvaluateComparison(configFile string, thresh int)

func EvaluateCoverage

func EvaluateCoverage(configFile string, thresh int, isRace bool)

func EvaluateNonBlocking

func EvaluateNonBlocking(configFile string, thresh int)

func EvaluateOverhead

func EvaluateOverhead(configFile string, thresh int, ns []int)

func EvaluateSingle

func EvaluateSingle(path string, freq, d int, isRace bool)

func MeasureTime

func MeasureTime(fn func()) (et time.Duration)

func PrintGGTree

func PrintGGTree(root *GGTree, concUsage []*instrument.ConcurrencyUsage)

func ReadConcUsage

func ReadConcUsage(fname string) (ret []*instrument.ConcurrencyUsage)

Read concUsage

func ReadGoKerConfig

func ReadGoKerConfig(bugtype string) map[string][]string

Read GoKer config JSON file

func ReadLines

func ReadLines(f string) (lines []string)

func ReadResults

func ReadResults(fname string) map[string]Ex

Read experiment results JSON file

func TableSummaryPerBug

func TableSummaryPerBug(rx *RootExperiment)

func Table_Bug_Coverage

func Table_Bug_Coverage(bugs map[string]*RootExperiment, tool string, thresh int, coverage1 bool)

func Table_Bug_Tool

func Table_Bug_Tool(bugs map[string]*RootExperiment, order int, identifier string)

Types

type Bug

type Bug struct {
	BugName     string `json:"bugName"`     // Name
	BugDir      string `json:"bugDir"`      // Dir
	BugType     string `json:"bugType"`     // Blocking - Nonblocking - overhead
	BugCause    string `json:"bugCause"`    // Majore Cause
	BugSubCause string `json:"bugSubcause"` // Sub-cause
}

Struct for Bugs

type ConcUsageStruct

type ConcUsageStruct struct {
	ConcUsage           []*instrument.ConcurrencyUsage `json:"concUsage"`
	ConcUsageMap        map[string]int                 // key: cu.string, val:  cu index
	ConcUsageStackMap   map[string][]int               // key: fkey for cu, val: []cu index (there might be multiple concurrent usage that shares a common stack frame)
	ConcUsageStackFekys []string                       // list of all fkeys
	ConcUsageReport     map[int]map[string]int         // how each concusage is covered (post-execution)

}

type Count

type Count struct {
	G          int
	Ch         int
	TotalChOps int
}

type Coverage

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

func (*Coverage) ToMap

func (cov *Coverage) ToMap(cu *instrument.ConcurrencyUsage, gid int) (ret map[string]int)

func (*Coverage) ToString

func (cov *Coverage) ToString(cu *instrument.ConcurrencyUsage) (string, string)

type DetectFunc

type DetectFunc func([]byte) (bool, string)

type ECTExperiment

type ECTExperiment struct {
	Experiment
	Args     []string `json:"args"`
	ID       string   `json:"ID"`
	GoVer    string   `json:"goVer"`
	TraceDir string   `json:"traceDir,omitempty"`
}

func (*ECTExperiment) Build

func (ex *ECTExperiment) Build(race bool)

Build ECT-experiment

func (*ECTExperiment) Execute

func (ex *ECTExperiment) Execute(i int, race bool) *Result

Execute and analyze ECT-experiment

func (*ECTExperiment) Init

func (ex *ECTExperiment) Init(race bool)

func (*ECTExperiment) Instrument

func (ex *ECTExperiment) Instrument()

Instrument Goat-experiment

type Ex

type Ex interface {
	Init(bool)                 // init the experiments (bool: race)
	Instrument()               // instrument the program
	Build(bool)                // build the program (bool: race)
	Execute(int, bool) *Result // execute the instrumented program (int: #iteration)
}

Interface for Experiments

type ExConfig

type ExConfig struct {
	Timeout int `json:"timeout"` // time.Second
	Cpu     int `json:"cpu"`
}

Basic config for experiments

type Experiment

type Experiment struct {
	ExConfig
	Target       *Bug          `json:"-"`
	PrefixDir    string        `json:"prefixDir"`
	BinaryName   string        `json:"binaryName"`
	OutPath      string        `json:"outPath"`
	OutBuf       *bufio.Writer `json:"-"`
	Results      []*Result     `json:"results"`
	Detector     DetectFunc    `json:"-"`
	Instrumentor InstFunc      `json:"-"`
}

Struct for all experiments

type GGInfo

type GGInfo struct {
	CoverageMap map[int]*Coverage // global structure to store general coverages. key: cuIndex, val: coverage instance per each node
	// contains filtered or unexported fields
}

Nodes of GGTree

func (*GGInfo) CovNodeMap

func (gi *GGInfo) CovNodeMap(concUsage []*instrument.ConcurrencyUsage) (ret map[int]map[string]int)

func (*GGInfo) ToString

func (gi *GGInfo) ToString(concUsage []*instrument.ConcurrencyUsage) (string, string)

type GGTree

type GGTree struct {
	Node     *GGInfo
	Children map[string][]*GGTree // key: createFkey, val: totally ordered goroutines that were created in fkey
}

func (*GGTree) ToString

func (t *GGTree) ToString(concUsage []*instrument.ConcurrencyUsage) string

type GlobalStack

type GlobalStack struct {
	FrameMap  map[int]*trace.Frame // key: unique id, value: frame
	FrameSMap map[string]int       // key: fkey, value: unique id
}

type GoatExperiment

type GoatExperiment struct {
	Experiment
	ID               string           `json:"goatid"`
	Bound            int              `json:"goatBound"` // -1: multi, 0: uni,  1 =< : delay
	TraceDir         string           `json:"traceDir"`  // for blocking bugs only
	LastFailedTrace  string           `json:"lastFailedTrace"`
	LastSuccessTrace string           `json:"lastSuccessTrace"`
	FirstFailedAfter int              `json:"firstFailedAfter"`
	GGTree           *GGTree          `json:"-"` // (will be reconstructed from replay)
	TotalGG          int              `json:"-"` // (will be reconstructed from replay)
	ConcUsage        *ConcUsageStruct `json:"-"` // (will be reconstructed from replay)
	GStack           *GlobalStack     `json:"-"` // (will be reconstructed from replay)
}

Struct for Goat experiments

func ReadExperimentResults_goat

func ReadExperimentResults_goat(fname string) (exp *GoatExperiment)

func (*GoatExperiment) Build

func (gex *GoatExperiment) Build(race bool)

Build Goat-experiment

func (*GoatExperiment) Execute

func (gex *GoatExperiment) Execute(i int, race bool) *Result

Execute and analyze Goat-experiment

func (*GoatExperiment) GetMode

func (gex *GoatExperiment) GetMode() string

GetMode

func (*GoatExperiment) Init

func (gex *GoatExperiment) Init(race bool)

Init Goat

func (*GoatExperiment) InitConcMap

func (gex *GoatExperiment) InitConcMap()

map concurrency usage index to its respective string representation

func (*GoatExperiment) Instrument

func (gex *GoatExperiment) Instrument()

Instrument Goat-experiment

func (*GoatExperiment) PrintCoverageReport

func (gex *GoatExperiment) PrintCoverageReport(countNoop bool) float64

func (*GoatExperiment) PrintGlobals

func (gex *GoatExperiment) PrintGlobals()

func (*GoatExperiment) UpdateConcUsage

func (gex *GoatExperiment) UpdateConcUsage(stacks map[uint64][]*trace.Frame, lstack map[uint64]string)

after creating lstack (updating gstack), update concUsage with their respective fkeys

func (*GoatExperiment) UpdateCoverageGGTree

func (gex *GoatExperiment) UpdateCoverageGGTree(parseResult *trace.ParseResult, lstack map[uint64]string)

func (*GoatExperiment) UpdateCoverageReport

func (gex *GoatExperiment) UpdateCoverageReport()

func (*GoatExperiment) UpdateGGTree

func (gex *GoatExperiment) UpdateGGTree(parseResult *trace.ParseResult, lstack map[uint64]string)

func (*GoatExperiment) UpdateGStack

func (gex *GoatExperiment) UpdateGStack(stack map[uint64][]*trace.Frame) map[uint64]string

Updates GStack and returns compatible LStack

type InstFunc

type InstFunc func(string, string) []*instrument.ConcurrencyUsage

const TERMINATION = "ignoreGDL" const TERMINATION = "thresh"

type Result

type Result struct {
	Time      time.Duration     `json:"time"`
	Desc      string            `json:"desc,omitempty"`
	TracePath string            `json:"tracePath,omitempty"` // for goat
	TraceSize int               `json:"traceSize,omitempty"` // for goat
	TotalG    int               `json:"totalg,omitempty"`    // for goat
	TotalCh   int               `json:"totalch,omitempty"`   // for goat
	StackSize int               `json:"stackSize,omitempty"` // for goat
	EventsLen int               `json:"eventsLen,omitempty"` // for goat
	Detected  bool              `json:"detected"`            // for goat
	LStack    map[uint64]string `json:"lstack,omitempty"`    // for goat (will be reconstructed from replay)
	Coverage1 float64           `json:"coverage1,omitempty"` // for goat (will be reconstructed from replay)
	Coverage2 float64           `json:"coverage1,omitempty"` // for goat (will be reconstructed from replay)
}

Hold results from experimnets

type RootExperiment

type RootExperiment struct {
	Bug        *Bug
	Exps       map[string]Ex `json:"exps"`
	ReportJSON string        `json:"reportJSON"`
}

type Selecti

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

type ToolExperiment

type ToolExperiment struct {
	Experiment
	ToolID string `json:"toolid"`
}

Struct for Tool experiments

func ReadExperimentResults_tool

func ReadExperimentResults_tool(fname string) (tex *ToolExperiment)

func (*ToolExperiment) Build

func (tex *ToolExperiment) Build(race bool)

Build ToolExperiment

func (*ToolExperiment) Execute

func (tex *ToolExperiment) Execute(i int, race bool) *Result

Execute and analyze Tool-experiment

func (*ToolExperiment) Init

func (tex *ToolExperiment) Init(race bool)

Init ToolExperiment

func (*ToolExperiment) Instrument

func (tex *ToolExperiment) Instrument()

Instrument ToolExperiment

Jump to

Keyboard shortcuts

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