Skip to content

Commit 6dc289e

Browse files
author
bwelling
committed
Print the query time.
git-svn-id: http://svn.code.sf.net/p/dnsjava/code/trunk@963 c76caeb1-94fd-44dd-870f-0c9d92034fc1
1 parent 2357b6f commit 6dc289e

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

dig.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ public class dig {
2020
}
2121

2222
static void
23-
doQuery(Message response) throws IOException {
23+
doQuery(Message response, long ms) throws IOException {
2424
System.out.println("; java dig 0.0");
2525
System.out.println(response);
26+
System.out.println(";; Query time: " + ms + " ms");
2627
}
2728

2829
static void
@@ -61,6 +62,7 @@ public class dig {
6162
Record opt = null;
6263
Resolver res = null;
6364
boolean printQuery = false;
65+
long startTime, endTime;
6466

6567
if (argv.length < 1) {
6668
usage();
@@ -181,12 +183,14 @@ public class dig {
181183
query.addRecord(opt, Section.ADDITIONAL);
182184
if (printQuery)
183185
System.out.println(query);
186+
startTime = System.currentTimeMillis();
184187
response = res.send(query);
188+
endTime = System.currentTimeMillis();
185189

186190
if (type == Type.AXFR)
187191
doAXFR(response);
188192
else
189-
doQuery(response);
193+
doQuery(response, endTime - startTime);
190194
}
191195

192196
}

0 commit comments

Comments
 (0)