def main(): import argparse parser = argparse.ArgumentParser() parser.add_argument('--transfers', default=10000, type=int) parser.add_argument('--max-locked', default=100, type=int) parser.add_argument('-p', '--profile', default=False, action='store_true') args = parser.parse_args() if args.profile: import GreenletProfiler GreenletProfiler.set_clock_type('cpu') GreenletProfiler.start() transfer_speed( num_transfers=args.transfers, max_locked=args.max_locked, ) if args.profile: GreenletProfiler.stop() stats = GreenletProfiler.get_func_stats() pstats = GreenletProfiler.convert2pstats(stats) print_serialization(pstats) print_slow_path(pstats) print_slow_function(pstats) pstats.sort_stats('time').print_stats()
def main(): import argparse parser = argparse.ArgumentParser() parser.add_argument('--transfers', default=100, type=int) parser.add_argument('--nodes', default=10, type=int) parser.add_argument('--tokens', default=1, type=int) parser.add_argument('--channels-per-node', default=2, type=int) parser.add_argument('-p', '--profile', default=False, action='store_true') parser.add_argument('--pdb', default=False, action='store_true') parser.add_argument('--throughput', dest='throughput', action='store_true', default=True) parser.add_argument('--latency', dest='throughput', action='store_false') parser.add_argument('--log', action='store_true', default=False) args = parser.parse_args() if args.log: slogging.configure(':DEBUG') if args.profile: import GreenletProfiler GreenletProfiler.set_clock_type('cpu') GreenletProfiler.start() tokens = [ sha3('token:{}'.format(number))[:20] for number in range(args.tokens) ] amount = 10 apps = setup_apps( amount, tokens, args.transfers, args.nodes, args.channels_per_node, ) if args.pdb: from pyethapp.utils import enable_greenlet_debugger enable_greenlet_debugger() try: if args.throughput: test_throughput(apps, tokens, args.transfers, amount) else: test_latency(apps, tokens, args.transfers, amount) except: import pdb pdb.xpm() else: if args.throughput: test_throughput(apps, tokens, args.transfers, amount) else: test_latency(apps, tokens, args.transfers, amount) if args.profile: GreenletProfiler.stop() stats = GreenletProfiler.get_func_stats() pstats = GreenletProfiler.convert2pstats(stats) print_serialization(pstats) print_slow_path(pstats) print_slow_function(pstats) pstats.sort_stats('time').print_stats()
def main(): import argparse parser = argparse.ArgumentParser() parser.add_argument('--transfers', default=100, type=int) parser.add_argument('--nodes', default=10, type=int) parser.add_argument('--assets', default=1, type=int) parser.add_argument('--channels-per-node', default=2, type=int) parser.add_argument('-p', '--profile', default=False, action='store_true') parser.add_argument('--pdb', default=False, action='store_true') parser.add_argument('--throughput', dest='throughput', action='store_true', default=True) parser.add_argument('--latency', dest='throughput', action='store_false') parser.add_argument('--log', action='store_true', default=False) args = parser.parse_args() if args.log: slogging.configure(':DEBUG') if args.profile: import GreenletProfiler GreenletProfiler.set_clock_type('cpu') GreenletProfiler.start() assets = [ sha3('asset:{}'.format(number))[:20] for number in range(args.assets) ] amount = 10 apps = setup_apps( amount, assets, args.transfers, args.nodes, args.channels_per_node, ) if args.pdb: from pyethapp.utils import enable_greenlet_debugger enable_greenlet_debugger() try: if args.throughput: test_throughput(apps, assets, args.transfers, amount) else: test_latency(apps, assets, args.transfers, amount) except: import pdb pdb.xpm() else: if args.throughput: test_throughput(apps, assets, args.transfers, amount) else: test_latency(apps, assets, args.transfers, amount) if args.profile: GreenletProfiler.stop() stats = GreenletProfiler.get_func_stats() pstats = GreenletProfiler.convert2pstats(stats) print_serialization(pstats) print_slow_path(pstats) print_slow_function(pstats) pstats.sort_stats('time').print_stats()