Code Review
/
integration
/
test.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Step 1: Move vm scripts to the right place
[integration/test.git]
/
test
/
tools
/
odl-mdsal-clustering-tests
/
clustering-performance-test
/
inventory_perf.py
diff --git
a/test/tools/odl-mdsal-clustering-tests/clustering-performance-test/inventory_perf.py
b/test/tools/odl-mdsal-clustering-tests/clustering-performance-test/inventory_perf.py
index c7582a0bed2c1fc142359a79d49bfbc3fc76bc90..2a4cfa925df3a1286a3975ad447e314e7bcb0781 100644
(file)
--- a/
test/tools/odl-mdsal-clustering-tests/clustering-performance-test/inventory_perf.py
+++ b/
test/tools/odl-mdsal-clustering-tests/clustering-performance-test/inventory_perf.py
@@
-8,10
+8,12
@@
import requests
import time
import threading
import time
import threading
+
class Counter(object):
def __init__(self, start=0):
self.lock = threading.Lock()
self.value = start
class Counter(object):
def __init__(self, start=0):
self.lock = threading.Lock()
self.value = start
+
def increment(self, value=1):
self.lock.acquire()
try:
def increment(self, value=1):
self.lock.acquire()
try:
@@
-54,6
+56,15
@@
print_lock = threading.Lock()
def get_inventory(tnum, url, hdrs, rnum, cond):
def get_inventory(tnum, url, hdrs, rnum, cond):
+ """
+
+ :param tnum:
+ :param url:
+ :param hdrs:
+ :param rnum:
+ :param cond:
+ :return:
+ """
total_len = float(0)
results = {}
total_len = float(0)
results = {}
@@
-63,7
+74,7
@@
def get_inventory(tnum, url, hdrs, rnum, cond):
s = requests.Session()
with Timer() as t:
for i in range(rnum):
s = requests.Session()
with Timer() as t:
for i in range(rnum):
- r = s.get(url, headers=hdrs, stream=False
)
+ r = s.get(url, headers=hdrs, stream=False)
total_len += len(r.content)
try:
total_len += len(r.content)
try:
@@
-116,7
+127,7
@@
if __name__ == "__main__":
for i in range(nthreads):
t = threading.Thread(target=get_inventory,
for i in range(nthreads):
t = threading.Thread(target=get_inventory,
- args=(i,url, getheaders, int(in_args.requests), cond))
+ args=(i,
url, getheaders, int(in_args.requests), cond))
threads.append(t)
t.start()
threads.append(t)
t.start()
@@
-127,7
+138,7
@@
if __name__ == "__main__":
finished = finished + 1
print '\nAggregate requests: %d, Aggregate requests/sec: %.2f' % (total_requests.value,
finished = finished + 1
print '\nAggregate requests: %d, Aggregate requests/sec: %.2f' % (total_requests.value,
- total_req_rate.value)
+
total_req_rate.value)
print 'Aggregate Volume: %.2f MB, Aggregate Rate: %.2f MByte/s' % (total_mbytes.value,
total_mb_rate.value)
print 'Aggregate Volume: %.2f MB, Aggregate Rate: %.2f MByte/s' % (total_mbytes.value,
total_mb_rate.value)