Last active
April 30, 2019 17:28
-
-
Save frrist/939db276e00d739efdb4c588f1277637 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ROUTINE ======================== github.com/filecoin-project/go-filecoin/chain.(*DefaultSyncer).syncOne in /home/frrist/src/github.com/filecoin-project/go-filecoin/chain/default_syncer.go | |
10ms 1.70mins (flat, cum) 30.98% of Total | |
. . 183:// Precondition: the caller of syncOne must hold the syncer's lock (syncer.mu) to | |
. . 184:// ensure head is not modified by another goroutine during run. | |
. . 185:func (syncer *DefaultSyncer) syncOne(ctx context.Context, parent, next types.TipSet) error { | |
. . 186: // Lookup parent state. It is guaranteed by the syncer that it is in | |
. . 187: // the chainStore. | |
10ms 950ms 188: st, err := syncer.tipSetState(ctx, parent.String()) | |
. . 189: if err != nil { | |
. . 190: return err | |
. . 191: } | |
. . 192: | |
. . 193: // Gather ancestor chain needed to process state transition. | |
. . 194: h, err := next.Height() | |
. . 195: if err != nil { | |
. . 196: return err | |
. . 197: } | |
. . 198: newBlockHeight := types.NewBlockHeight(h) | |
. 1.09s 199: ancestors, err := GetRecentAncestors(ctx, parent, syncer.chainStore, newBlockHeight, consensus.AncestorRoundsNeeded, sampling.LookbackParameter) | |
. . 200: if err != nil { | |
. . 201: return err | |
. . 202: } | |
. . 203: | |
. . 204: // Run a state transition to validate the tipset and compute | |
. . 205: // a new state to add to the store. | |
. 1.55mins 206: st, err = syncer.consensus.RunStateTransition(ctx, next, ancestors, st) | |
. . 207: if err != nil { | |
. . 208: return err | |
. . 209: } | |
. 1.75s 210: root, err := st.Flush(ctx) | |
. . 211: if err != nil { | |
. . 212: return err | |
. . 213: } | |
. 280ms 214: err = syncer.chainStore.PutTipSetAndState(ctx, &TipSetAndState{ | |
. . 215: TipSet: next, | |
. . 216: TipSetStateRoot: root, | |
. . 217: }) | |
. . 218: if err != nil { | |
. . 219: return err | |
. . 220: } | |
. . 221: logSyncer.Debugf("Successfully updated store with %s", next.String()) | |
. . 222: | |
. . 223: // TipSet is validated and added to store, now check if it is the heaviest. | |
. . 224: // If it is the heaviest update the chainStore. | |
. 760ms 225: nextParentSt, err := syncer.tipSetState(ctx, parent.String()) // call again to get a copy | |
. . 226: if err != nil { | |
. . 227: return err | |
. . 228: } | |
. . 229: headParentCids, err := syncer.chainStore.Head().Parents() | |
. . 230: if err != nil { | |
. . 231: return err | |
. . 232: } | |
. . 233: var headParentSt state.Tree | |
. . 234: if headParentCids.Len() != 0 { // head is not genesis | |
. 850ms 235: headParentSt, err = syncer.tipSetState(ctx, headParentCids.String()) | |
. . 236: if err != nil { | |
. . 237: return err | |
. . 238: } | |
. . 239: } | |
. . 240: | |
. 1.76s 241: heavier, err := syncer.consensus.IsHeavier(ctx, next, syncer.chainStore.Head(), nextParentSt, headParentSt) | |
. . 242: if err != nil { | |
. . 243: return err | |
. . 244: } | |
. . 245: | |
. . 246: if heavier { | |
. . 247: // Gather the entire new chain for reorg comparison. | |
. . 248: // See Issue #2151 for making this scalable. | |
. 1.06s 249: newChain, err := CollectTipSetsOfHeightAtLeast(ctx, syncer.chainStore.BlockHistory(ctx, parent), types.NewBlockHeight(uint64(0))) | |
. . 250: if err != nil { | |
. . 251: return err | |
. . 252: } | |
. . 253: newChain = append(newChain, next) | |
. . 254: if IsReorg(syncer.chainStore.Head(), newChain) { | |
. . 255: logSyncer.Infof("reorg occurring while switching from %s to %s", syncer.chainStore.Head().String(), next.String()) | |
. . 256: } | |
. 30ms 257: if err = syncer.chainStore.SetHead(ctx, next); err != nil { | |
. . 258: return err | |
. . 259: } | |
. . 260: } | |
. . 261: | |
. . 262: return nil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ROUTINE ======================== github.com/filecoin-project/go-filecoin/consensus.(*Expected).RunStateTransition in /home/frrist/src/github.com/filecoin-project/go-filecoin/consensus/expected.go | |
0 1.55mins (flat, cum) 28.38% of Total | |
. . 234:// RunStateTransition is the chain transition function that goes from a | |
. . 235:// starting state and a tipset to a new state. It errors if the tipset was not | |
. . 236:// mined according to the EC rules, or if running the messages in the tipset | |
. . 237:// results in an error. | |
. . 238:func (c *Expected) RunStateTransition(ctx context.Context, ts types.TipSet, ancestors []types.TipSet, pSt state.Tree) (state.Tree, error) { | |
. 830ms 239: err := c.validateMining(ctx, pSt, ts, ancestors[0]) | |
. . 240: if err != nil { | |
. . 241: return nil, err | |
. . 242: } | |
. . 243: | |
. . 244: sl := ts.ToSlice() | |
. . 245: one := sl[0] | |
. . 246: for _, blk := range sl[1:] { | |
. . 247: if blk.Parents.String() != one.Parents.String() { | |
. . 248: log.Error("invalid parents", blk.Parents.String(), one.Parents.String(), blk) | |
. . 249: panic("invalid parents") | |
. . 250: } | |
. . 251: if blk.Height != one.Height { | |
. . 252: log.Error("invalid height", blk.Height, one.Height, blk) | |
. . 253: panic("invalid height") | |
. . 254: } | |
. . 255: } | |
. . 256: | |
. . 257: vms := vm.NewStorageMap(c.bstore) | |
. 1.54mins 258: st, err := c.runMessages(ctx, pSt, vms, ts, ancestors) | |
. . 259: if err != nil { | |
. . 260: return nil, err | |
. . 261: } | |
. 280ms 262: err = vms.Flush() | |
. . 263: if err != nil { | |
. . 264: return nil, err | |
. . 265: } | |
. . 266: return st, nil | |
. . 267:} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ROUTINE ======================== github.com/filecoin-project/go-filecoin/consensus.(*Expected).runMessages in /home/frrist/src/github.com/filecoin-project/go-filecoin/consensus/expected.go | |
0 1.54mins (flat, cum) 28.04% of Total | |
. . 354: var cpySt state.Tree | |
. . 355: | |
. . 356: // TODO: order blocks in the tipset by ticket | |
. . 357: // TODO: don't process messages twice | |
. . 358: for _, blk := range ts.ToSlice() { | |
. 2.23s 359: cpyCid, err := st.Flush(ctx) | |
. . 360: if err != nil { | |
. . 361: return nil, errors.Wrap(err, "error validating block state") | |
. . 362: } | |
. . 363: // state copied so changes don't propagate between block validations | |
. 1.07s 364: cpySt, err = state.LoadStateTree(ctx, c.cstore, cpyCid, builtin.Actors) | |
. . 365: if err != nil { | |
. . 366: return nil, errors.Wrap(err, "error validating block state") | |
. . 367: } | |
. . 368: | |
. 1.11mins 369: receipts, err := c.processor.ProcessBlock(ctx, cpySt, vms, blk, ancestors) | |
. . 370: if err != nil { | |
. . 371: return nil, errors.Wrap(err, "error validating block state") | |
. . 372: } | |
. . 373: // TODO: check that receipts actually match | |
. . 374: if len(receipts) != len(blk.MessageReceipts) { | |
. . 375: return nil, fmt.Errorf("found invalid message receipts: %v %v", receipts, blk.MessageReceipts) | |
. . 376: } | |
. . 377: | |
. 2.31s 378: outCid, err := cpySt.Flush(ctx) | |
. . 379: if err != nil { | |
. . 380: return nil, errors.Wrap(err, "error validating block state") | |
. . 381: } | |
. . 382: if !outCid.Equals(blk.StateRoot) { | |
. . 383: return nil, ErrStateRootMismatch | |
. . 384: } | |
. . 385: } | |
. . 386: if len(ts) == 1 { // block validation state == aggregate parent state | |
. . 387: return cpySt, nil | |
. . 388: } | |
. . 389: // multiblock tipsets require reapplying messages to get aggregate state | |
. . 390: // NOTE: It is possible to optimize further by applying block validation | |
. . 391: // in sorted order to reuse first block transitions as the starting state | |
. . 392: // for the tipSetProcessor. | |
. 19.79s 393: _, err := c.processor.ProcessTipSet(ctx, st, vms, ts, ancestors) | |
. . 394: if err != nil { | |
. . 395: return nil, errors.Wrap(err, "error validating tipset") | |
. . 396: } | |
. . 397: return st, nil | |
. . 398:} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ROUTINE ======================== github.com/filecoin-project/go-filecoin/consensus.(*DefaultProcessor).ProcessBlock in /home/frrist/src/github.com/filecoin-project/go-filecoin/consensus/processor.go | |
0 1.11mins (flat, cum) 20.32% of Total | |
. . 108: dur := pbsw.Stop(ctx) | |
. . 109: log.Infof("[TIMER] DefaultProcessor.ProcessBlock BlkCID: %s - elapsed time: %s", blk.Cid(), dur) | |
. . 110: }() | |
. . 111: | |
. . 112: // find miner's owner address | |
. 650ms 113: minerOwnerAddr, err := minerOwnerAddress(ctx, st, vms, blk.Miner) | |
. . 114: if err != nil { | |
. . 115: return nil, err | |
. . 116: } | |
. . 117: | |
. . 118: bh := types.NewBlockHeight(uint64(blk.Height)) | |
. 1.10mins 119: res, faultErr := p.ApplyMessagesAndPayRewards(ctx, st, vms, blk.Messages, minerOwnerAddr, bh, ancestors) | |
. . 120: if faultErr != nil { | |
. . 121: return emptyResults, faultErr | |
. . 122: } | |
. . 123: if len(res.PermanentErrors) > 0 { | |
. . 124: return emptyResults, res.PermanentErrors[0] | |
. . 125: } | |
. . 126: if len(res.TemporaryErrors) > 0 { | |
. . 127: return emptyResults, res.TemporaryErrors[0] | |
. . 128: } | |
. 30ms 129: return res.Results, nil | |
. . 130:} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ROUTINE ======================== github.com/filecoin-project/go-filecoin/consensus.(*DefaultProcessor).ApplyMessagesAndPayRewards in /home/frrist/src/github.com/filecoin-project/go-filecoin/consensus/processor.go | |
0 1.42mins (flat, cum) 25.99% of Total | |
. . 528:func (p *DefaultProcessor) ApplyMessagesAndPayRewards(ctx context.Context, st state.Tree, vms vm.StorageMap, messages []*types.SignedMessage, minerOwnerAddr address.Address, bh *types.BlockHeight, ancestors []types.TipSet) (ApplyMessagesResponse, error) { | |
. . 529: var emptyRet ApplyMessagesResponse | |
. . 530: var ret ApplyMessagesResponse | |
. . 531: | |
. . 532: // transfer block reward to miner's owner from network address. | |
. 30ms 533: if err := p.blockRewarder.BlockReward(ctx, st, minerOwnerAddr); err != nil { | |
. . 534: return ApplyMessagesResponse{}, err | |
. . 535: } | |
. . 536: | |
. . 537: gasTracker := vm.NewGasTracker() | |
. . 538: | |
. . 539: // process all messages | |
. . 540: for _, smsg := range messages { | |
. 1.42mins 541: r, err := p.ApplyMessage(ctx, st, vms, smsg, minerOwnerAddr, bh, gasTracker, ancestors) | |
. . 542: // If the message should not have been in the block, bail somehow. | |
. . 543: switch { | |
. . 544: case errors.IsFault(err): | |
. . 545: return emptyRet, err | |
. . 546: case errors.IsApplyErrorPermanent(err): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ROUTINE ======================== github.com/filecoin-project/go-filecoin/consensus.(*DefaultProcessor).ApplyMessage in /home/frrist/src/github.com/filecoin-project/go-filecoin/consensus/processor.go | |
0 1.42mins (flat, cum) 25.98% of Total | |
. . 269:// - everything else: successfully applied (include, keep changes) | |
. . 270:// | |
. . 271:func (p *DefaultProcessor) ApplyMessage(ctx context.Context, st state.Tree, vms vm.StorageMap, msg *types.SignedMessage, minerOwnerAddr address.Address, bh *types.BlockHeight, gasTracker *vm.GasTracker, ancestors []types.TipSet) (*ApplicationResult, error) { | |
. . 272: | |
. . 273: // used for log timer call below | |
. 260ms 274: msgCid, err := msg.Cid() | |
. . 275: if err != nil { | |
. . 276: return nil, errors.FaultErrorWrap(err, "could not get message cid") | |
. . 277: } | |
. . 278: | |
. . 279: amsw := amTimer.Start(ctx) | |
. . 280: defer func() { | |
. . 281: dur := amsw.Stop(ctx) | |
. . 282: log.Infof("[TIMER] DefaultProcessor.ApplyMessage CID: %s - elapsed time: %s", msgCid.String(), dur) | |
. . 283: }() | |
. . 284: | |
. . 285: cachedStateTree := state.NewCachedStateTree(st) | |
. . 286: | |
. 1.41mins 287: r, err := p.attemptApplyMessage(ctx, cachedStateTree, vms, msg, bh, gasTracker, ancestors) | |
. . 288: if err == nil { | |
. 70ms 289: err = cachedStateTree.Commit(ctx) | |
. . 290: if err != nil { | |
. . 291: return nil, errors.FaultErrorWrap(err, "could not commit state tree") | |
. . 292: } | |
. . 293: } else if errors.IsFault(err) { | |
. . 294: return nil, err | |
. . 295: } else if !errors.ShouldRevert(err) { | |
. . 296: return nil, errors.NewFaultError("someone is a bad programmer: only return revert and fault errors") | |
. . 297: } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ROUTINE ======================== github.com/filecoin-project/go-filecoin/consensus.(*DefaultProcessor).attemptApplyMessage in /home/frrist/src/github.com/filecoin-project/go-filecoin/consensus/processor.go | |
0 1.41mins (flat, cum) 25.74% of Total | |
. . 438: ExitCode: errors.CodeError(err), | |
. . 439: GasAttoFIL: types.ZeroAttoFIL, | |
. . 440: }, err | |
. . 441: } | |
. . 442: | |
. 210ms 443: fromActor, err := st.GetActor(ctx, msg.From) | |
. . 444: if state.IsActorNotFoundError(err) { | |
. . 445: return &types.MessageReceipt{ | |
. . 446: ExitCode: errors.CodeError(err), | |
. . 447: GasAttoFIL: types.ZeroAttoFIL, | |
. . 448: }, errFromAccountNotFound | |
. . 449: } else if err != nil { | |
. . 450: return nil, errors.FaultErrorWrapf(err, "failed to get From actor %s", msg.From) | |
. . 451: } | |
. . 452: | |
. 1.92s 453: err = p.signedMessageValidator.Validate(ctx, msg, fromActor) | |
. . 454: if err != nil { | |
. . 455: return &types.MessageReceipt{ | |
. . 456: ExitCode: errors.CodeError(err), | |
. . 457: GasAttoFIL: types.ZeroAttoFIL, | |
. . 458: }, err | |
. . 459: } | |
. . 460: | |
. . 461: // Processing an external message from an empty actor upgrades it to an account actor. | |
. . 462: if fromActor.Empty() { | |
. . 463: err := account.UpgradeActor(fromActor) | |
. . 464: if err != nil { | |
. . 465: return nil, errors.FaultErrorWrap(err, "failed to upgrade empty actor") | |
. . 466: } | |
. . 467: } | |
. . 468: | |
. 220ms 469: toActor, err := st.GetOrCreateActor(ctx, msg.To, func() (*actor.Actor, error) { | |
. . 470: // Addresses are deterministic so sending a message to a non-existent address must not install an actor, | |
. . 471: // else actors could be installed ahead of address activation. So here we create the empty, upgradable | |
. . 472: // actor to collect any balance that may be transferred. | |
. . 473: return &actor.Actor{}, nil | |
. . 474: }) | |
. . 475: if err != nil { | |
. . 476: return nil, errors.FaultErrorWrap(err, "failed to get To actor") | |
. . 477: } | |
. . 478: | |
. . 479: vmCtxParams := vm.NewContextParams{ | |
. . 480: From: fromActor, | |
. . 481: To: toActor, | |
. . 482: Message: &msg.Message, | |
. . 483: State: st, | |
. . 484: StorageMap: store, | |
. . 485: GasTracker: gasTracker, | |
. . 486: BlockHeight: bh, | |
. . 487: Ancestors: ancestors, | |
. . 488: } | |
. 10ms 489: vmCtx := vm.NewVMContext(vmCtxParams) | |
. . 490: | |
. 1.37mins 491: ret, exitCode, vmErr := vm.Send(ctx, vmCtx) | |
. . 492: if errors.IsFault(vmErr) { | |
. . 493: return nil, vmErr | |
. . 494: } | |
. . 495: | |
. . 496: // compute gas charge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ROUTINE ======================== github.com/filecoin-project/go-filecoin/vm.Send in /home/frrist/src/github.com/filecoin-project/go-filecoin/vm/vm.go | |
0 1.43mins (flat, cum) 26.04% of Total | |
. . 16:// will always satisfy either ShouldRevert() or IsFault(). | |
. . 17:func Send(ctx context.Context, vmCtx *Context) ([][]byte, uint8, error) { | |
. . 18: deps := sendDeps{ | |
. . 19: transfer: Transfer, | |
. . 20: } | |
. 1.43mins 21: return send(ctx, deps, vmCtx) | |
. . 22:} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ROUTINE ======================== github.com/filecoin-project/go-filecoin/vm.send in /home/frrist/src/github.com/filecoin-project/go-filecoin/vm/vm.go | |
0 1.43mins (flat, cum) 26.04% of Total | |
. . 26:} | |
. . 27: | |
. . 28:// send executes a message pass inside the VM. It exists alongside Send so that we can inject its dependencies during test. | |
. . 29:func send(ctx context.Context, deps sendDeps, vmCtx *Context) ([][]byte, uint8, error) { | |
. . 30: if vmCtx.message.Value != nil { | |
. 10ms 31: if err := deps.transfer(vmCtx.from, vmCtx.to, vmCtx.message.Value); err != nil { | |
. . 32: if errors.ShouldRevert(err) { | |
. . 33: return nil, err.(*errors.RevertError).Code(), err | |
. . 34: } | |
. . 35: return nil, 1, err | |
. . 36: } | |
. . 37: } | |
. . 38: | |
. . 39: if vmCtx.message.Method == "" { | |
. . 40: // if only tokens are transferred there is no need for a method | |
. . 41: // this means we can shortcircuit execution | |
. . 42: return nil, 0, nil | |
. . 43: } | |
. . 44: | |
. . 45: toExecutable, err := vmCtx.state.GetBuiltinActorCode(vmCtx.to.Code) | |
. . 46: if err != nil { | |
. . 47: return nil, errors.ErrNoActorCode, errors.Errors[errors.ErrNoActorCode] | |
. . 48: } | |
. . 49: | |
. . 50: if !toExecutable.Exports().Has(vmCtx.message.Method) { | |
. . 51: return nil, 1, errors.Errors[errors.ErrMissingExport] | |
. . 52: } | |
. . 53: | |
. 1.43mins 54: r, code, err := actor.MakeTypedExport(toExecutable, vmCtx.message.Method)(vmCtx) | |
. . 55: if r != nil { | |
. 10ms 56: var rv [][]byte | |
. 30ms 57: err = cbor.DecodeInto(r, &rv) | |
. . 58: if err != nil { | |
. . 59: return nil, 1, errors.NewRevertErrorf("method return doesn't decode as array: %s", err) | |
. . 60: } | |
. . 61: return rv, code, err | |
. . 62: } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Method | # of Messages | % | | |
|---------------|---------------|-------| | |
|"createChannel"| 454231 | 69.2% | | |
|"commitSector" | 169065 | 25.7% | | |
|"" | 31223 | 4.4% | | |
|"addAsk" | 637 | | |
|"createMiner" | 451 | | |
|"submitPoSt" | 179 | | |
|"reclaim" | 10 | | |
|"updatePeerID" | 8 | | |
|"redeem" | 1 | | |
-------------------------------------------------------- | |
Obtained by: | |
$ go-filecoin chain ls --enc=json > chain.json | |
$ jq '.[].messages[].meteredMessage.message' chain.json | jq '.method' > chainMethods.dat | |
$ rg $METHOD chainMethods.dat | wq -l | |
** excel ** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ROUTINE ======================== github.com/filecoin-project/go-filecoin/actor/builtin/paymentbroker.(*Actor).CreateChannel in /home/frrist/src/github.com/filecoin-project/go-filecoin/actor/builtin/paymentbroker/paymentbroker.go | |
0 46s (flat, cum) 13.99% of Total | |
. . 124: if err := vmctx.Charge(actor.DefaultGasCost); err != nil { | |
. . 125: return nil, exec.ErrInsufficientGas, errors.RevertErrorWrap(err, "Insufficient gas") | |
. . 126: } | |
. . 127: | |
. . 128: // require that from account be an account actor to ensure nonce is a valid id | |
. 10ms 129: if !vmctx.IsFromAccountActor() { | |
. . 130: return nil, errors.CodeError(Errors[ErrNonAccountActor]), Errors[ErrNonAccountActor] | |
. . 131: } | |
. . 132: | |
. . 133: ctx := context.Background() | |
. . 134: storage := vmctx.Storage() | |
. . 135: payerAddress := vmctx.Message().From | |
. . 136: channelID := types.NewChannelID(uint64(vmctx.Message().Nonce)) | |
. . 137: | |
. 45.99s 138: err := withPayerChannels(ctx, storage, payerAddress, func(byChannelID exec.Lookup) error { | |
. . 139: // check to see if payment channel is duplicate | |
. . 140: _, err := byChannelID.Find(ctx, channelID.KeyString()) | |
. . 141: if err != hamt.ErrNotFound { // we expect to not find the payment channel | |
. . 142: if err == nil { | |
. . 143: return Errors[ErrDuplicateChannel] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ROUTINE ======================== github.com/filecoin-project/go-filecoin/actor/builtin/paymentbroker.withPayerChannels.func1 in /home/frrist/src/github.com/filecoin-project/g-filecoin/actor/builtin/paymentbroker/paymentbroker.go | |
20ms 39.28s (flat, cum) 11.95% of Total | |
. . 566: data = append(data, separator) | |
. . 567: return append(data, validAt.Bytes()...) | |
. . 568:} | |
. . 569: | |
. . 570:func withPayerChannels(ctx context.Context, storage exec.Storage, payer address.Address, f func(exec.Lookup) error) error { | |
10ms 10ms 571: stateCid, err := actor.WithLookup(ctx, storage, storage.Head(), func(byPayer exec.Lookup) error { | |
. 12.89s 572: byChannelLookup, err := findByChannelLookup(ctx, storage, byPayer, payer) | |
. . 573: if err != nil { | |
. . 574: return err | |
. . 575: } | |
. . 576: | |
. . 577: // run inner function | |
. 180ms 578: err = f(byChannelLookup) | |
. . 579: if err != nil { | |
. . 580: return err | |
. . 581: } | |
. . 582: | |
. . 583: // commit channel lookup | |
10ms 26.13s 584: commitedCID, err := byChannelLookup.Commit(ctx) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Total: 5.48mins | |
ROUTINE ======================== github.com/filecoin-project/go-filecoin/actor.(*lookup).Commit in /home/frrist/src/github.com/filecoin-project/go-filecoin/actor/storage.go | |
0 28.38s (flat, cum) 8.63% of Total | |
. . 194: return l.n.Delete(ctx, k) | |
. . 195:} | |
. . 196: | |
. . 197:// Commit ensures all data in the tree is flushed to storage and returns the cid of the head node. | |
. . 198:func (l *lookup) Commit(ctx context.Context) (cid.Cid, error) { | |
. 120ms 199: if err := l.n.Flush(ctx); err != nil { | |
. . 200: return cid.Undef, err | |
. . 201: } | |
. . 202: | |
. 28.26s 203: return l.s.Put(l.n) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ROUTINE ======================== github.com/filecoin-project/go-filecoin/vm.Storage.Put in /home/frrist/src/github.com/filecoin-project/go-filecoin/vm/storage.go | |
0 31.16s (flat, cum) 9.48% of Total | |
. . 110: // optimize putting blocks | |
. . 111: nd, err = cbor.DecodeBlock(blk) | |
. . 112: } else if bytes, ok := v.([]byte); ok { | |
. . 113: nd, err = cbor.Decode(bytes, types.DefaultHashFunction, -1) | |
. . 114: } else { | |
. 31.16s 115: nd, err = cbor.WrapObject(v, types.DefaultHashFunction, -1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ROUTINE ======================== gx/ipfs/QmcZLyosDwMKdB6NLRsiss9HXzDPhVhhRtPy67JFKTDQDX/go-ipld-cbor.WrapObject in /home/frrist/src/gx/ipfs/QmcZLyosDwMKdB6NLRsiss9HXzDPhVhhRtPy67JFKTDQDX/go-ipld-cbor/node.go | |
10ms 38.28s (flat, cum) 11.64% of Total | |
. . 108: return unmarshaller.Unmarshal(b, v) | |
. . 109:} | |
. . 110: | |
. . 111:// WrapObject converts an arbitrary object into a Node. | |
. . 112:func WrapObject(m interface{}, mhType uint64, mhLen int) (*Node, error) { | |
. 11.80s 113: data, err := marshaller.Marshal(m) | |
. . 114: if err != nil { | |
. . 115: return nil, err | |
. . 116: } | |
. . 117: | |
. . 118: var obj interface{} | |
. 23.28s 119: err = cloner.Clone(m, &obj) | |
. . 120: if err != nil { | |
. . 121: return nil, err | |
. . 122: } | |
. . 123: | |
. . 124: if mhType == math.MaxUint64 { | |
. . 125: mhType = mh.SHA2_256 | |
. . 126: } | |
. . 127: | |
. 440ms 128: hash, err := mh.Sum(data, mhType, mhLen) | |
. . 129: if err != nil { | |
. . 130: return nil, err | |
. . 131: } | |
. . 132: c := cid.NewCidV1(cid.DagCBOR, hash) | |
. . 133: | |
. . 134: block, err := blocks.NewBlockWithCid(data, c) | |
. . 135: if err != nil { | |
. . 136: // TODO: Shouldn't this just panic? | |
. . 137: return nil, err | |
. . 138: } | |
. . 139: // No need to deserialize. We can just deep copy. | |
10ms 2.76s 140: return newObject(block, obj) | |
. . 141:} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ROUTINE ======================== github.com/filecoin-project/go-filecoin/chain.(*DefaultStore).GetBlock in /home/frrist/src/github.com/filecoin-project/go-filecoin/chain/default_store.go | |
30ms 2.33mins (flat, cum) 42.52% of Total | |
. . 263: return blocks, nil | |
. . 264:} | |
. . 265: | |
. . 266:// GetBlock retrieves a block by cid. | |
. . 267:func (store *DefaultStore) GetBlock(ctx context.Context, c cid.Cid) (*types.Block, error) { | |
20ms 5.74s 268: data, err := store.bsPriv.Get(c) | |
. . 269: if err != nil { | |
. . 270: return nil, errors.Wrapf(err, "failed to get block %s", c.String()) | |
. . 271: } | |
10ms 2.23mins 272: return types.DecodeBlock(data.RawData()) | |
. . 273:} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(pprof) top 20 -cum | |
Showing nodes accounting for 9.62s, 2.93% of 328.73s total | |
Dropped 1481 nodes (cum <= 1.64s) | |
Showing top 20 nodes out of 294 | |
flat flat% sum% cum cum% | |
1.14s 0.35% 0.35% 187.84s 57.14% gx/ipfs/QmdBzoMxsBpojBfN1cv5GnKtB7sfYBMoLH7p9qSyEVYXcu/refmt/shared.TokenPump.Run | |
0.03s 0.0091% 0.36% 152.68s 46.45% gx/ipfs/QmdBzoMxsBpojBfN1cv5GnKtB7sfYBMoLH7p9qSyEVYXcu/refmt/cbor.(*Unmarshaller).Unmarshal | |
0 0% 0.36% 146.46s 44.55% github.com/filecoin-project/go-filecoin/chain.(*DefaultStore).BlockHistory.func1 | |
0.03s 0.0091% 0.37% 146.46s 44.55% github.com/filecoin-project/go-filecoin/chain.(*DefaultStore).walkChain | |
0.03s 0.0091% 0.37% 139.79s 42.52% github.com/filecoin-project/go-filecoin/chain.(*DefaultStore).GetBlock | |
0 0% 0.37% 138.96s 42.27% gx/ipfs/QmcZLyosDwMKdB6NLRsiss9HXzDPhVhhRtPy67JFKTDQDX/go-ipld-cbor.DecodeInto | |
0.01s 0.003% 0.38% 138.96s 42.27% gx/ipfs/QmcZLyosDwMKdB6NLRsiss9HXzDPhVhhRtPy67JFKTDQDX/go-ipld-cbor/encoding.(*PooledUnmarshaller).Unmarshal | |
0.01s 0.003% 0.38% 138.87s 42.24% gx/ipfs/QmcZLyosDwMKdB6NLRsiss9HXzDPhVhhRtPy67JFKTDQDX/go-ipld-cbor/encoding.(*Unmarshaller).Unmarshal | |
0.04s 0.012% 0.39% 138.71s 42.20% gx/ipfs/QmcZLyosDwMKdB6NLRsiss9HXzDPhVhhRtPy67JFKTDQDX/go-ipld-cbor/encoding.(*Unmarshaller).Decode | |
0 0% 0.39% 134.03s 40.77% github.com/filecoin-project/go-filecoin/types.DecodeBlock | |
0.41s 0.12% 0.52% 126.53s 38.49% reflect.Value.Call | |
4.92s 1.50% 2.01% 126.02s 38.34% reflect.Value.call | |
2.99s 0.91% 2.92% 117.88s 35.86% gx/ipfs/QmdBzoMxsBpojBfN1cv5GnKtB7sfYBMoLH7p9qSyEVYXcu/refmt/obj.(*Unmarshaller).Step | |
0 0% 2.92% 102.01s 31.03% gx/ipfs/QmcNGX5RaxPPCYwa6yGXM1EcUbrreTTinixLcYGmMwf1sx/go-libp2p/p2p/host/basic.(*BasicHost).SetStreamHandler.func1 | |
0 0% 2.92% 101.83s 30.98% github.com/filecoin-project/go-filecoin/chain.(*DefaultSyncer).HandleNewBlocks | |
0.01s 0.003% 2.93% 101.83s 30.98% github.com/filecoin-project/go-filecoin/chain.(*DefaultSyncer).syncOne | |
0 0% 2.93% 101.83s 30.98% github.com/filecoin-project/go-filecoin/node.(*Node).Start.func1 | |
0 0% 2.93% 101.83s 30.98% github.com/filecoin-project/go-filecoin/protocol/hello.(*Handler).handleNewStream | |
0 0% 2.93% 101.83s 30.98% github.com/filecoin-project/go-filecoin/protocol/hello.(*Handler).processHelloMessage | |
0 0% 2.93% 93.30s 28.38% github.com/filecoin-project/go-filecoin/consensus.(*Expected).RunStateTransition |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Link to data used to generate:
https://ipfs.io/ipfs/QmceatjdZAJQxvfu5vg9qBv1kRTyeMbgWNVf4tNSEgyGzb/profileFilecoin