From 864e4392d360f3248051ea18cbf28cfb35f41169 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Tue, 28 Sep 2021 12:27:14 +0200 Subject: [PATCH] Support multiple nodes in test_speed --- test_speed.c | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/test_speed.c b/test_speed.c index 083222e..cae40b9 100644 --- a/test_speed.c +++ b/test_speed.c @@ -1,30 +1,56 @@ #include #include #include +#include #include #include #include "ovni.h" -#define N 100000 +#ifndef gettid +# include +# define gettid() ((pid_t)syscall(SYS_gettid)) +#endif -int main() +static inline void +init() +{ + char hostname[HOST_NAME_MAX]; + char *appid; + + if(gethostname(hostname, HOST_NAME_MAX) != 0) + { + perror("gethostname failed"); + abort(); + } + + ovni_proc_init(0, hostname, getpid()); + ovni_thread_init(gettid()); + ovni_add_cpu(0, 0); +} + +int main(int argc, char *argv[]) { struct ovni_ev ev = {0}; - int i; + int i, n; - ovni_proc_init(0, "test", 0); - ovni_thread_init(1); + if(argv[1] != NULL) + n = atoi(argv[1]); + else + n = 1000; + + init(); ovni_ev_set_mcv(&ev, "OB."); - for(i=0; i