diff --git a/common/utils/T/local_tracer.c b/common/utils/T/local_tracer.c index 93a56a9e3d41aa2ecd8f41aa617fe55c292c055e..1f4e4943469677d4143a9c4abd008409799eb262 100644 --- a/common/utils/T/local_tracer.c +++ b/common/utils/T/local_tracer.c @@ -14,7 +14,7 @@ #include "T_defs.h" #include "T_IDs.h" -static T_cache_t *T_cache; +static T_cache_t *T_local_cache; static int T_busylist_head; typedef struct databuf { @@ -287,7 +287,7 @@ static void forward(void *_forwarder, char *buf, int size) static void wait_message(void) { - while (T_cache[T_busylist_head].busy == 0) usleep(1000); + while (T_local_cache[T_busylist_head].busy == 0) usleep(1000); } static void init_shm(void) @@ -297,17 +297,17 @@ static void init_shm(void) if (s == -1) { perror(T_SHM_FILENAME); abort(); } if (ftruncate(s, T_CACHE_SIZE * sizeof(T_cache_t))) { perror(T_SHM_FILENAME); abort(); } - T_cache = mmap(NULL, T_CACHE_SIZE * sizeof(T_cache_t), - PROT_READ | PROT_WRITE, MAP_SHARED, s, 0); - if (T_cache == NULL) + T_local_cache = mmap(NULL, T_CACHE_SIZE * sizeof(T_cache_t), + PROT_READ | PROT_WRITE, MAP_SHARED, s, 0); + if (T_local_cache == NULL) { perror(T_SHM_FILENAME); abort(); } close(s); /* let's garbage the memory to catch some potential problems * (think multiprocessor sync issues, barriers, etc.) */ - memset(T_cache, 0x55, T_CACHE_SIZE * sizeof(T_cache_t)); - for (i = 0; i < T_CACHE_SIZE; i++) T_cache[i].busy = 0; + memset(T_local_cache, 0x55, T_CACHE_SIZE * sizeof(T_cache_t)); + for (i = 0; i < T_CACHE_SIZE; i++) T_local_cache[i].busy = 0; } void T_local_tracer_main(int remote_port, int wait_for_tracer, @@ -335,9 +335,9 @@ void T_local_tracer_main(int remote_port, int wait_for_tracer, while (1) { wait_message(); __sync_synchronize(); - forward(f, T_cache[T_busylist_head].buffer, - T_cache[T_busylist_head].length); - T_cache[T_busylist_head].busy = 0; + forward(f, T_local_cache[T_busylist_head].buffer, + T_local_cache[T_busylist_head].length); + T_local_cache[T_busylist_head].busy = 0; T_busylist_head++; T_busylist_head &= T_CACHE_SIZE - 1; }