import (
"bufio"
"bytes"
+ "flag"
"fmt"
"io"
"log"
var iter = 10
func main() {
- bytes := 10 * MiB
- dUrl, _ := url.Parse(DOWNLOAD_PATH + "?bytes=" + strconv.FormatInt(int64(bytes), 10))
+ upFlag := flag.Int64("up", 10, "number of MB for upload test")
+ downFlag := flag.Int64("down", 1, "number of MB for download test")
+ flag.Parse()
+ upBytes := Byte(*upFlag) * MiB
+ downBytes := Byte(*downFlag) * MiB
+ dUrl, _ := url.Parse(DOWNLOAD_PATH + "?bytes=" + strconv.FormatInt(int64(downBytes), 10))
uUrl, _ := url.Parse(UPLOAD_PATH)
down := &http.Request{
Method: "GET",
upChan := make(chan float64)
client := &http.Client{}
- go measureNRequests(iter, client, func() *http.Request { return down }, bytes, downChan)
- go measureNRequests(iter, client, func() *http.Request { return getUp(uUrl, bytes) }, bytes, upChan)
+ go measureNRequests(iter, client, func() *http.Request { return down }, downBytes, downChan)
+ go measureNRequests(iter, client, func() *http.Request { return getUp(uUrl, upBytes) }, upBytes, upChan)
tickChan := make(chan rune)
go func() {
for {