Hi,dev-list
   It seems work well if there is only one tracepoint file(sample_tracepoint.h) 
including in app .i.esample_tracepoint.h#undef TRACEPOINT_PROVIDER
#define TRACEPOINT_PROVIDER sample

#if !defined(SAMPLE_TRACEPOINT_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
#define SAMPLE_TRACEPOINT_H

#include <lttng/tracepoint.h>

TRACEPOINT_EVENT(
        sample,
        bytes_in, // C++ Style comment
        TP_ARGS(char *, text),
        TP_FIELDS(
                ctf_string(message, text)
                  )
)
#endif /* SAMPLE_TRACEPOINT_H */
#undef TRACEPOINT_INCLUDE
#define TRACEPOINT_INCLUDE "./sample_tracepoint.h"

#include <lttng/tracepoint-event.h>
sample.c#include <unistd.h>
#define TRACEPOINT_DEFINE
#define TRACEPOINT_CREATE_PROBES
#include "sample_tracepoint.h"
int main(int argc, char **argv)
{
        int i = 0;
        for (i = 0; i < 100000; i++) {
                tracepoint(sample, bytes_in,  "bytes in");
                sleep(1);
        }
        return 0;
}
compile: gcc -I. -o sample sample.c -ldl -llttng-ustHowever,If one more 
tracepoint include file(sample_tracepoint2.h) added in app,compile 
failed.sample_tracepoint2.h#undef TRACEPOINT_PROVIDER
#define TRACEPOINT_PROVIDER sample2
#if !defined(SAMPLE_TRACEPOINT2_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
#define SAMPLE_TRACEPOINT2_H

#include <lttng/tracepoint.h>

TRACEPOINT_EVENT(
        sample2,
        bytes_in, // C++ Style comment
        TP_ARGS(char *, text),
        TP_FIELDS(
                ctf_string(message, text)
                  )
)
#endif /* SAMPLE_TRACEPOINT2_H */
#undef TRACEPOINT_INCLUDE
#define TRACEPOINT_INCLUDE "./sample_tracepoint2.h"
#include <lttng/tracepoint-event.h>
sample.c#include <unistd.h>
#define TRACEPOINT_DEFINE
#define TRACEPOINT_CREATE_PROBES
#include "sample_tracepoint.h"
#include "sample_tracepoint2.h"

int main(int argc, char **argv)
{
        int i = 0;
        for (i = 0; i < 100000; i++) {
                tracepoint(sample, bytes_in,  "bytes in");
                tracepoint(sample2, bytes_in,  "bytes in");
                sleep(1);
        }
        return 0;
}
compile:gcc -I. -o sample sample.c -ldl -llttng-ustsample.c: In function˜main:
sample.c:12: error: __tracepoint_sample2___bytes_in undeclared (first use in 
this function)
sample.c:12: error: (Each undeclared identifier is reported only once
sample.c:12: error: for each function it appears in.)   Does LTTng support 
compiling multiple tracepoint sources with app directly?   Yes,I can compile 
multiple tracepoint providers to share libs and link them to app through 
TRACEPOINT_PROBE_DYNAMIC_LINKAGE  such as what doc/examples/demo does. 
Thankszhenyu.ren

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Reply via email to