From 83b727c62a463b3b15f69a390638ece27bfbbcd5 Mon Sep 17 00:00:00 2001 From: Karl DeBisschop Date: Sun, 10 Aug 2003 12:48:47 +0000 Subject: perf data in integer microseconds git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@679 f882894a-f735-0410-b71e-b25c423dba1c diff --git a/plugins/check_dns.c b/plugins/check_dns.c index afc23a4..58c0a1b 100644 --- a/plugins/check_dns.c +++ b/plugins/check_dns.c @@ -78,6 +78,7 @@ main (int argc, char **argv) char *temp_buffer = NULL; int result = STATE_UNKNOWN; double elapsed_time; + long microsec; struct timeval tv; int multi_address; @@ -197,8 +198,9 @@ main (int argc, char **argv) result = STATE_CRITICAL; asprintf(&output, _("expected %s but got %s"), expected_address, address); } - - elapsed_time = delta_time (tv); + + microsec = deltime (tv); + elapsed_time = (double)microsec / 1.0e6; if (result == STATE_OK) { if (strchr (address, ',') == NULL) @@ -206,8 +208,8 @@ main (int argc, char **argv) else multi_address = TRUE; - printf (_("DNS ok - %.3f seconds response time, address%s %s|time=%.3f\n"), - elapsed_time, (multi_address==TRUE ? "es are" : " is"), address, elapsed_time); + printf (_("DNS ok - %.3f seconds response time, address%s %s|time=%ldus\n"), + elapsed_time, (multi_address==TRUE ? "es are" : " is"), address, microsec); } else if (result == STATE_WARNING) printf (_("DNS WARNING - %s\n"), diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index 41ed5f3..b35ebbc 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c @@ -59,6 +59,7 @@ main (int argc, char **argv) { int sd; double elapsed_time; + long microsec; int result = STATE_UNKNOWN; char buffer[MAX_INPUT_BUFFER]; char *from_str = NULL; @@ -155,7 +156,8 @@ main (int argc, char **argv) /* reset the alarm */ alarm (0); - elapsed_time = delta_time (tv); + microsec = deltime (tv); + elapsed_time = (double)microsec / 1.0e6; if (check_critical_time && elapsed_time > (double) critical_time) result = STATE_CRITICAL; @@ -163,11 +165,11 @@ main (int argc, char **argv) result = STATE_WARNING; if (verbose) - printf (_("SMTP %s - %.3f sec. response time, %s|time=%.3f\n"), - state_text (result), elapsed_time, buffer, elapsed_time); + printf (_("SMTP %s - %.3f sec. response time, %s|time=%ldus\n"), + state_text (result), elapsed_time, buffer, microsec); else - printf (_("SMTP %s - %.3f second response time|time=%.3f\n"), - state_text (result), elapsed_time, elapsed_time); + printf (_("SMTP %s - %.3f second response time|time=%ldus\n"), + state_text (result), elapsed_time, microsec); return result; } -- cgit v0.10-9-g596f