1 Star 0 Fork 0

艾鸥科技 / go-aiou

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
account_round.go 1.59 KB
一键复制 编辑 原始数据 按行查看 历史
张卓 提交于 2020-05-10 14:55 . init
package run
import (
"gitee.com/aiou-official/go-aiou/ilog"
"gitee.com/aiou-official/go-aiou/itest"
"github.com/urfave/cli"
"strconv"
"time"
)
// AccountRoundCommand is the command of account test round
var AccountRoundCommand = cli.Command{
Name: "account_round",
ShortName: "a_round",
Usage: "run account test round",
Flags: AccountRoundFlags,
Action: AccountRoundAction,
}
// AccountRoundFlags is the list of flags for account round.
var AccountRoundFlags = []cli.Flag{
cli.IntFlag{
Name: "start",
Value: 1,
Usage: "start round",
},
cli.IntFlag{
Name: "round",
Value: 100,
Usage: "round number",
},
}
// AccountRoundAction is the action of account test round
var AccountRoundAction = func(c *cli.Context) error {
itest.Interval = 2 * time.Millisecond
itest.InitAmount = "1000"
itest.InitPledge = "1000"
itest.InitRAM = "3000"
logger := ilog.New()
fileWriter := ilog.NewFileWriter(c.GlobalString("log"))
fileWriter.SetLevel(ilog.LevelInfo)
logger.AddWriter(fileWriter)
ilog.InitLogger(logger)
keysfile := c.GlobalString("keys")
configfile := c.GlobalString("config")
it, err := itest.Load(keysfile, configfile)
if err != nil {
return err
}
start := c.Int("start")
round := c.Int("round")
for i := start; i < start+round; i++ {
accounts, err := it.CreateAccountRoundN(10000, false, true, i)
if err != nil {
return err
}
outputFile := "output_acc" + strconv.FormatInt(int64(i), 10) + ".json"
ilog.Infof("before dump account %v\n", outputFile)
if err := itest.DumpAccounts(accounts, outputFile); err != nil {
return err
}
}
return nil
}
1
https://gitee.com/aiou-official/go-aiou.git
git@gitee.com:aiou-official/go-aiou.git
aiou-official
go-aiou
go-aiou
376a44096468

搜索帮助