From d20808b04feb328272a35ee2b03f4ae19db23fbe Mon Sep 17 00:00:00 2001 From: fcolin Date: Thu, 20 Apr 2006 15:51:37 +0000 Subject: cleanup DEBUG code --- src/ivyperf.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/ivyperf.c') diff --git a/src/ivyperf.c b/src/ivyperf.c index 283771c..92ea982 100755 --- a/src/ivyperf.c +++ b/src/ivyperf.c @@ -39,7 +39,8 @@ extern int optind; #include "ivyloop.h" #define MILLISEC 1000.0 -char *mymessages[] = { "ping", "pong" }; +const char *mymessages[] = { "IvyPerf", "ping", "pong" }; +static double origin = 0; static double currentTime() { @@ -56,11 +57,11 @@ static double currentTime() void Reply (IvyClientPtr app, void *user_data, int argc, char *argv[]) { - IvySendMsg ("pong ts=%s tr=%f", *argv, currentTime()); + IvySendMsg ("pong ts=%s tr=%f", *argv, currentTime()- origin); } void Pong (IvyClientPtr app, void *user_data, int argc, char *argv[]) { - double current = currentTime(); + double current = currentTime() - origin ; double ts = atof( *argv++ ); double tr = atof( *argv++ ); double roundtrip1 = tr-ts; @@ -71,7 +72,7 @@ void Pong (IvyClientPtr app, void *user_data, int argc, char *argv[]) void TimerCall(TimerId id, void *user_data, unsigned long delta) { - int count = IvySendMsg ("ping ts=%f", currentTime() ); + int count = IvySendMsg ("ping ts=%f", currentTime() - origin ); if ( count == 0 ) fprintf(stderr, "." ); } @@ -104,7 +105,7 @@ int main(int argc, char *argv[]) IvySetBindCallback( binCB, 0 ), IvyBindMsg (Reply, NULL, "^ping ts=(.*)"); IvyBindMsg (Pong, NULL, "^pong ts=(.*) tr=(.*)"); - + origin = currentTime(); IvyStart (0); TimerRepeatAfter (TIMER_LOOP, time, TimerCall, (void*)1); -- cgit v1.1