-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
66 lines (57 loc) · 1.7 KB
/
main.go
File metadata and controls
66 lines (57 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package main
import (
"fmt"
"icury_benchmark_tests/benchmark"
"log"
"time"
)
func main() {
start := time.Now()
ch := make(chan string)
// Testing API writetrx
fmt.Printf("Testing MakeWritetrxRequest API.......\n")
url := "http://51.254.99.43:5000/transaction/writetrx"
for i := 0; i < 100; i++ {
go benchmark.MakeWritetrxRequest(url, ch, i)
}
for i := 0; i < 100; i++ {
fmt.Println(<-ch)
}
elapsed := time.Since(start).Seconds()
log.Printf("Total writetrx hits took %f time in seconds", elapsed)
// Testing API writetrxln
fmt.Printf("Testing MakeWritetrxlnRequest API.......\n")
url = "http://51.254.99.43:5000/transaction/writetrxln"
for i := 0; i < 100; i++ {
go benchmark.MakeWritetrxlnRequest(url, ch, i)
}
for i := 0; i < 100; i++ {
fmt.Println(<-ch)
}
elapsed = time.Since(start).Seconds()
log.Printf("Total writetrxln hits took %f time in seconds", elapsed)
// Testing API gettrx
fmt.Printf("Testing MakeGettrxRequest API.......\n")
url = "http://51.254.99.43:5000/transaction/gettrx"
for i := 0; i < 100; i++ {
go benchmark.MakeGettrxRequest(url, ch)
}
for i := 0; i < 100; i++ {
fmt.Println(<-ch)
}
elapsed = time.Since(start).Seconds()
log.Printf("Total gettrx hits took %f time in seconds", elapsed)
// Testing API gettrxln
fmt.Printf("Testing MakeGettrxlnRequest API.......\n")
url = "http://51.254.99.43:5000/transaction/gettrxln"
for i := 0; i < 100; i++ {
go benchmark.MakeGettrxlnRequest(url, ch)
}
for i := 0; i < 100; i++ {
fmt.Println(<-ch)
}
elapsed = time.Since(start).Seconds()
log.Printf("Total gettrxln hits took %f time in seconds", elapsed)
elapsed = time.Since(start).Seconds()
log.Printf("Total API hits took %f time in seconds", elapsed)
}