Skip to content
Snippets Groups Projects
Commit e716df77 authored by Nada Afra's avatar Nada Afra
Browse files

buat ngetest

parent f9b7ed66
No related merge requests found
.DS_Store 0 → 100644
File added
......@@ -62,7 +62,6 @@ class ConcurrencyControl :
def run(self):
timestampCount = 1
while (self.i_queue != []):
curr_inst = self.i_queue.pop(0)
......@@ -116,6 +115,7 @@ class ConcurrencyControl :
print("Current inst : ", curr_inst)
print("Current inst timestamp: ", self.t_table[t_id].getTimestamp())
print("Instruction Queue : ", self.i_queue)
print("Transaction Table : ", self.t_table)
print("Aborted Transactions id : ", self.at_list)
......
from concurrency_control import ConcurrencyControl
from sys import argv
import time
def main() :
cc = ConcurrencyControl(argv[1], argv[2], 3)
cc = ConcurrencyControl(argv[1], "test1.txt", 3)
length = len(cc.i_queue)
start = time.time()
cc.run()
end = time.time()
throughput1 = float(length / (end-start))
cc = ConcurrencyControl(argv[1], "test2.txt", 3)
start = time.time()
cc.run()
end = time.time()
throughput2 = float(length / (end-start))
cc = ConcurrencyControl(argv[1], "test3.txt", 3)
start = time.time()
cc.run()
end = time.time()
throughput3 = float(length / (end-start))
cc = ConcurrencyControl(argv[1], "test4.txt", 3)
start = time.time()
cc.run()
end = time.time()
throughput4 = float(length / (end-start))
cc = ConcurrencyControl(argv[1], "test5.txt", 3)
start = time.time()
cc.run()
end = time.time()
throughput5 = float(length / (end-start))
'''
cc = ConcurrencyControl(argv[1], "test6.txt", 3)
start = time.time()
cc.run()
end = time.time()
throughput6 = float(length / (end-start))
'''
print("throughput1 =", throughput1)
print("throughput2 =", throughput2)
print("throughput3 =", throughput3)
print("throughput4 =", throughput4)
print("throughput5 =", throughput5)
'''
print("throughput6 =", throughput6)
'''
print("avg =", float((throughput1 +throughput2 + throughput3 + throughput4 + throughput5)/5))
main()
\ No newline at end of file
......@@ -70,7 +70,7 @@ class mvcc_Storage() :
self.setdata[key][target_ver]["value"] = val
#self.setdata[key][target_ver]["r_timestamp"] = belum tau berubah atau gak
return True
elif (self.setdata[key][target_ver]["r_timestamp"] < tmpst):
elif (self.setdata[key][target_ver]["r_timestamp"] <= tmpst):
self.create_new_version(key, val, tmpst, trans_id)
return True
else :
......@@ -96,7 +96,7 @@ class mvcc_Storage() :
return False
mvcc = mvcc_Storage(10)
'''mvcc = mvcc_Storage(10)
print(mvcc.setdata)
print("----")
mvcc.put(1,12,1,1)
......@@ -106,4 +106,4 @@ print("----")
mvcc.put(11,12,1,1)
print(mvcc.setdata)
print(mvcc.get(1,5,1))
print(mvcc.setdata)
print(mvcc.setdata)'''
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment