0

我正在使用具有相同文件的 lttng 文档中提供的示例 C 应用程序。

http://lttng.org/docs/#doc-tracing-your-own-user-application

我按照文档中的说明创建我的共享库。

gcc -shared -W1,--no-as-needed -o hello-tp.so -llttng-ust hello-tp.o 

gcc -o hello hello.c hello-tp.o -ldl

hello-tp.so 与应用程序 hello 在同一文件夹中创建。所以我跑

LD_PRELOAD=./hello-tp.so ./hello and beyond

我检查该事件是否可用

PID: 13120 - Name: ./hello
  ust_baddr_statedump:soinfo (loglevel: TRACE_DEBUG_LINE (13)) (type: tracepoint)

正如预期的那样,它已正确加载。

我允许跟踪所有事件。我运行我的应用程序并开始跟踪。然后我停止并使用“lttng view”查看跟踪。

但是我的跟踪文件是空的。

即使我启用了它,是否有任何事件被跟踪的原因?

谢谢你的帮助。

4

1 回答 1

1

I had to move #define TRACEPOINT_DEFINE #define TRACEPOINT_PROBE_DYNAMIC_LINKAGE #include "hello-tp.h" //the header file containing the event

into my hello.c

But didn't know i had to keep #define TRACEPOINT_CREATE_PROBES inside my hello-tp.c so when i linked against hello-tp.o it registered the event but never traced anything. And so the hello-tp.so wouldn't have worked. This resource helped me a bunch. https://github.com/giraldeau/lttng-ust/tree/master/doc/examples/demo

于 2015-04-17T10:23:34.740 回答