Add aggregate number, add number of bytes for storage calls
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
parent
c90d35869b
commit
071ddf6563
@ -108,12 +108,12 @@ func (pl *pricelistV0) OnMethodInvocation(value abi.TokenAmount, methodNum abi.M
|
||||
|
||||
// OnIpldGet returns the gas used for storing an object
|
||||
func (pl *pricelistV0) OnIpldGet(dataSize int) GasCharge {
|
||||
return newGasCharge("OnIpldGet", pl.ipldGetBase+int64(dataSize)*pl.ipldGetPerByte, 0)
|
||||
return newGasCharge(fmt.Sprintf("OnIpldGet:%db", dataSize), pl.ipldGetBase+int64(dataSize)*pl.ipldGetPerByte, 0)
|
||||
}
|
||||
|
||||
// OnIpldPut returns the gas used for storing an object
|
||||
func (pl *pricelistV0) OnIpldPut(dataSize int) GasCharge {
|
||||
return newGasCharge("OnIpldPut", pl.ipldPutBase, int64(dataSize)*pl.ipldPutPerByte)
|
||||
return newGasCharge(fmt.Sprintf("OnIpldPut:%db", dataSize), pl.ipldPutBase, int64(dataSize)*pl.ipldPutPerByte)
|
||||
}
|
||||
|
||||
// OnCreateActor returns the gas used for creating an actor
|
||||
|
24
cli/state.go
24
cli/state.go
@ -975,7 +975,11 @@ func computeStateHtml(ts *types.TipSet, o *api.ComputeStateOutput, getCode func(
|
||||
}
|
||||
.slow-true-false { color: #660; }
|
||||
.slow-true-true { color: #f80; }
|
||||
table { font-size: 12px; }
|
||||
table {
|
||||
font-size: 12px;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
tr.sum { border-top: 1px solid black; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@ -1029,10 +1033,20 @@ func computeStateHtml(ts *types.TipSet, o *api.ComputeStateOutput, getCode func(
|
||||
}
|
||||
fmt.Printf("\n<details><summary>Gas Trace</summary><table><tr>" +
|
||||
"<th>Name</th><th>Total/Compute/Storage</th><th>Time Taken</th><th>Location</th></tr>")
|
||||
|
||||
var sumTotal, sumCompute, sumStorage int64
|
||||
var sumTime time.Duration
|
||||
for _, gc := range ir.ExecutionTrace.GasCharges {
|
||||
fmt.Printf("<tr><td>%s</td><td>%d/%d/%d</td><td>%s</td><td>%s</td></tr>",
|
||||
gc.Name, gc.TotalGas, gc.ComputeGas, gc.StorageGas, gc.TimeTaken, gc.Location)
|
||||
sumTotal += gc.TotalGas
|
||||
sumCompute += gc.ComputeGas
|
||||
sumStorage += gc.StorageGas
|
||||
sumTime += gc.TimeTaken
|
||||
}
|
||||
fmt.Printf("<tr class=\"sum\"><td>%s</td><td>%d/%d/%d</td><td>%s</td><td>%s</td></tr>",
|
||||
"<b>Sum</b>", sumTotal, sumCompute, sumStorage, sumTime, "")
|
||||
|
||||
fmt.Printf("</table></details>\n")
|
||||
|
||||
fmt.Println("<div>Execution trace:</div>")
|
||||
@ -1092,10 +1106,18 @@ func printInternalExecutionsHtml(hashName string, trace []types.ExecutionTrace,
|
||||
}
|
||||
fmt.Printf("\n<details><summary>Gas Trace</summary><table><tr>" +
|
||||
"<th>Name</th><th>Total/Compute/Storage</th><th>Time Taken</th><th>Location</th></tr>")
|
||||
var sumTotal, sumCompute, sumStorage int64
|
||||
var sumTime time.Duration
|
||||
for _, gc := range im.GasCharges {
|
||||
fmt.Printf("<tr><td>%s</td><td>%d/%d/%d</td><td>%s</td><td>%s</td></tr>",
|
||||
gc.Name, gc.TotalGas, gc.ComputeGas, gc.StorageGas, gc.TimeTaken, gc.Location)
|
||||
sumTotal += gc.TotalGas
|
||||
sumCompute += gc.ComputeGas
|
||||
sumStorage += gc.StorageGas
|
||||
sumTime += gc.TimeTaken
|
||||
}
|
||||
fmt.Printf("<tr class=\"sum\"><td>%s</td><td>%d/%d/%d</td><td>%s</td><td>%s</td></tr>",
|
||||
"<b>Sum</b>", sumTotal, sumCompute, sumStorage, sumTime, "")
|
||||
fmt.Printf("</table></details>\n")
|
||||
if len(im.Subcalls) > 0 {
|
||||
fmt.Println("<div>Subcalls:</div>")
|
||||
|
Loading…
Reference in New Issue
Block a user