1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
From bb549e830e049a7afe4e289502aca266fd2de4f1 Mon Sep 17 00:00:00 2001
From: Stefano Rivera <stefanor@debian.org>
Date: Sun, 11 Oct 2015 22:07:09 +0200
Subject: fix-named-perf
See Debian #694785
Patch by Scott Kitterman, <scott@kitterman.com>
Last-Update: 2014-02-17
Patch-Name: fix-named-perf
---
tools/named-perf.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/named-perf.py b/tools/named-perf.py
index 42e6769..483f182 100755
--- a/tools/named-perf.py
+++ b/tools/named-perf.py
@@ -18,7 +18,7 @@ lookups = [ ( 'munnari.oz.au', 'A' ),
rpts = 5
def main():
- import DNS, timing, socket, time
+ import DNS, socket, time
res = {}
for server in servers:
res[server] = [100000,0,0,0] # min,max,tot,failed
@@ -27,12 +27,12 @@ def main():
for server in servers:
d = DNS.DnsRequest(server=server,timeout=1)
fail = 0
- timing.start()
+ timingstart = time.time()
try:
r=d.req(name=what,qtype=querytype)
except DNS.Error:
fail = 1
- timing.finish()
+ timingfinish = time.time()
if fail:
res[server][3] = res[server][3] + 1
print "(failed)",res[server][3]
@@ -40,7 +40,7 @@ def main():
if r.header['ancount'] == 0:
print "WARNING: Server",server,"got no answers for", \
what, querytype
- t = timing.milli()
+ t = int(1000 * (timingfinish - timingstart))
print server,"took",t,"ms for",what,querytype
res[server][0] = min(t,res[server][0])
res[server][1] = max(t,res[server][1])
|