test.py 801 Bytes
Newer Older
Őry Máté committed
1
from calvin import *  # noqa
Nagy Gergő committed
2 3 4 5 6 7 8 9
import datetime

query = Query()
query.setTarget("2008.vm.ik.bme.hu.circle")
query.setMetric("cpu.usage")
query.setAbsoluteStart("2013", "10", "23", "00", "00")
query.generate()

Nagy Gergő committed
10
handler = GraphiteHandler("10.9.1.209")
Nagy Gergő committed
11

Őry Máté committed
12 13
times = int(input(
    "How many requests do you intend to send? [postive integer]  "))
Nagy Gergő committed
14 15

global_start = datetime.datetime.now()
Nagy Gergő committed
16
for i in range(1, times):
Nagy Gergő committed
17 18 19 20
    local_start = datetime.datetime.now()
    handler.put(query)
    handler.send()
    local_end = datetime.datetime.now()
Őry Máté committed
21
    print((local_end - local_start).microseconds)
Nagy Gergő committed
22 23 24 25 26 27
global_end = datetime.datetime.now()

print("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*")
print("Summary:")
print(global_end - global_start)
print("AVG:")
Nagy Gergő committed
28
print((global_end - global_start) / times)
Nagy Gergő committed
29
print("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*")