import copy import re from Queries import populate_user from Tictoc import Tictoc from Transaction import Transaction_TS from newUI import buildUI no_transactions = 0 user_list = populate_user(100, db=True) Tran_dict = dict() arg_list = dict() command_list = list() temp_list = copy.deepcopy(user_list) algorithm = Tictoc(temp_list) def initiate_tictoc(trx_list): global set_time for i in trx_list: set_time += 1 key = "T" + str(i) Tran_dict[key] = Transaction_TS(set_time, algorithm) def algo_parser(text): global no_transactions for i in text: if re.match(r'^T\d+,', i): trx_list = re.findall(r'T(\d)', i) initiate_tictoc(trx_list)
import re import random import math from random import Random from Queries import populate_user from Tictoc import Tictoc from Transaction import Transaction_TicToc, Transaction_TS import time from TO import TimeStamp import string no_transactions = 0 data_size = 10000 contention_size = int(data_size * 0.1) user_list = populate_user(data_size, db=False) Tran_dict = dict() arg_list = dict() command_list = list() temp_list = copy.deepcopy(user_list) algorithm1 = Tictoc(temp_list) algorithm2 = TimeStamp(temp_list) # for randomly generating the data myPRNG = Random() no_of_queries = 8 no_of_reads = 6 no_of_writes = no_of_queries - no_of_reads hotspot_queries = 0.6 no_of_comm_users = int(math.ceil(no_of_queries * hotspot_queries))