Make gas traces smaller, strip callers in import-bench

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera 2020-06-25 16:46:50 +02:00
parent cae24a226b
commit 10c4fae8c0
No known key found for this signature in database
GPG Key ID: 9A9AF56F8B3879BA
3 changed files with 26 additions and 10 deletions

View File

@ -21,16 +21,16 @@ type ExecutionTrace struct {
type GasTrace struct { type GasTrace struct {
Name string Name string
Location []Loc Location []Loc `json:"loc"`
TotalGas int64 TotalGas int64 `json:"tg"`
ComputeGas int64 ComputeGas int64 `json:"cg"`
StorageGas int64 StorageGas int64 `json:"sg"`
TotalVirtualGas int64 TotalVirtualGas int64 `json:"vtg"`
VirtualComputeGas int64 VirtualComputeGas int64 `json:"vcg"`
VirtualStorageGas int64 VirtualStorageGas int64 `json:"vsg"`
TimeTaken time.Duration TimeTaken time.Duration `json:"tt"`
Extra interface{} `json:",omitempty"` Extra interface{} `json:"ex,omitempty"`
Callers []uintptr `json:"-"` Callers []uintptr `json:"-"`
} }

View File

@ -408,7 +408,7 @@ func (rt *Runtime) internalSend(from, to address.Address, method abi.MethodNum,
if subrt != nil { if subrt != nil {
rt.numActorsCreated = subrt.numActorsCreated rt.numActorsCreated = subrt.numActorsCreated
} }
rt.executionTrace.Subcalls = append(rt.executionTrace.Subcalls, subrt.executionTrace) //&er) rt.executionTrace.Subcalls = append(rt.executionTrace.Subcalls, subrt.executionTrace)
return ret, errSend return ret, errSend
} }

View File

@ -149,6 +149,7 @@ var importBenchCmd = &cli.Command{
if err != nil { if err != nil {
return err return err
} }
stripCallers(trace)
lastTse = &TipSetExec{ lastTse = &TipSetExec{
TipSet: cur.Key(), TipSet: cur.Key(),
@ -168,6 +169,21 @@ var importBenchCmd = &cli.Command{
}, },
} }
func walkExecutionTrace(et *types.ExecutionTrace) {
for _, gc := range et.GasCharges {
gc.Callers = nil
}
for _, sub := range et.Subcalls {
walkExecutionTrace(&sub)
}
}
func stripCallers(trace []*api.InvocResult) {
for _, t := range trace {
walkExecutionTrace(&t.ExecutionTrace)
}
}
type Invocation struct { type Invocation struct {
TipSet types.TipSetKey TipSet types.TipSetKey
Invoc *api.InvocResult Invoc *api.InvocResult