From 1968195da9aea80b3c7431dede96a8503176aa4b Mon Sep 17 00:00:00 2001 From: Jeromy Date: Tue, 2 Jun 2020 11:21:54 -0700 Subject: [PATCH 1/3] update to fixed jsonrpc library --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index d77de4589..a650d680a 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ require ( github.com/filecoin-project/go-data-transfer v0.3.0 github.com/filecoin-project/go-fil-commcid v0.0.0-20200208005934-2b8bd03caca5 github.com/filecoin-project/go-fil-markets v0.2.7 - github.com/filecoin-project/go-jsonrpc v0.1.1-0.20200520183639-7c6ee2e066b4 + github.com/filecoin-project/go-jsonrpc v0.1.1-0.20200602181149-522144ab4e24 github.com/filecoin-project/go-padreader v0.0.0-20200210211231-548257017ca6 github.com/filecoin-project/go-paramfetch v0.0.2-0.20200505180321-973f8949ea8e github.com/filecoin-project/go-statestore v0.1.0 diff --git a/go.sum b/go.sum index 4fa3bdeb7..ed91f8560 100644 --- a/go.sum +++ b/go.sum @@ -158,6 +158,8 @@ github.com/filecoin-project/go-fil-markets v0.2.7 h1:bgdK/e+xW15aVZLtdFLzAHdrx1h github.com/filecoin-project/go-fil-markets v0.2.7/go.mod h1:LI3VFHse33aU0djAmFQ8+Hg39i0J8ibAoppGu6TbgkA= github.com/filecoin-project/go-jsonrpc v0.1.1-0.20200520183639-7c6ee2e066b4 h1:H8AVYu0MV9m3CSnKMxeILMfh8xJtnqVdXfBF/qbzgu0= github.com/filecoin-project/go-jsonrpc v0.1.1-0.20200520183639-7c6ee2e066b4/go.mod h1:j6zV//WXIIY5kky873Q3iIKt/ViOE8rcijovmpxrXzM= +github.com/filecoin-project/go-jsonrpc v0.1.1-0.20200602181149-522144ab4e24 h1:Jc7vkplmZYVuaEcSXGHDwefvZIdoyyaoGDLqSr8Svms= +github.com/filecoin-project/go-jsonrpc v0.1.1-0.20200602181149-522144ab4e24/go.mod h1:j6zV//WXIIY5kky873Q3iIKt/ViOE8rcijovmpxrXzM= github.com/filecoin-project/go-padreader v0.0.0-20200210211231-548257017ca6 h1:92PET+sx1Hb4W/8CgFwGuxaKbttwY+UNspYZTvXY0vs= github.com/filecoin-project/go-padreader v0.0.0-20200210211231-548257017ca6/go.mod h1:0HgYnrkeSU4lu1p+LEOeDpFsNBssa0OGGriWdA4hvaE= github.com/filecoin-project/go-paramfetch v0.0.1/go.mod h1:fZzmf4tftbwf9S37XRifoJlz7nCjRdIrMGLR07dKLCc= From 9b867a221a2babcfc97a43b4b9f24054976ef975 Mon Sep 17 00:00:00 2001 From: Jeromy Date: Tue, 2 Jun 2020 12:53:24 -0700 Subject: [PATCH 2/3] add subcall timing to compute state output --- chain/types/execresult.go | 9 ++++++--- chain/vm/runtime.go | 8 ++++++-- cmd/lotus-storage-miner/proving.go | 3 ++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/chain/types/execresult.go b/chain/types/execresult.go index e8765f796..56f2ef143 100644 --- a/chain/types/execresult.go +++ b/chain/types/execresult.go @@ -1,9 +1,12 @@ package types +import "time" + type ExecutionResult struct { - Msg *Message - MsgRct *MessageReceipt - Error string + Msg *Message + MsgRct *MessageReceipt + Error string + Duration time.Duration Subcalls []*ExecutionResult } diff --git a/chain/vm/runtime.go b/chain/vm/runtime.go index ebaf48f59..948b0a021 100644 --- a/chain/vm/runtime.go +++ b/chain/vm/runtime.go @@ -5,6 +5,8 @@ import ( "context" "encoding/binary" "fmt" + "time" + "github.com/filecoin-project/go-address" "github.com/filecoin-project/specs-actors/actors/abi" "github.com/filecoin-project/specs-actors/actors/abi/big" @@ -366,6 +368,7 @@ func (rs *Runtime) Send(to address.Address, method abi.MethodNum, m vmr.CBORMars } func (rt *Runtime) internalSend(from, to address.Address, method abi.MethodNum, value types.BigInt, params []byte) ([]byte, aerrors.ActorError) { + start := time.Now() ctx, span := trace.StartSpan(rt.ctx, "vmc.Send") defer span.End() if span.IsRecordingEvents() { @@ -405,8 +408,9 @@ func (rt *Runtime) internalSend(from, to address.Address, method abi.MethodNum, } er := types.ExecutionResult{ - Msg: msg, - MsgRct: &mr, + Msg: msg, + MsgRct: &mr, + Duration: time.Since(start), } if errSend != nil { diff --git a/cmd/lotus-storage-miner/proving.go b/cmd/lotus-storage-miner/proving.go index 2b6d87062..7cfa010b9 100644 --- a/cmd/lotus-storage-miner/proving.go +++ b/cmd/lotus-storage-miner/proving.go @@ -3,6 +3,8 @@ package main import ( "bytes" "fmt" + "time" + "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain/types" lcli "github.com/filecoin-project/lotus/cli" @@ -10,7 +12,6 @@ import ( "github.com/filecoin-project/specs-actors/actors/builtin/miner" "golang.org/x/xerrors" "gopkg.in/urfave/cli.v2" - "time" ) var provingCmd = &cli.Command{ From 3595b1f8e992feab675b49a4eb550bf7331d2426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 2 Jun 2020 22:06:03 +0200 Subject: [PATCH 3/3] compute-state html: Add timing for internal executions --- cli/state.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cli/state.go b/cli/state.go index a761b8f58..102c8d0bb 100644 --- a/cli/state.go +++ b/cli/state.go @@ -1082,12 +1082,15 @@ func printInternalExecutionsHtml(trace []*types.ExecutionResult, getCode func(ad ret = `, Return
` + ret + `
` } + slow := im.Duration > 10*time.Millisecond + veryslow := im.Duration > 50*time.Millisecond + fmt.Printf(`

%s:%s

%s -> %s (%s FIL), M%d
%s -
Exit: %d%s -`, codeStr(toCode), methods[toCode][im.Msg.Method].name, im.Msg.From, im.Msg.To, types.FIL(im.Msg.Value), im.Msg.Method, params, im.MsgRct.ExitCode, im.MsgRct.ExitCode, ret) +
Took %s, Exit: %d%s +`, codeStr(toCode), methods[toCode][im.Msg.Method].name, im.Msg.From, im.Msg.To, types.FIL(im.Msg.Value), im.Msg.Method, params, slow, veryslow, im.Duration, im.MsgRct.ExitCode, im.MsgRct.ExitCode, ret) if im.MsgRct.ExitCode != 0 { fmt.Printf(`
Error:
%s
`, im.Error) }