2020/7/21

trace_i2c_read 在哪裡

在 i2c-core-base.c 中出現的 trace_i2c_read() trace_i2c_write(),grep 的結果只有出現過一次,所以是在哪裡宣告/實做的?
因為有 trace_ 所以往上找 include..

include/trace/events/i2c.h:
TRACE_EVENT_FN(i2c_write,
               TP_PROTO(const struct i2c_adapter *adap, const struct i2c_msg *msg,
                        int num),
               TP_ARGS(adap, msg, num),
               TP_STRUCT__entry(
                       __field(int,     adapter_nr              )
        ...
這個很像,宣告出原型,而且有被 include.

所以找 TRACE_EVENT_FN:
最後, include/linux/tracepoint.h:
#define TRACE_EVENT_FN(name, proto, args, struct,               \
                assign, print, reg, unreg)                      \
        DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
      

....

#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
        extern struct tracepoint __tracepoint_##name;                   \
        static inline void trace_##name(proto)                          \
        {                                                               \
                if (static_key_false(&__tracepoint_##name.key))         \
找到...

沒有留言:

張貼留言