internal.go
func (b *Bench) internalRun(showProgress bool) results.ResultSet {

	startTime := time.Now()
	endTime := startTime.Add(b.duration)

	sem := semaphore.NewSemaphore(b.threads, b.rampUp) // create a new semaphore with an initiall capacity or 0
	out := make(chan results.Result)
	resultsChan := make(chan []results.Result)

	go handleResult(showProgress, out, resultsChan)

	for run := true; run; run = (time.Now().Before(endTime)) {

		sem.Lock() // blocks when channel is full

		// execute a request
		go doRequest(b.request, b.timeout, sem, out)
	}

	fmt.Print("\nWaiting for threads to finish ")
	for i := sem.Length(); i != 0; i = sem.Length() {

		//abandon <- true
		time.Sleep(200 * time.Millisecond)
	}

	fmt.Println(" OK")
	fmt.Println("")

	close(out)

	return <-resultsChan
}
func (b *Bench) internalRun(showProgress bool) results.ResultSet {

	startTime := time.Now()
	endTime := startTime.Add(b.duration)

	sem := semaphore.NewSemaphore(b.threads, b.rampUp) // create a new semaphore with an initiall capacity or 0
	out := make(chan results.Result)
	resultsChan := make(chan []results.Result)

	go handleResult(showProgress, out, resultsChan)

	for run := true; run; run = (time.Now().Before(endTime)) {

		sem.Lock() // blocks when channel is full

		// execute a request
		go doRequest(b.request, b.timeout, sem, out)
	}

	fmt.Print("\nWaiting for threads to finish ")
	for i := sem.Length(); i != 0; i = sem.Length() {

		//abandon <- true
		time.Sleep(200 * time.Millisecond)
	}

	fmt.Println(" OK")
	fmt.Println("")

	close(out)

	return <-resultsChan
}
// RunBenchmarks executes the benchmarks based upon the given criteria
//
// Returns a resultset