Documentation ¶
Index ¶
- Constants
- func CanonicalPathsEqual(filePath1, filePath2 string) (isEqual bool, err error)
- func CollectGarbage()
- func CopyFile(fromFile, toFile string) error
- func CopyFromFileName2Writer(fromFileName string, toFile *os.File) error
- func CreatePrefixedZip(pathToZipUp, zipFilePath, prefixToReplace, newPrefix string) error
- func GlobalUniqueIntFactory()
- func MaxFloat64(a, b float64) float64
- func MaxUint32(a, b uint32) uint32
- func MaxUint64(a, b uint64) uint64
- func MeasurerFactory(verbosity uint32)
- func MinFloat64(a, b float64) float64
- func MinInt(a, b int) int
- func MinUint32(a, b uint32) uint32
- func NotImplementedYet(what string)
- func RandomSlug(byteLen uint) string
- func RoundInt(f float64) int
- func RoundIntDiv(a, b float64) int
- func RoundToEven(f float64) int
- func RoundUpInt(f float64) int
- type Measurer
- type ResDivide
- type UniqueInt
Constants ¶
const MAXUINT64 = uint64(18446744073709551615)
Variables ¶
This section is empty.
Functions ¶
func CanonicalPathsEqual ¶
func CopyFromFileName2Writer ¶
func CreatePrefixedZip ¶
CreatePrefixedZip creates a zip file of a directory (pathToZip). As it puts each file in the zip, if the path of the file starts with prefixToReplace it will be changed to newPrefix. Note: this is not a full-featured zip creation function, only what we need. Specifically, it doesn't follow sym links during its recursion (because filepath.Walk() doesn't), and it doesn't add the dirs as their own entries like the zip cmd does (SPC can't handle that).
func GlobalUniqueIntFactory ¶
func GlobalUniqueIntFactory()
UniqueIntFactory creates the global instance of UniqueInt todo: verify this is ok for multiple populations!!!!!!!!!!!!!!
func MaxFloat64 ¶
func MeasurerFactory ¶
func MeasurerFactory(verbosity uint32)
MeasurerFactory creates an instance of Measurer
func MinFloat64 ¶
func NotImplementedYet ¶
func NotImplementedYet(what string)
func RoundInt ¶
RoundInt returns the nearest int result. To get more exact, look at https://github.com/a-h/round
func RoundIntDiv ¶
RoundIntDiv divides a/b and returns the nearest int result.
func RoundToEven ¶
RoundToEven returns the nearest even integer. Note: only works for positive numbers
Types ¶
type Measurer ¶
type Measurer struct { DeltaTime map[string]time.Time // holds the start time for 1 duration measurement TotalTime map[string]int64 MaxTotalMemory uint64 // the amount of memory this program used Track bool }
Measure keeps track of how much execution time was spent in various parts of the code, and the maximum amount of memory
var Measure *Measurer
Measure is a singleton instance of Measure to track execution time
func (*Measurer) CheckAmountMemoryUsed ¶
func (m *Measurer) CheckAmountMemoryUsed()
func (*Measurer) GetAmountMemoryUsed ¶
GetAmountMemoryUsed returns the max memory used so far in MB
func (*Measurer) GetInterimTime ¶
GetInterimTime returns the total number of seconds (as a float64) so far for this codeName.
func (*Measurer) LogSummary ¶
func (m *Measurer) LogSummary()
LogSummary prints to the log all of the total times.
type ResDivide ¶
type ResDivide struct {
// contains filtered or unexported fields
}
ResDivide splits a resource quantity among a number of recipient objects, handling the remainder for the last object.
func ResDivideFactory ¶
ResDivideFactory creates an instance of ResDivide
func (*ResDivide) NextAmount ¶
NextAmount returns the number of resources the next object in the iteration should receive
type UniqueInt ¶
type UniqueInt struct {
// contains filtered or unexported fields
}
UniqueInt hands out unique integer numbers, with the ability to also give a range to another object
var GlobalUniqueInt *UniqueInt
GlobalUniqueInt is a singleton instance of UniqueInt to hand out integers. It is *not* thread safe.
func (*UniqueInt) DonateRange ¶
DonateRange create a new instance of UniqueInt, donating a range of int's from the existing object.