Add aggregate number, add number of bytes for storage calls

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera
2020-06-11 22:25:24 +02:00
parent c90d35869b
commit 071ddf6563
2 changed files with 25 additions and 3 deletions
+23 -1
View File
@@ -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>")