2

I followed the tutorial at https://www.kernel.org/doc/Documentation/trace/tracepoints.txt to create a custom tracepoint in the kernel core (i.e. not in a loadable module).

But, I don't see the tracepoint listed in the outputs of perf list or tplist (from bcc tools).

And so, I don't know how to use the tracepoint.

Question: How do I make the tracepoint appear in perf list/tplist output?

Thanks.

fpkvdw
  • 71
  • 5
  • 1
    For what it's worth, `tplist` from bcc lists tracepoint by listing tracepoints available under `/sys/kernel/debug/tracing/events/`, and then by reading some info from their “format” (e.g. from `/sys/kernel/debug/tracing/events/tcp/tcp_probe/format`, see [related code](https://github.com/iovisor/bcc/blob/cc01a9cd6ab1a2aea2d21a71502882af1add4346/tools/tplist.py#L35-L64). Maybe you don't provide format information that `tplist` could use to dump info on your tracepoint? (Not sure how to do so, look at the other tracepoints I guess). I didn't look at how `perf` does it. – Qeole Sep 14 '20 at 07:56
  • 1
    @Qeole Thanks for your insight! You were right - I don't think I was providing enough information for the tracepoint to be listed. And so, I followed the instructions to use `TRACE_EVENT()` at https://lwn.net/Articles/379903/ instead of `DECLARE_TRACE()` from the link in the question. This resolved my issue: I can see the tracepoint in `perf list` and `tplist` outputs. – fpkvdw Sep 16 '20 at 02:05
  • Cool, glad I could help! You should make this an answer and accept it. – Qeole Sep 16 '20 at 06:28

1 Answers1

5

I resolved the issue by using the TRACE_EVENT() macro (see details in this LWN article) instead of DECLARE_TRACE(). I can now see the tracepoint in perf list and tplist outputs.

Thanks to @Qeole for the insight that led to the resolution.

Qeole
  • 8,284
  • 1
  • 24
  • 52
fpkvdw
  • 71
  • 5