Skip to content

Commit

Permalink
Merge pull request #3995 from filecoin-project/feat/more-stateroot-stats
Browse files Browse the repository at this point in the history
add some more big pictures stats to stateroot stat
  • Loading branch information
Jakub Sztandera authored Sep 24, 2020
2 parents 85caa48 + 4eaa05d commit 45d8cb0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cmd/lotus-shed/stateroot-stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ var staterootStatCmd = &cli.Command{
return infos[i].Stat.Size > infos[j].Stat.Size
})

var totalActorsSize uint64
for _, info := range infos {
totalActorsSize += info.Stat.Size
}

outcap := 10
if cctx.Args().Len() > outcap {
outcap = cctx.Args().Len()
Expand All @@ -190,6 +195,15 @@ var staterootStatCmd = &cli.Command{
outcap = len(infos)
}

totalStat, err := api.ChainStatObj(ctx, ts.ParentState(), cid.Undef)
if err != nil {
return err
}

fmt.Println("Total state tree size: ", totalStat.Size)
fmt.Println("Sum of actor state size: ", totalActorsSize)
fmt.Println("State tree structure size: ", totalStat.Size-totalActorsSize)

fmt.Print("Addr\tType\tSize\n")
for _, inf := range infos[:outcap] {
cmh, err := multihash.Decode(inf.Actor.Code.Hash())
Expand Down

0 comments on commit 45d8cb0

Please sign in to comment.