def execute(self) -> DefaultStat: total_stat = DefaultStat() for chain in get_all_chains(): val = self.as_timed_result( lambda: self.import_empty_blocks(chain, self.num_blocks)) stat = DefaultStat(caption=chain.get_vm().fork, total_blocks=self.num_blocks, total_seconds=val.duration) total_stat = total_stat.cumulate(stat) self.print_stat_line(stat) return total_stat
def execute(self) -> DefaultStat: total_stat = DefaultStat() for chain in get_all_chains(): # Perform prepartions on the chain that do not count into the # benchmark time self._setup_benchmark(chain) # Perform the actual work that is measured value = self.as_timed_result( lambda: self.mine_blocks(chain, self.num_blocks, self.num_tx)) total_gas_used, total_num_tx = value.wrapped_value stat = DefaultStat( caption=chain.get_vm().fork, total_blocks=self.num_blocks, total_tx=total_num_tx, total_seconds=value.duration, total_gas=total_gas_used, ) total_stat = total_stat.cumulate(stat) self.print_stat_line(stat) return total_stat
def run() -> None: logging.basicConfig(level=logging.INFO, format='%(message)s') logging.info(bold_green(HEADER)) logging.info(construct_evm_runtime_identifier() + "\n") if "--compile-contracts" in sys.argv: logging.info('Precompiling contracts') try: compile_contracts(get_contracts()) except OSError: logging.error( bold_red( 'Compiling contracts requires "solc" system dependency')) sys.exit(1) total_stat = DefaultStat() benchmarks = [ MineEmptyBlocksBenchmark(), ImportEmptyBlocksBenchmark(), SimpleValueTransferBenchmark(TO_EXISTING_ADDRESS_CONFIG), SimpleValueTransferBenchmark(TO_NON_EXISTING_ADDRESS_CONFIG), ERC20DeployBenchmark(), ERC20TransferBenchmark(), ERC20ApproveBenchmark(), ERC20TransferFromBenchmark(), DOSContractDeployBenchmark(), DOSContractSstoreUint64Benchmark(), DOSContractCreateEmptyContractBenchmark(), DOSContractRevertSstoreUint64Benchmark(), DOSContractRevertCreateEmptyContractBenchmark(), ] for benchmark in benchmarks: total_stat = total_stat.cumulate(benchmark.run(), increment_by_counter=True) print_final_benchmark_total_line(total_stat)
def execute(self) -> DefaultStat: total_stat = DefaultStat() num_blocks = self.config.num_blocks for chain in get_all_chains(): value = self.as_timed_result( lambda: self.mine_blocks(chain, num_blocks)) total_gas_used, total_num_tx = value.wrapped_value stat = DefaultStat( caption=chain.get_vm().fork, total_blocks=num_blocks, total_tx=total_num_tx, total_seconds=value.duration, total_gas=total_gas_used, ) total_stat = total_stat.cumulate(stat) self.print_stat_line(stat) return total_stat