diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2010-07-28 10:34:12 -0700 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2010-07-28 10:34:12 -0700 |
commit | 202d34eddb948e2c4f1dc9a0c7d9417a38ced2db (patch) | |
tree | dc1956803d5333491ab6902145ce948ab9c7032f /tools | |
parent | 61b8dec235b4981e07683fe28aa5e44543e4e07f (diff) | |
download | connman-202d34eddb948e2c4f1dc9a0c7d9417a38ced2db.tar.gz connman-202d34eddb948e2c4f1dc9a0c7d9417a38ced2db.tar.bz2 connman-202d34eddb948e2c4f1dc9a0c7d9417a38ced2db.zip |
Add simple timer for resolver test program
Diffstat (limited to 'tools')
-rw-r--r-- | tools/resolv-test.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/resolv-test.c b/tools/resolv-test.c index 637c9e36..6112406f 100644 --- a/tools/resolv-test.c +++ b/tools/resolv-test.c @@ -30,7 +30,9 @@ #include <gresolv/gresolv.h> -static GMainLoop *main_loop = NULL; +static GTimer *timer; + +static GMainLoop *main_loop; static void resolv_debug(const char *str, void *data) { @@ -45,8 +47,13 @@ static void sig_term(int sig) static void resolv_result(GResolvResultStatus status, char **results, gpointer user_data) { + gdouble elapsed; int i; + elapsed = g_timer_elapsed(timer, NULL); + + g_print("elapse: %f seconds\n", elapsed); + g_print("status: %d\n", status); if (results != NULL) { @@ -111,6 +118,8 @@ int main(int argc, char *argv[]) } else g_resolv_add_nameserver(resolv, "127.0.0.1", 53, 0); + timer = g_timer_new(); + g_resolv_lookup_hostname(resolv, argv[1], resolv_result, NULL); memset(&sa, 0, sizeof(sa)); @@ -120,6 +129,8 @@ int main(int argc, char *argv[]) g_main_loop_run(main_loop); + g_timer_destroy(timer); + g_resolv_unref(resolv); g_main_loop_unref(main_loop); |