lotus bench add ticket-preimage

This commit is contained in:
zgfzgf 2020-10-11 17:20:55 +08:00
parent fcb9dea501
commit e4209d86f6

View File

@ -122,7 +122,7 @@ var sealBenchCmd = &cli.Command{
&cli.StringFlag{ &cli.StringFlag{
Name: "storage-dir", Name: "storage-dir",
Value: "~/.lotus-bench", Value: "~/.lotus-bench",
Usage: "Path to the storage directory that will store sectors long term", Usage: "path to the storage directory that will store sectors long term",
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "sector-size", Name: "sector-size",
@ -154,16 +154,22 @@ var sealBenchCmd = &cli.Command{
Name: "skip-unseal", Name: "skip-unseal",
Usage: "skip the unseal portion of the benchmark", Usage: "skip the unseal portion of the benchmark",
}, },
&cli.StringFlag{
Name: "ticket-preimage",
Usage: "ticket random",
},
&cli.StringFlag{ &cli.StringFlag{
Name: "save-commit2-input", Name: "save-commit2-input",
Usage: "Save commit2 input to a file", Usage: "save commit2 input to a file",
}, },
&cli.IntFlag{ &cli.IntFlag{
Name: "num-sectors", Name: "num-sectors",
Usage: "select number of sectors to seal",
Value: 1, Value: 1,
}, },
&cli.IntFlag{ &cli.IntFlag{
Name: "parallel", Name: "parallel",
Usage: "num run in parallel",
Value: 1, Value: 1,
}, },
}, },
@ -244,7 +250,8 @@ var sealBenchCmd = &cli.Command{
} }
// Only fetch parameters if actually needed // Only fetch parameters if actually needed
if !c.Bool("skip-commit2") { skipc2 := c.Bool("skip-commit2")
if !skipc2 {
if err := paramfetch.GetParams(lcli.ReqContext(c), build.ParametersJSON(), uint64(sectorSize)); err != nil { if err := paramfetch.GetParams(lcli.ReqContext(c), build.ParametersJSON(), uint64(sectorSize)); err != nil {
return xerrors.Errorf("getting params: %w", err) return xerrors.Errorf("getting params: %w", err)
} }
@ -271,7 +278,7 @@ var sealBenchCmd = &cli.Command{
PreCommit2: 1, PreCommit2: 1,
Commit: 1, Commit: 1,
} }
sealTimings, sealedSectors, err = runSeals(sb, sbfs, sectorNumber, parCfg, mid, sectorSize, []byte(c.String("ticket-preimage")), c.String("save-commit2-input"), c.Bool("skip-commit2"), c.Bool("skip-unseal")) sealTimings, sealedSectors, err = runSeals(sb, sbfs, sectorNumber, parCfg, mid, sectorSize, []byte(c.String("ticket-preimage")), c.String("save-commit2-input"), skipc2, c.Bool("skip-unseal"))
if err != nil { if err != nil {
return xerrors.Errorf("failed to run seals: %w", err) return xerrors.Errorf("failed to run seals: %w", err)
} }
@ -320,7 +327,7 @@ var sealBenchCmd = &cli.Command{
beforePost := time.Now() beforePost := time.Now()
if !c.Bool("skip-commit2") { if !skipc2 {
log.Info("generating winning post candidates") log.Info("generating winning post candidates")
wipt, err := spt.RegisteredWinningPoStProof() wipt, err := spt.RegisteredWinningPoStProof()
if err != nil { if err != nil {
@ -468,7 +475,7 @@ var sealBenchCmd = &cli.Command{
} }
fmt.Println("") fmt.Println("")
} }
if !c.Bool("skip-commit2") { if !skipc2 {
fmt.Printf("generate candidates: %s (%s)\n", bo.PostGenerateCandidates, bps(bo.SectorSize*abi.SectorSize(len(bo.SealingResults)), bo.PostGenerateCandidates)) fmt.Printf("generate candidates: %s (%s)\n", bo.PostGenerateCandidates, bps(bo.SectorSize*abi.SectorSize(len(bo.SealingResults)), bo.PostGenerateCandidates))
fmt.Printf("compute winning post proof (cold): %s\n", bo.PostWinningProofCold) fmt.Printf("compute winning post proof (cold): %s\n", bo.PostWinningProofCold)
fmt.Printf("compute winning post proof (hot): %s\n", bo.PostWinningProofHot) fmt.Printf("compute winning post proof (hot): %s\n", bo.PostWinningProofHot)