summaryrefslogtreecommitdiff
path: root/src/ivyperf.c
diff options
context:
space:
mode:
authorfcolin2006-04-20 15:51:37 +0000
committerfcolin2006-04-20 15:51:37 +0000
commitd20808b04feb328272a35ee2b03f4ae19db23fbe (patch)
tree070f5efb4b7f9b4603a8d2d830c8ef5210495572 /src/ivyperf.c
parent68372c19d14986d372918cd268d5855fd7665fc3 (diff)
downloadivy-c-d20808b04feb328272a35ee2b03f4ae19db23fbe.zip
ivy-c-d20808b04feb328272a35ee2b03f4ae19db23fbe.tar.gz
ivy-c-d20808b04feb328272a35ee2b03f4ae19db23fbe.tar.bz2
ivy-c-d20808b04feb328272a35ee2b03f4ae19db23fbe.tar.xz
cleanup DEBUG code
Diffstat (limited to 'src/ivyperf.c')
-rwxr-xr-xsrc/ivyperf.c11
1 files changed, 6 insertions, 5 deletions
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);