forked from 0xPolygonHermez/zkevm-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: fixing things and adding make entry for the e2e test.
Signed-off-by: Nikolay Nedkov <[email protected]>
- Loading branch information
Showing
14 changed files
with
130 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 41 additions & 13 deletions
54
test/benchmarks/sequencer/scripts/common/results/print.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,56 @@ | ||
package results | ||
|
||
import ( | ||
"fmt" | ||
"time" | ||
|
||
"github.com/0xPolygonHermez/zkevm-node/log" | ||
"github.com/0xPolygonHermez/zkevm-node/test/benchmarks/sequencer/common/params" | ||
"github.com/ethereum/go-ethereum/core/types" | ||
"github.com/ethereum/go-ethereum/ethclient" | ||
) | ||
|
||
// Print prints the results of the benchmark | ||
func Print(elapsed time.Duration) { | ||
func Print(client *ethclient.Client, elapsed time.Duration, txs []*types.Transaction) { | ||
// calculate the total gas used | ||
var totalGas uint64 | ||
for _, tx := range txs { | ||
// Fetch the transaction receipt | ||
receipt, err := client.TransactionReceipt(params.Ctx, tx.Hash()) | ||
if err != nil { | ||
log.Error("Unable to fetch transaction receipt", "error", err) | ||
continue | ||
} | ||
|
||
totalGas += receipt.GasUsed | ||
} | ||
|
||
// calculate the average gas used per transaction | ||
var avgGas uint64 | ||
if len(txs) > 0 { | ||
avgGas = totalGas / uint64(len(txs)) | ||
} | ||
|
||
// calculate the gas per second | ||
gasPerSecond := float64(len(txs)*int(avgGas)) / elapsed.Seconds() | ||
|
||
// Print results | ||
log.Info("##########") | ||
log.Info("# Result #") | ||
log.Info("##########") | ||
log.Infof("Total time took for the sequencer to select all txs from the pool: %v", elapsed) | ||
log.Infof("Number of txs sent: %d", params.NumberOfOperations) | ||
log.Infof("Txs per second: %f", float64(params.NumberOfOperations)/elapsed.Seconds()) | ||
fmt.Println("##########") | ||
fmt.Println("# Result #") | ||
fmt.Println("##########") | ||
fmt.Printf("Total time took for the sequencer to select all txs from the pool: %v\n", elapsed) | ||
fmt.Printf("Number of operations sent: %d\n", params.NumberOfOperations) | ||
fmt.Printf("Txs per second: %f\n", float64(params.NumberOfOperations)/elapsed.Seconds()) | ||
fmt.Printf("Average gas used per transaction: %d\n", avgGas) | ||
fmt.Printf("Total Gas: %d\n", totalGas) | ||
fmt.Printf("Gas per second: %f\n", gasPerSecond) | ||
} | ||
|
||
func PrintUniswapDeployments(deployments time.Duration, count uint64) { | ||
log.Info("#######################") | ||
log.Info("# Uniswap Deployments #") | ||
log.Info("#######################") | ||
log.Infof("Total time took for the sequencer to deploy all contracts: %v", deployments) | ||
log.Infof("Number of txs sent: %d", count) | ||
log.Infof("Txs per second: %f", float64(count)/deployments.Seconds()) | ||
fmt.Println("#######################") | ||
fmt.Println("# Uniswap Deployments #") | ||
fmt.Println("#######################") | ||
fmt.Printf("Total time took for the sequencer to deploy all contracts: %v\n", deployments) | ||
fmt.Printf("Number of txs sent: %d\n", count) | ||
fmt.Printf("Txs per second: %f\n", float64(count)/deployments.Seconds()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.