gofast

package module
v0.0.0-...-2e284cb Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2016 License: MIT Imports: 12 Imported by: 0

README

Go-fast GoDoc Build Status Go Report Card

go-fast is a golang module for interacting with www.fast.com's API to extract believable speed benchmarks.

Install

If you are familiar with Go's toolchain this is pretty much self-explanatory, otherwise you need to setup the $GOPATH enviromental variable

❯❯❯ export GOPATH=${HOME}/go
❯❯❯ go get -u github.com/npotts/go-fast/go-fast
❯❯❯ ${GOPATH}/bin/go-fast --help
usage: go-fast [<flags>]

A CLI interface to www.fast.com

Flags:
      --help        Show context-sensitive help (also try --help-long and --help-man).
  -w, --workers=3   Number of workers to start. Currently www.fast.com/Netflix only allows up to 3
  -m, --max="50MB"  Maximum worker download size

exit status 1
❯❯❯ go-fast
2016/07/20 21:46:45 Starting with 3 worker(s)
2016/07/20 21:47:43 3 worker(s) downloaded at an average of
  2809750.97 Bps
  2743.90 Kbps
  2.68 Mbps

TODO

  • Modify token.go to fill up to the requested number of URLs rather than the maximum of 3 the API defaults to

Documentation

Overview

Package gofast is a go module that accesses www.fast.com in order to derive upload/download speeds

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Measurer

type Measurer interface {
	Measure(Settings) <-chan Results
}

Measurer is an interface used to measure values. The returned channel will be written to exactly once

func New

func New() Measurer

New returns an object that is a measurer

type Results

type Results struct {
	Bytes      []int           `json:"bytes,omitempty"`      //A slice of the total bytes read by each worker
	Duration   []time.Duration `json:"duration,omitempty"`   // slice of total duration the operation took
	BitsPerSec []float64       `json:"bitspersec,omitempty"` //sice of calculated bits/sec from each worker
	Samples    []nStats        `json:"samples,omitempty"`    //Slice of all the samples each worker measured.
	Workers    int             `json:"workers"`              //number of workers used
	Bps        float64         `json:"bps"`                  //bits per second
	Kbps       float64         `json:"kbps"`                 //kbits per second
	Mbps       float64         `json:"mbps"`                 //MBits per second
}

Results is the final results of the test complete with raw data measured form each worker

func (Results) String

func (r Results) String() string

type Settings

type Settings struct {
	Workers  int           //number of workers to use
	MaxBytes int64         //maximum number of bytes to ingest
	Network  time.Duration //maximal time to allow network operations to run for
	Timeout  time.Duration //maximal time to run for
	EmitJSON bool          //emit JSON output
}

Settings is the configurable settings to pass to a Measurer

type Stats

type Stats struct {
	Error    error         `json:"error,omitempty"`   //Error, if any, that occurred while reading in a sample set
	Duration time.Duration `json:"duration"`          //how long the operation took to read in Bytes
	Bytes    int           `json:"bytes"`             //the number of bytes read in
	Bps      float64       `json:"bps"`               //bits per second over the immediate sample period
	Samples  []Stats       `json:"samples,omitempty"` //Workers should populate this with all their stats
}

Stats is a simple store of statistic data

func (Stats) String

func (s Stats) String() string

type Worker

type Worker interface {
	Start(url string, cfg Settings, wg *sync.WaitGroup)
	Stat() Stats
}

The Worker interface is used by the actual lower level workers responsible for downloading the files

Directories

Path Synopsis
Package gofast is a go module that access www.fast.com in order to derive upload/download speeds
Package gofast is a go module that access www.fast.com in order to derive upload/download speeds

Jump to

Keyboard shortcuts

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