From 9d45fe0f7120777d788e6178ff142799ff6d8a25 Mon Sep 17 00:00:00 2001 From: compudj Date: Thu, 26 Jan 2006 23:58:25 +0000 Subject: [PATCH] update all git-svn-id: http://ltt.polymtl.ca/svn@1498 04897980-b3bd-0310-b5e0-8ef037075253 --- usertrace/lttng_usertrace.c | 90 ++++++++++++++++++++++++------------- usertrace/lttng_usertrace.h | 2 +- 2 files changed, 61 insertions(+), 31 deletions(-) diff --git a/usertrace/lttng_usertrace.c b/usertrace/lttng_usertrace.c index 51204181..14e19380 100644 --- a/usertrace/lttng_usertrace.c +++ b/usertrace/lttng_usertrace.c @@ -34,6 +34,7 @@ struct ltt_buf { struct lttng_trace_info { int active:1; + int filter; struct { struct ltt_buf facilities; struct ltt_buf cpu; @@ -41,8 +42,8 @@ struct lttng_trace_info { }; -/* TLS for the trace info */ -/* http://www.dis.com/gnu/gcc/C--98-Thread-Local-Edits.html +/* TLS for the trace info + * http://www.dis.com/gnu/gcc/C--98-Thread-Local-Edits.html * * Add after paragraph 4 * @@ -55,6 +56,7 @@ struct lttng_trace_info { static __thread struct lttng_trace_info lttng_trace_info[MAX_TRACES] = { [ 0 ... MAX_TRACES-1 ].active = 0, + [ 0 ... MAX_TRACES-1 ].filter = 0, [ 0 ... MAX_TRACES-1 ].channel = { NULL, ATOMIC_INIT(0), @@ -65,6 +67,61 @@ static __thread struct lttng_trace_info lttng_trace_info[MAX_TRACES] = } }; + +static void lttng_get_new_info(void) +{ + unsigned long cpu_addr, fac_addr; + unsigned int i, first_empty; + int active, filter; + int ret; + + /* Get all the new traces */ + while(1) { + cpu_addr = fac_addr = 0; + active = filter = 0; + ret = ltt_update(&cpu_addr, &fac_addr, &active, &filter); + if(ret) { + printf("LTTng : error in ltt_update\n"); + exit(1); + } + + if(!cpu_addr || !fac_addr) break; + + first_empty = MAX_TRACES; + /* Try to find the trace */ + for(i=0;i