-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
164 lines (157 loc) · 4.55 KB
/
main.go
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
package main
import (
"github.com/urfave/cli/v2"
"log"
"os"
"runtime"
"seerEVM/experiments"
)
const (
TestPreExecutionLarge = iota
TestPrediction
TestSpeedup
TestConcurrent
TestAbort
TestBreakDown
TestMemoryCPUBaseline
TestMemoryCPU
BranchStatistics
TestMemoryCPUSweep
TestIOBaseline
TestIO
TestMemoryCPUConcurrent
)
type SeerRun struct {
// flags to determine which to run
TestIndicator int
StartingBlock int64
BlockNum int64
TxNum int
Threads int
DisorderRatio float64
EnableRepair bool
EnablePerceptron bool
EnableFast bool
StoreCheckpoint bool
FullStorage bool
}
func (sr *SeerRun) Run() {
app := &cli.App{
Flags: []cli.Flag{
&cli.IntFlag{
Name: "indicator",
Aliases: []string{"in"},
Usage: "Specify the test content",
Value: TestPreExecutionLarge,
Destination: &sr.TestIndicator,
},
&cli.Int64Flag{
Name: "start",
Aliases: []string{"st"},
Usage: "Starting block height",
Value: 14650000,
Destination: &sr.StartingBlock,
},
&cli.Int64Flag{
Name: "blockNum",
Aliases: []string{"bn"},
Usage: "Number of blocks to replay",
Value: 100,
Destination: &sr.BlockNum,
},
&cli.IntFlag{
Name: "txNum",
Aliases: []string{"tn"},
Usage: "Number of transactions to replay (in large scale)",
Value: 2000,
Destination: &sr.TxNum,
},
&cli.IntFlag{
Name: "threads",
Aliases: []string{"th"},
Usage: "Number of threads for concurrent execution",
Value: 4,
Destination: &sr.Threads,
},
&cli.Float64Flag{
Name: "ratio",
Aliases: []string{"r"},
Usage: "Ratio of out-of-order transactions",
Value: 0,
Destination: &sr.DisorderRatio,
},
&cli.BoolFlag{
Name: "repair",
Aliases: []string{"rp"},
Value: false,
Usage: "Whether to enable pre-execution repair",
Destination: &sr.EnableRepair,
},
&cli.BoolFlag{
Name: "perceptron",
Aliases: []string{"pc"},
Value: false,
Usage: "Whether to enable perceptron model",
Destination: &sr.EnablePerceptron,
},
&cli.BoolFlag{
Name: "fast",
Aliases: []string{"f"},
Value: false,
Usage: "Whether to enable fast-path execution",
Destination: &sr.EnableFast,
},
&cli.BoolFlag{
Name: "checkpoint",
Aliases: []string{"cp"},
Value: false,
Usage: "Whether to enable checkpoint caching",
Destination: &sr.StoreCheckpoint,
},
&cli.BoolFlag{
Name: "fullStorage",
Aliases: []string{"fs"},
Value: false,
Usage: "Whether to store all state variable versions",
Destination: &sr.FullStorage,
},
},
}
err := app.Run(os.Args)
if err != nil {
log.Panic(err)
}
}
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
seer := &SeerRun{}
seer.Run()
switch seer.TestIndicator {
case TestPreExecutionLarge:
experiments.TestPreExecutionLarge(seer.TxNum, seer.StartingBlock, seer.BlockNum, seer.DisorderRatio, seer.EnableRepair)
case TestPrediction:
experiments.TestPredictionSuccess(seer.StartingBlock, seer.BlockNum, 0)
case TestSpeedup:
experiments.TestSpeedupPerTx(seer.StartingBlock, seer.BlockNum, seer.DisorderRatio, seer.EnableRepair, seer.EnablePerceptron, seer.EnableFast)
case TestConcurrent:
experiments.TestSeerConcurrentLarge(seer.Threads, seer.TxNum, seer.StartingBlock, seer.BlockNum)
case TestAbort:
experiments.TestSeerConcurrentAbort(seer.Threads, seer.TxNum, seer.BlockNum)
case TestBreakDown:
experiments.TestSeerBreakDown(seer.StartingBlock, seer.BlockNum, seer.DisorderRatio, seer.EnableRepair, seer.EnablePerceptron, seer.EnableFast)
case TestMemoryCPUBaseline:
experiments.TestMemoryCPUBaseline(seer.StartingBlock, seer.BlockNum)
case TestMemoryCPU:
experiments.TestMemoryCPUBreakDown(seer.StartingBlock, seer.BlockNum, seer.EnableRepair, seer.EnablePerceptron, seer.EnableFast, seer.StoreCheckpoint, seer.FullStorage)
case BranchStatistics:
experiments.TestGasUsed(seer.StartingBlock, seer.BlockNum)
case TestMemoryCPUSweep:
experiments.TestMemoryCPUSweep(seer.StartingBlock, seer.BlockNum)
case TestIOBaseline:
experiments.TestIOBaseline(seer.StartingBlock, seer.BlockNum)
case TestIO:
experiments.TestIOSeer(seer.StartingBlock, seer.BlockNum)
case TestMemoryCPUConcurrent:
experiments.TestMemoryCPUConcurrent(seer.Threads, seer.StartingBlock, seer.BlockNum)
}
}