代码拉取完成,页面将自动刷新
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
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。