diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index a95994a8b12ccbb24e61776ffde926038f299af6..2a51f376d895a14b86f0dc02898e17c8eed46c52 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1487,7 +1487,6 @@ set(CMAKE_MODULE_PATH "${OPENAIR_DIR}/cmake_targets/tools/MODULES" "${CMAKE_MODU #add the T tracer add_boolean_option(T_TRACER True "Activate the T tracer" ) include_directories("${OPENAIR_DIR}/common/utils/T") -add_boolean_option(T_USE_SHARED_MEMORY True "Use shared memory to communicate with the T tracer" ) set(T_SOURCE ${OPENAIR_DIR}/common/utils/T/T.c) set (T_LIB "-lrt") diff --git a/common/utils/T/Makefile b/common/utils/T/Makefile index 6690e7d38dd9e79124727f967f9b7f5494111fc2..73c07c7e821dac86aee807526525ef18a757cfea 100644 --- a/common/utils/T/Makefile +++ b/common/utils/T/Makefile @@ -1,8 +1,6 @@ CC=gcc CFLAGS=-Wall -g -pthread -DT_TRACER -#comment those two lines to NOT use shared memory -CFLAGS += -DT_USE_SHARED_MEMORY LIBS += -lrt PROG=t diff --git a/common/utils/T/T.c b/common/utils/T/T.c index 1a5ff0a54c9ba12e130783f8555705939d38192f..61fd5540906f2791d99ac1fb321f242404a528d3 100644 --- a/common/utils/T/T.c +++ b/common/utils/T/T.c @@ -62,42 +62,6 @@ printf("got mess %d\n", t); } } -#ifndef T_USE_SHARED_MEMORY - -static void *T_send_thread(void *_) -{ - while (1) { - usleep(5000); - __sync_synchronize(); - while (T_cache[T_busylist_head].busy) { - char *b; - int l; - /* TODO: be sure about those memory barriers - in doubt one is - * put here too - */ - __sync_synchronize(); - b = T_cache[T_busylist_head].buffer; - l = T_cache[T_busylist_head].length; - while (l) { - int done = write(T_socket, b, l); - if (done <= 0) { - printf("%s:%d:%s: error sending to socket\n", - __FILE__, __LINE__, __FUNCTION__); - abort(); - } - b += done; - l -= done; - } - T_cache[T_busylist_head].busy = 0; - T_busylist_head++; - T_busylist_head &= T_CACHE_SIZE - 1; - } - } - return NULL; -} - -#endif /* T_USE_SHARED_MEMORY */ - static void *T_receive_thread(void *_) { while (1) get_message(T_socket); @@ -123,9 +87,7 @@ void T_connect_to_tracer(char *addr, int port) { struct sockaddr_in a; int s; -#ifdef T_USE_SHARED_MEMORY int T_shm_fd; -#endif unsigned char *buf; int len; @@ -156,7 +118,6 @@ again: T_socket = s; -#ifdef T_USE_SHARED_MEMORY /* setup shared memory */ T_shm_fd = shm_open(T_SHM_FILENAME, O_RDWR /*| O_SYNC*/, 0666); shm_unlink(T_SHM_FILENAME); @@ -166,11 +127,7 @@ again: if (T_cache == NULL) { perror(T_SHM_FILENAME); abort(); } close(T_shm_fd); -#endif -#ifndef T_USE_SHARED_MEMORY - new_thread(T_send_thread, NULL); -#endif new_thread(T_receive_thread, NULL); /* trace T_message.txt diff --git a/common/utils/T/T.h b/common/utils/T/T.h index 58e0d5a885ea8865418faf052862cb601482c541..13e1cbc3ca03b1c0ac612cd474545eb1b7deebc8 100644 --- a/common/utils/T/T.h +++ b/common/utils/T/T.h @@ -127,26 +127,12 @@ extern T_cache_t *T_cache; #define T_ACTIVE(x) T_active[(intptr_t)x] -#ifdef T_USE_SHARED_MEMORY - #define T_SEND() \ T_cache[T_LOCAL_slot].length = T_LOCAL_size; \ __sync_synchronize(); \ T_cache[T_LOCAL_slot].busy = 1; \ T_send(T_LOCAL_buf, T_LOCAL_size) -#else /* T_USE_SHARED_MEMORY */ - -/* when not using shared memory, wait for send to finish */ -#define T_SEND() \ - T_cache[T_LOCAL_slot].length = T_LOCAL_size; \ - __sync_synchronize(); \ - T_cache[T_LOCAL_slot].busy = 1; \ - T_send(T_LOCAL_buf, T_LOCAL_size); \ - while (T_cache[T_LOCAL_slot].busy) usleep(1*1000) - -#endif /* T_USE_SHARED_MEMORY */ - #define T_CHECK_SIZE(len, argnum) \ if (T_LOCAL_size + (len) > T_BUFFER_MAX) { \ printf("%s:%d:%s: cannot put argument %d in T macro, not enough space" \ @@ -575,26 +561,8 @@ extern T_cache_t *T_cache; } \ } while (0) -#ifndef T_USE_SHARED_MEMORY - -#include <stdio.h> - -static inline void T_send(char *buf, int size) -{ - int i; -return; - printf("sending %d bytes", size); - for (i = 0; i < size; i++) - printf("%s%2.2x", i?" ":"\n", (unsigned char)buf[i]); - printf("\n"); -} - -#else /* T_USE_SHARED_MEMORY */ - #define T_send(...) /**/ -#endif /* T_USE_SHARED_MEMORY */ - extern int *T_active; void T_connect_to_tracer(char *addr, int port); diff --git a/common/utils/T/tracee/Makefile b/common/utils/T/tracee/Makefile index bc7c01d86be4d9129da35a6a219113b856bd9fa1..703d49d029ae914638b0c1fd2ba7e56dbc349216 100644 --- a/common/utils/T/tracee/Makefile +++ b/common/utils/T/tracee/Makefile @@ -1,5 +1,5 @@ CC=gcc -CFLAGS=-Wall -g -pthread -DT_TRACER -DT_USE_SHARED_MEMORY -I. +CFLAGS=-Wall -g -pthread -DT_TRACER -I. PROG=tracee OBJS=tracee.o ../T.o diff --git a/common/utils/T/tracer/Makefile.local b/common/utils/T/tracer/Makefile.local index a34378470bdb2355a31a7a0009424386b57adc4b..ae4e248a2007e86baaacd8544aa71fb51af27ddf 100644 --- a/common/utils/T/tracer/Makefile.local +++ b/common/utils/T/tracer/Makefile.local @@ -3,7 +3,6 @@ CFLAGS=-Wall -g -pthread -DT_TRACER #CFLAGS += -O3 -ffast-math -fomit-frame-pointer -CFLAGS += -DT_USE_SHARED_MEMORY LIBS += -lrt PROG=tracer_local