Commit 3a71ecb7 authored by Cedric Roux's avatar Cedric Roux

remove T_USE_SHARED_MEMORY

The T only works when it's TRUE, the version without shared memory
is not supported anymore.
parent 655e48c5
......@@ -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")
......
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
......
......@@ -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
......
......@@ -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);
......
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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment