From 3a9f1bf9a2a25fc592902eb7276f4335ce61ecb2 Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Sun, 28 Jun 2020 18:47:16 +0200 Subject: [PATCH] Revert "Try without recurson" This reverts commit 76e3663b2b1f1b58f9097f45124add4fa7718199. Signed-off-by: Jakub Sztandera --- cmd/lotus-bench/import.go | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/cmd/lotus-bench/import.go b/cmd/lotus-bench/import.go index 6caff50a7..f6b85b557 100644 --- a/cmd/lotus-bench/import.go +++ b/cmd/lotus-bench/import.go @@ -360,7 +360,6 @@ var importAnalyzeCmd = &cli.Command{ } totalTime += tse.Duration - var execStack = make([]types.ExecutionTrace, 0, 100) for _, inv := range tse.Trace { if inv.Duration > leastExpensiveInvoc { expensiveInvocs = append(expensiveInvocs, Invocation{ @@ -368,33 +367,8 @@ var importAnalyzeCmd = &cli.Command{ Invoc: inv, }) } - execStack = append(execStack, inv.ExecutionTrace) - for len(execStack) != 0 { - et := execStack[len(execStack)-1] - execStack = execStack[:len(execStack)-1] - for _, gc := range et.GasCharges { - compGas := gc.ComputeGas - if compGas == 0 { - compGas = 1 - } - - ratio := float64(compGas) / float64(gc.TimeTaken.Nanoseconds()) - ratio = 1 / ratio - if math.IsNaN(ratio) { - log.Errorf("NaN: comGas: %f, taken: %d", compGas, gc.TimeTaken.Nanoseconds()) - } - - s := chargeStats[gc.Name] - if s == nil { - s = new(stats) - chargeStats[gc.Name] = s - } - - s.AddPoint(ratio) - } - execStack = append(execStack, et.Subcalls...) - } + tallyGasCharges(chargeStats, inv.ExecutionTrace) } if len(expensiveInvocs) > 4*invocsKeep { sort.Slice(expensiveInvocs, func(i, j int) bool {