FVM: record message applied metrics
This commit is contained in:
parent
e950421e87
commit
279b1f4317
@ -9,6 +9,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
"sync"
|
"sync"
|
||||||
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
@ -419,6 +420,7 @@ func NewDebugFVM(ctx context.Context, opts *VMOpts) (*FVM, error) {
|
|||||||
|
|
||||||
func (vm *FVM) ApplyMessage(ctx context.Context, cmsg types.ChainMsg) (*ApplyRet, error) {
|
func (vm *FVM) ApplyMessage(ctx context.Context, cmsg types.ChainMsg) (*ApplyRet, error) {
|
||||||
start := build.Clock.Now()
|
start := build.Clock.Now()
|
||||||
|
defer atomic.AddUint64(&StatApplied, 1)
|
||||||
vmMsg := cmsg.VMMessage()
|
vmMsg := cmsg.VMMessage()
|
||||||
msgBytes, err := vmMsg.Serialize()
|
msgBytes, err := vmMsg.Serialize()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -482,6 +484,7 @@ func (vm *FVM) ApplyMessage(ctx context.Context, cmsg types.ChainMsg) (*ApplyRet
|
|||||||
|
|
||||||
func (vm *FVM) ApplyImplicitMessage(ctx context.Context, cmsg *types.Message) (*ApplyRet, error) {
|
func (vm *FVM) ApplyImplicitMessage(ctx context.Context, cmsg *types.Message) (*ApplyRet, error) {
|
||||||
start := build.Clock.Now()
|
start := build.Clock.Now()
|
||||||
|
defer atomic.AddUint64(&StatApplied, 1)
|
||||||
cmsg.GasLimit = math.MaxInt64 / 2
|
cmsg.GasLimit = math.MaxInt64 / 2
|
||||||
vmMsg := cmsg.VMMessage()
|
vmMsg := cmsg.VMMessage()
|
||||||
msgBytes, err := vmMsg.Serialize()
|
msgBytes, err := vmMsg.Serialize()
|
||||||
|
@ -45,12 +45,6 @@ var (
|
|||||||
gasOnActorExec = newGasCharge("OnActorExec", 0, 0)
|
gasOnActorExec = newGasCharge("OnActorExec", 0, 0)
|
||||||
)
|
)
|
||||||
|
|
||||||
// stat counters
|
|
||||||
var (
|
|
||||||
StatSends uint64
|
|
||||||
StatApplied uint64
|
|
||||||
)
|
|
||||||
|
|
||||||
// ResolveToKeyAddr returns the public key type of address (`BLS`/`SECP256K1`) of an account actor identified by `addr`.
|
// ResolveToKeyAddr returns the public key type of address (`BLS`/`SECP256K1`) of an account actor identified by `addr`.
|
||||||
func ResolveToKeyAddr(state types.StateTree, cst cbor.IpldStore, addr address.Address) (address.Address, error) {
|
func ResolveToKeyAddr(state types.StateTree, cst cbor.IpldStore, addr address.Address) (address.Address, error) {
|
||||||
if addr.Protocol() == address.BLS || addr.Protocol() == address.SECP256K1 {
|
if addr.Protocol() == address.BLS || addr.Protocol() == address.SECP256K1 {
|
||||||
|
@ -11,6 +11,12 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// stat counters
|
||||||
|
var (
|
||||||
|
StatSends uint64
|
||||||
|
StatApplied uint64
|
||||||
|
)
|
||||||
|
|
||||||
type Interface interface {
|
type Interface interface {
|
||||||
// Applies the given message onto the VM's current state, returning the result of the execution
|
// Applies the given message onto the VM's current state, returning the result of the execution
|
||||||
ApplyMessage(ctx context.Context, cmsg types.ChainMsg) (*ApplyRet, error)
|
ApplyMessage(ctx context.Context, cmsg types.ChainMsg) (*ApplyRet, error)
|
||||||
|
Loading…
Reference in New Issue
Block a user