summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorfcolin2009-10-06 15:34:20 +0000
committerfcolin2009-10-06 15:34:20 +0000
commit8f86104d18dd95c54d41b1d0eac21b2bb1f30d39 (patch)
tree4a074bddde451b1156927356c80b1ba01d380620 /tools
parent39eac7e7dbb97562939638bc0a7274eebd11bfb2 (diff)
downloadivy-c-8f86104d18dd95c54d41b1d0eac21b2bb1f30d39.zip
ivy-c-8f86104d18dd95c54d41b1d0eac21b2bb1f30d39.tar.gz
ivy-c-8f86104d18dd95c54d41b1d0eac21b2bb1f30d39.tar.bz2
ivy-c-8f86104d18dd95c54d41b1d0eac21b2bb1f30d39.tar.xz
ajout d'un programme de test des messages ready
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile7
-rwxr-xr-xtools/ivytestready.c111
2 files changed, 116 insertions, 2 deletions
diff --git a/tools/Makefile b/tools/Makefile
index 8901809..95b696c 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -1,4 +1,4 @@
-TARGETS = ivyprobe ivythroughput ivyperf ivyglibprobe ivyxtprobe #ivyprobe_efence
+TARGETS = ivyprobe ivythroughput ivytestready ivyperf ivyglibprobe ivyxtprobe #ivyprobe_efence
OMP_TARGET= ivyprobe_omp ivythroughput_omp
PCRELIB = `pcre-config --libs`
@@ -20,7 +20,10 @@ ivyprobe: ivyprobe.o ../src/libivy.a
$(CC) $(CFLAGS) $(EXTRAINC) -o $@ ivyprobe.o -L. -livy $(PCRELIB) $(EXTRALIB)
ivythroughput: ivythroughput.o ../src/libivy.a
- $(CPP) $(CFLAGS) $(EXTRAINC) -o $@ ivythroughput.o -L. -livy -lpcrecpp $(PCRELIB) $(EXTRALIB)
+ $(CPP) $(CFLAGS) $(EXTRAINC) -o $@ ivythroughput.o -L. $(EXTRALIB) -livy -lpcrecpp $(PCRELIB)
+
+ivytestready: ivytestready.o ../src/libivy.a
+ $(CC) $(CFLAGS) $(EXTRAINC) -o $@ ivytestready.o -L. $(EXTRALIB) -livy -lpcrecpp
ivyprobe_efence: ivyprobe.o ../src/libivy.a
$(CPP) $(CFLAGS) $(EXTRAINC) -o $@ ivyprobe.o -L. -livy -lpcrecpp $(PCRELIB) $(EXTRALIB) -lefence
diff --git a/tools/ivytestready.c b/tools/ivytestready.c
new file mode 100755
index 0000000..b3acd7b
--- /dev/null
+++ b/tools/ivytestready.c
@@ -0,0 +1,111 @@
+/*
+ * Ivy perf mesure le temp de round trip
+ *
+ * Copyright (C) 1997-2004
+ * Centre d'Études de la Navigation Aérienne
+ *
+ * Main and only file
+ *
+ * Authors: François-Régis Colin <fcolin@cena.fr>
+ * Yannick Jestin <jestin@cena.fr>
+ *
+ * Please refer to file version.h for the
+ * copyright notice regarding this software
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef WIN32
+#include <windows.h>
+#ifdef __MINGW32__
+#include <regex.h>
+#include <getopt.h>
+#endif
+#else
+#include <sys/time.h>
+#include <unistd.h>
+#ifdef __INTERIX
+extern char *optarg;
+extern int optind;
+#endif
+#endif
+
+
+#include "Ivy/ivysocket.h"
+#include "Ivy/ivy.h"
+#include "Ivy/timer.h"
+#include "Ivy/ivyloop.h"
+#define MILLISEC 1000.0
+
+const char * me = "A";
+const char * other = "B";
+char ready_message[1000] = "A ready";
+char ready_bind[1000] = "^B ready";
+
+void Ready (IvyClientPtr app, void *user_data, int argc, char *argv[])
+{
+ char *name = IvyGetApplicationName( app );
+ int count = IvySendMsg ("are you there %s",name);
+ printf("Application %s received '%s' from %s sent question 'are you there %s'= %d\n", me, ready_bind, name, name, count);
+}
+
+void Question (IvyClientPtr app, void *user_data, int argc, char *argv[])
+{
+ char *name = IvyGetApplicationName( app );
+ int count = IvySendMsg ("yes i am %s",me);
+ printf("Application %s Reply to %s are you there = %d\n", me, name, count);
+
+}
+void Reply (IvyClientPtr app, void *user_data, int argc, char *argv[])
+{
+ char *name = IvyGetApplicationName( app );
+ printf("Application %s Reply to our question! %s\n", name, argv[0]);
+
+}
+
+void binCB( IvyClientPtr app, void *user_data, int id, const char* regexp, IvyBindEvent event )
+{
+ char *app_name = IvyGetApplicationName( app );
+ switch ( event )
+ {
+ case IvyAddBind:
+ printf("%s receive Application:%s bind '%s' ADDED\n", me, app_name, regexp );
+ //if ( *me == 'A' ) usleep( 200000 ); // slowdown sending of regexp
+ break;
+ case IvyRemoveBind:
+ printf("%s receive Application:%s bind '%s' REMOVED\n", me, app_name, regexp );
+ break;
+ case IvyChangeBind:
+ printf("%s receive Application:%s bind '%s' CHANGED\n", me, app_name, regexp );
+ break;
+ case IvyFilterBind:
+ printf("%s receive Application:%s bind '%s' FILTRED\n", me, app_name, regexp );
+ break;
+
+ }
+}
+int main(int argc, char *argv[])
+{
+
+ /* Mainloop management */
+ if ( argc > 1 )
+ {
+ me = "B" ;
+ other = "A";
+ strcpy( ready_message, "B ready");
+ strcpy( ready_bind, "^A ready");
+ }
+
+ IvyInit (me, ready_message, NULL,NULL,NULL,NULL);
+ IvySetBindCallback( binCB, 0 ),
+ IvyBindMsg (Ready, NULL, ready_bind);
+ IvyBindMsg (Question, NULL, "^are you there %s",me);
+ IvyBindMsg (Reply, NULL, "^(yes i am %s)",other);
+
+ IvyStart (0);
+
+
+ IvyMainLoop ();
+ return 0;
+}