Skip to content

Commit 86a605a

Browse files
committed
Update dev/load.go
1 parent 499036e commit 86a605a

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

dev/load.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
const _numConcurrent = 5
3232
const _numRequestsPerThread = -1
3333
const _requestDelay = 0 * time.Second
34+
const _num_main_loops = 10
3435

3536
var _client = &http.Client{
3637
Timeout: 600 * time.Second,
@@ -39,7 +40,9 @@ var _client = &http.Client{
3940
},
4041
}
4142

42-
func main() {
43+
func run() {
44+
start := time.Now()
45+
4346
if _numRequestsPerThread > 0 {
4447
fmt.Printf("spawning %d threads, %d requests each, %s delay on each\n", _numConcurrent, _numRequestsPerThread, _requestDelay.String())
4548
} else {
@@ -68,6 +71,20 @@ func main() {
6871
}
6972

7073
fmt.Println()
74+
fmt.Println("elapsed time:", time.Now().Sub(start))
75+
}
76+
77+
func main() {
78+
start := time.Now()
79+
loop_num := 1
80+
for true {
81+
run()
82+
if loop_num >= _num_main_loops {
83+
break
84+
}
85+
loop_num++
86+
}
87+
fmt.Println("total elapsed time:", time.Now().Sub(start))
7188
}
7289

7390
func makeRequestLoop(url string, jsonBytes []byte) {

0 commit comments

Comments
 (0)