sys

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2018 License: BSD-3-Clause Imports: 7 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Width  = 46
	Height = 56
	Max    = 8
)

Image vars

View Source
var (
	Pval = 0.0001
	Eps  = 4.0
	Mp   = 4
)

Gens parameters

View Source
var (
	EqualEpsilon    = 1e-5
	LogEqualEpsilon float64
)

Math

View Source
var (
	MemLowBoundShrink = 1024
	MemConservative   = false
)

Memory variables

View Source
var (
	Random *rand.Rand
)
View Source
var (
	Verbose = false
)

Global config

Functions

func ForceFree

func ForceFree()

ForceFree forces the garbage collector to free memory regardless of sys.MemConservative.

func Free

func Free()

Free forces the garbage collector to free memory. Blocks the program until GC is done.

func LogFile

func LogFile() *os.File

LogFile returns the log file. The default log file is os.Stdout, which is the standard output device.

func MeasureTime

func MeasureTime(s time.Time, d string)

MeasureTime takes a start time s and a string d. MeasureTime will time s with the current time and print with GoSPN's Printf a string of format ("%s took %s.", d, s). Consider using it as:

func funcToTime() {
  defer sys.MeasureTime(time.Now(), "funcToTime")
  // ...
}

Since arguments are evaluated before function call, the function will print the correct funcToTime run time.

func Printf

func Printf(str string, vals ...interface{})

Printf is a wrapper for fmt.Printf. Only prints if Verbose is set to true.

func Println

func Println(str string)

Println is a wrapper for fmt.Println. Only prints if Verbose is set to true.

func RandFloat64

func RandFloat64() float64

func RandIntn

func RandIntn(n int) int

func RandNormFloat64

func RandNormFloat64() float64

func RandomComb

func RandomComb(u int, v int, m int) [][2]int

func RefreshRandom

func RefreshRandom(s int64) *rand.Rand

RandSeed sets the pseudo-random generator's seed and resets the

func Seed

func Seed() int64

Seed returns the pseudo-random seed.

func SetLogFile

func SetLogFile(filename string) (*os.File, error)

SetLogFile forces GoSPN to write all content to a log file. If filename is empty, writes to standard output. Returns the file pointer and errors if any.

func StartTimer

func StartTimer()

StartTimer manually starts the global timer.

func StopTimer

func StopTimer() time.Duration

StopTimer manually stops the global timer. Returns the time elapsed since calling StartTimer.

Types

This section is empty.

Jump to

Keyboard shortcuts

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