本文整理汇总了Python中tactic_client_lib.TacticServerStub.get_connection_info方法的典型用法代码示例。如果您正苦于以下问题:Python TacticServerStub.get_connection_info方法的具体用法?Python TacticServerStub.get_connection_info怎么用?Python TacticServerStub.get_connection_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tactic_client_lib.TacticServerStub
的用法示例。
在下文中一共展示了TacticServerStub.get_connection_info方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute
# 需要导入模块: from tactic_client_lib import TacticServerStub [as 别名]
# 或者: from tactic_client_lib.TacticServerStub import get_connection_info [as 别名]
def execute():
#try:
# server = TacticServerStub(project='admin')
#except:
# # TODO: this should be automatic
# server = TacticServerStub(project='admin', setup=False)
# server.get_info_from_user()
# server = TacticServerStub(project='admin')
server = TacticServerStub(project='admin')
iterations = 100
print "Testing [%s] requests ..." % iterations
print
total_time = 0
count = 0
ports = {}
threads = {}
databases = {}
for i in range(0, iterations):
start = time.time()
x = server.get_connection_info()
diff = time.time() - start
try:
ports[x['port']] += 1
except:
ports[x['port']] = 1
try:
threads[x['thread']] += 1
except:
threads[x['thread']] = 1
num_databases = x['num_database_connections']
databases[x['port']] = num_databases
total_time += diff
count += 1
#print "time: ", time.time() - start
average_time = total_time / count
print "average time: ", average_time
print
print "ports: %s found" % len(ports.keys())
for key in ports.keys():
print "\t%s: %s requests" % (key, ports[key])
print
print "threads: %s found" % len(threads.keys())
for key in threads.keys():
print "\tid=%s: %s requests" % (key, threads[key])
# FIXME: not completely correct yet
#print
#print "databases: %s found" % len(databases.keys())
#for key in databases.keys():
# print "\tport=%s: %s databases" % (key, databases[key])
print