def main(): print("Welcome to the team manager.") the_team = Team() the_bench = Bench() while True: # Immediately converting the input to lower() lets the user enter # any kind of capitalization, so it's a little less strict. command = (input("What do you want to do?\n")).lower() if command == "done": print("Shutting down team manager\n") return elif command == "set team name": do_set_team_name(the_team) elif command == "show roster": do_show_team_roster(the_team) elif command == "add player": do_add_player_to_team(the_team) elif command == "check position is filled": do_check_position_filled(the_team) elif command == "send player to bench": do_send_player_to_bench(the_team, the_bench) elif command == "get player from bench": do_get_player_from_bench(the_bench) elif command == "cut player": do_cut_player_from_team(the_team, the_bench) elif command == "show bench": do_show_bench(the_bench) else: do_not_understand()
def OnInit(self): self.settings_frame = wx.Frame(None, title='ProtocolNavigator', size=(600, 400), pos=(-1, -1)) self.exptsetting_frame = ExperimentSettingsWindow(self.settings_frame) self.settings_frame.Show() self.settings_frame.SetMenuBar(wx.MenuBar()) fileMenu = wx.Menu() saveSettingsMenuItem = fileMenu.Append(-1, 'Save Protocol\tCtrl+S', help='') loadSettingsMenuItem = fileMenu.Append(-1, 'Load Protocol\tCtrl+O', help='') printExperimentMenuItem = fileMenu.Append(-1, 'Print Protocol\tCtrl+P', help='') #self.settings_frame.Bind(wx.EVT_MENU, self.on_new_experiment, newExperimentMenuItem) self.settings_frame.Bind(wx.EVT_MENU, self.on_save_settings, saveSettingsMenuItem) self.settings_frame.Bind(wx.EVT_MENU, self.on_load_settings, loadSettingsMenuItem) self.settings_frame.Bind(wx.EVT_MENU, self.on_print_protocol, printExperimentMenuItem) self.settings_frame.GetMenuBar().Append(fileMenu, 'File') self.bench_frame = Bench(None, size=(600, 450), pos=(0, self.settings_frame.Position[1] + 410)) self.bench_frame.Show() self.lineage_frame = LineageFrame(None, size=(700, 800), pos=(610, -1)) self.lineage_frame.Show() return True
def collect_samples(): i = 0 n = 9 i = 0 Bench.comment = "iteration-analysis; docker, no-turbo-2.7GHz-performance" while i < n: i = i + 1 Bench.skip_all() Bench.skip_graalphp_native = False Bench.skip_graalphp = False BenchmarkFannkuch().run() i = 0 while i < n: i = i + 1 Bench.skip_all() Bench.skip_graalphp_native = False Bench.skip_graalphp = False BenchmarkSpectralNorm().run() i = 0 while i < n: i = i + 1 Bench.skip_all() Bench.skip_graalphp_native = False Bench.skip_graalphp = False BenchBinaryTrees().run_by_ref()
def OnInit(self): self.settings_frame = wx.Frame(None, title='Experiment Settings', size=(600, 400), pos=(-1,-1)) p = ExperimentSettingsWindow(self.settings_frame) self.settings_frame.Show() self.settings_frame.SetMenuBar(wx.MenuBar()) fileMenu = wx.Menu() newExperimentMenuItem = fileMenu.Append(-1, 'New Experiment\tCtrl+N', help='') saveSettingsMenuItem = fileMenu.Append(-1, 'Save settings\tCtrl+S', help='') loadSettingsMenuItem = fileMenu.Append(-1, 'Load settings\tCtrl+O', help='') self.settings_frame.Bind(wx.EVT_MENU, self.on_new_experiment, newExperimentMenuItem) self.settings_frame.Bind(wx.EVT_MENU, self.on_save_settings, saveSettingsMenuItem) self.settings_frame.Bind(wx.EVT_MENU, self.on_load_settings, loadSettingsMenuItem) self.settings_frame.GetMenuBar().Append(fileMenu, 'File') self.bench_frame = Bench(None, size=(600,450), pos=(0, self.settings_frame.Position[1]+410)) self.bench_frame.Show() self.lineage_frame = LineageFrame(None, size=(700, 800), pos=(610, -1)) self.lineage_frame.Show() return True
def main(): print("Welcome to the team manager.") # Here's where we create objects for the team and the bench. These # objects will be able to call the methods we've defined in their # respective classes. When the constructor functions are called here, # the classes' __init__() method is called with these values # passed to it. In both of these cases no arguments are passed, here. # However, the `self` argument is always implicitly passed with any # method call. the_team = Team() the_bench = Bench() while True: # Immediately converting the input to lower() lets the user enter # any kind of capitalization, so it's a little less strict. command = (input("What do you want to do?\n")).lower() if command == "done": print("Shutting down team manager\n") return # this return statement exits main, ending the session. elif command == "set team name": do_set_team_name(the_team) elif command == "show roster": do_show_team_roster(the_team) elif command == "add player": do_add_player_to_team(the_team) elif command == "check position is filled": do_check_position_filled(the_team) elif command == "send player to bench": do_send_player_to_bench(the_team, the_bench) elif command == "get player from bench": do_get_player_from_bench(the_bench) elif command == "cut player": # call a function that calls # the appropriate method on the team # object to cut the player (you need # to write the function below) do_cut_player(the_team, the_bench) elif command == "show bench": # call a function to call the necessary # bench method to show the names of the players # who are currently on the bench. do_show_bench(the_bench) else: do_not_understand()
import progressbar import argparse GAS_CREATE_ISSUE = 281909 GAS_VOTE = 49840 parser = argparse.ArgumentParser() parser.add_argument('endpoint') parser.add_argument('csv') parser.add_argument('path') parser.add_argument('key1') parser.add_argument('key2') parser.add_argument("--pow", dest="pow", action="store_true") parser.add_argument("--progress-bar", dest="progress_bar", action="store_true") args = parser.parse_args() bench = Bench(args.endpoint, args.path, 'AdvancedTokenVote1202', args.pow) contract_creator = bench.import_account(args.key1) NUM_OF_CONTRACT = 150 OPTIONS = 5 USERS = 5 ITER = 100 vote_addr = [ bench.call_contract_function(contract_creator[0], 'constructor', [], private_key=contract_creator[1], wait=True) for i in range(NUM_OF_CONTRACT) ] vote_addr = [ bench.wait_for_result(x, gen_pow=False).contractAddress for x in vote_addr
class LineageProfiler(wx.App): '''The LineageProfiler Application This launches the main UI, and keeps track of the session. ''' def OnInit(self): self.settings_frame = wx.Frame(None, title='Experiment Settings', size=(600, 400), pos=(-1,-1)) p = ExperimentSettingsWindow(self.settings_frame) self.settings_frame.Show() self.settings_frame.SetMenuBar(wx.MenuBar()) fileMenu = wx.Menu() newExperimentMenuItem = fileMenu.Append(-1, 'New Experiment\tCtrl+N', help='') saveSettingsMenuItem = fileMenu.Append(-1, 'Save settings\tCtrl+S', help='') loadSettingsMenuItem = fileMenu.Append(-1, 'Load settings\tCtrl+O', help='') self.settings_frame.Bind(wx.EVT_MENU, self.on_new_experiment, newExperimentMenuItem) self.settings_frame.Bind(wx.EVT_MENU, self.on_save_settings, saveSettingsMenuItem) self.settings_frame.Bind(wx.EVT_MENU, self.on_load_settings, loadSettingsMenuItem) self.settings_frame.GetMenuBar().Append(fileMenu, 'File') self.bench_frame = Bench(None, size=(600,450), pos=(0, self.settings_frame.Position[1]+410)) self.bench_frame.Show() self.lineage_frame = LineageFrame(None, size=(700, 800), pos=(610, -1)) self.lineage_frame.Show() return True def get_bench(self): return self.bench_frame def get_lineage(self): return self.lineage_frame def get_settings(self): return self.lineage_frame def on_new_experiment(self, evt): '''clears the existing Experiment settings ''' return ExperimentSettings.getInstance().clear() def on_save_settings(self, evt): # for saving the experimental file, the text file may have the following nomenclature # Date(YYYY_MM_DD)_ExperimenterNumber_Experimenter Name_ first 20 words from the aim meta = ExperimentSettings.getInstance() #-- Get Experimental Date/number ---# exp_date = meta.get_field('Overview|Project|ExptDate') exp_num = meta.get_field('Overview|Project|ExptNum') exp_title = meta.get_field('Overview|Project|Title') if None not in [exp_date, exp_num, exp_title]: day, month, year = exp_date.split('/') filename = '%s%s%s_%s_%s.txt'%(year, month, day , exp_num, exp_title) else: filename = 'new_experiment.txt' dlg = wx.FileDialog(None, message='Saving experimental metadata...', defaultDir=os.getcwd(), defaultFile=filename, wildcard='.txt', style=wx.SAVE|wx.FD_OVERWRITE_PROMPT) if dlg.ShowModal() == wx.ID_OK: os.chdir(os.path.split(dlg.GetPath())[0]) ExperimentSettings.getInstance().save_to_file(dlg.GetPath()) def on_load_settings(self, evt): dlg = wx.FileDialog(None, "Select the file containing your CPAnalyst workspace...", defaultDir=os.getcwd(), style=wx.OPEN|wx.FD_CHANGE_DIR) if dlg.ShowModal() == wx.ID_OK: ExperimentSettings.getInstance().load_from_file(dlg.GetPath())
parser.add_argument("--progress-bar", dest="progress_bar", action="store_true") args = parser.parse_args() if 'erc20' in args.csv: contract_name = 'BecToken' origin_creator = "0x36642d20f2E288f18A9a21b544AA853C594DD312" NUM_OF_CONTRACT = 100 constructor_args = [] else: contract_name = 'DozerDoll' origin_creator = "0x6f53E6F92E85C084E10AAf35D4A44DEE6a27892d" constructor_args = ["a", "b"] NUM_OF_CONTRACT = 100 bench = Bench(args.endpoint, args.path, contract_name, args.pow) contract_creator = bench.import_account(args.key1) with open(args.csv) as f: reader = csv.DictReader(f) transactions = list(reader) bench.address_mapping(origin_creator, contract_creator[0]) print('creator: ' + contract_creator[0]) idx = 0 for idx in range(ITER): transaction = transactions[idx] if int(transaction['status']) == 0: continue new = bench.address_mapping(transaction['from'])
parser = argparse.ArgumentParser(description='Process some integers.') parser.add_argument('endpoint') parser.add_argument('csv') parser.add_argument('path') parser.add_argument('key1') parser.add_argument('key2') parser.add_argument("--pow", dest="pow", action="store_true") parser.add_argument("--progress-bar", dest="progress_bar", action="store_true") args = parser.parse_args() if 'transfer' in args.csv: NUM_OF_CONTRACT = 155 else: NUM_OF_CONTRACT = 115 bench = Bench(args.endpoint, args.path, 'BecToken', args.pow) a = [bench.import_account(args.key1), bench.import_account(args.key2)] bec_addr = [ bench.call_contract_function(a[0][0], 'constructor', [], private_key=a[0][1], wait=True) for i in range(NUM_OF_CONTRACT) ] bec_addr = [ bench.wait_for_result(x, gen_pow=False).contractAddress for x in bec_addr ] count = 0 ITER = 500
import sys import time from bench import Bench import progressbar import argparse parser = argparse.ArgumentParser(description='Process some integers.') parser.add_argument('endpoint') parser.add_argument('csv') parser.add_argument('path') parser.add_argument('key1') parser.add_argument('key2') parser.add_argument("--pow", dest="pow", action="store_true") parser.add_argument("--progress-bar", dest="progress_bar", action="store_true") args = parser.parse_args() bench = Bench(args.endpoint, args.path, 'DozerDoll', args.pow) contract_creator = bench.import_account(args.key1) MINT_GAS = 180286 TRANSFER = 70618 [addr, result] = bench.new_address_and_transfer(*contract_creator) bench.wait_for_result(result) NUM_OF_CONTRACT = 132 dd_addr = [ bench.call_contract_function(contract_creator[0], 'constructor', ["Dozer", "DD"], private_key=contract_creator[1], wait=True) for i in range(NUM_OF_CONTRACT) ] dd_addr = [
self.run_by_val() self.run_by_ref() def extract_timings(self, lines, data_item: BenchMeasurement = None): timings = lines.iloc[:, 4].to_numpy() return timings def _import_data_manually(self): pref = '2020-08-02T18:40:49.444647' pref = pref + '-spectralnorm.php-2-unmodified.php-php.txt' path = DIR + '/measurements/' + pref self.import_data( path, test_name=TEST_BY_UNMOD, prefix=pref, comment='intel turbo disabled, graal 20.2.0', binary='php', ) if __name__ == '__main__': bm = BenchmarkSpectralNorm() Bench.skip_all() Bench.skip_jphp = False bm.run_by_ref() # bm.run_by_val() # bm.run_by_ref() # bm._import_data_manually() pass
from bench import Bench from bench_fannkuch import BenchmarkFannkuch from bench_binarytrees import BenchBinaryTrees from bench_spectralnorm import BenchmarkSpectralNorm if __name__ == '__main__': Bench.comment = "docker, no-turbo-2.7GHz-performance, report" Bench.skip_none() # Bench.skip_php = False BenchBinaryTrees().run() BenchmarkFannkuch().run() BenchmarkSpectralNorm().run()
def bench(): b = Bench({ "thread_num" : int(sys.argv[1]) }) b.execute()