From 4f959adbc8bfd7f69155f5ba160acb116e218c8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 4 May 2020 19:19:23 +0200 Subject: [PATCH] compute-state: html: Print invocation duration --- cli/state.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cli/state.go b/cli/state.go index 51e1a5655..af1b10df8 100644 --- a/cli/state.go +++ b/cli/state.go @@ -8,6 +8,7 @@ import ( "reflect" "strconv" "strings" + "time" "github.com/docker/go-units" "github.com/ipfs/go-cid" @@ -913,6 +914,8 @@ func computeStateHtml(o *api.ComputeStateOutput, getCode func(addr address.Addre .exec:hover { background: #fef; } + .slow-true-false { color: #660; } + .slow-true-true { color: #f80; } @@ -925,11 +928,14 @@ func computeStateHtml(o *api.ComputeStateOutput, getCode func(addr address.Addre return xerrors.Errorf("getting code for %s: %w", toCode, err) } + slow := ir.Duration > 10 * time.Millisecond + veryslow := ir.Duration > 50 * time.Millisecond + fmt.Printf(`
%s -> %s (%s FIL), M%d
%s:%s(%x)
-
Exit: %d, Return: %x
-`, ir.Msg.From, ir.Msg.To, types.FIL(ir.Msg.Value), ir.Msg.Method, codeStr(toCode), methods[toCode][ir.Msg.Method], ir.Msg.Params, ir.Msg.Params, ir.MsgRct.ExitCode, ir.MsgRct.ExitCode, ir.MsgRct.Return) +
Took %s, Exit: %d, Return: %x
+`, ir.Msg.From, ir.Msg.To, types.FIL(ir.Msg.Value), ir.Msg.Method, codeStr(toCode), methods[toCode][ir.Msg.Method], ir.Msg.Params, ir.Msg.Params, slow, veryslow, ir.Duration, ir.MsgRct.ExitCode, ir.MsgRct.ExitCode, ir.MsgRct.Return) if ir.MsgRct.ExitCode != 0 { fmt.Printf(`
Error:
%s
`, ir.Error) }