feat(lotus-sim): record timing information for pre/prove-commit packing

This commit is contained in:
Steven Allen 2021-06-09 19:35:22 -07:00
parent 868231adc7
commit 1802ae31a6
2 changed files with 6 additions and 0 deletions

View File

@ -3,6 +3,7 @@ package simulation
import ( import (
"context" "context"
"fmt" "fmt"
"time"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
@ -35,6 +36,7 @@ func (ss *simulationState) packPreCommits(ctx context.Context, cb packFunc) (_er
full bool full bool
top1Count, top10Count, restCount int top1Count, top10Count, restCount int
) )
start := time.Now()
defer func() { defer func() {
if _err != nil { if _err != nil {
return return
@ -45,6 +47,7 @@ func (ss *simulationState) packPreCommits(ctx context.Context, cb packFunc) (_er
"top10", top10Count, "top10", top10Count,
"rest", restCount, "rest", restCount,
"filled-block", full, "filled-block", full,
"duration", time.Since(start),
) )
}() }()

View File

@ -2,6 +2,7 @@ package simulation
import ( import (
"context" "context"
"time"
"github.com/filecoin-project/go-bitfield" "github.com/filecoin-project/go-bitfield"
@ -25,6 +26,7 @@ func (ss *simulationState) packProveCommits(ctx context.Context, cb packFunc) (_
// Roll the commitQueue forward. // Roll the commitQueue forward.
ss.commitQueue.advanceEpoch(ss.nextEpoch()) ss.commitQueue.advanceEpoch(ss.nextEpoch())
start := time.Now()
var full, failed, done, unbatched, count int var full, failed, done, unbatched, count int
defer func() { defer func() {
if _err != nil { if _err != nil {
@ -38,6 +40,7 @@ func (ss *simulationState) packProveCommits(ctx context.Context, cb packFunc) (_
"unbatched", unbatched, "unbatched", unbatched,
"miners-processed", count, "miners-processed", count,
"filled-block", full, "filled-block", full,
"duration", time.Since(start),
) )
}() }()