X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=instrumentation%2Fevents%2Flttng-module%2Fmodule.h;h=f7b6056f1eec680dfa1ab968ce4eede09ee4e142;hb=55338ab6d8d168953cb5b55e098a7a864730df3b;hp=c63f86602555f59feb90d7e8957cc7707cfb0aaa;hpb=7c68b363332170e4db100327ecc9e09b8a79cf29;p=lttng-modules.git diff --git a/instrumentation/events/lttng-module/module.h b/instrumentation/events/lttng-module/module.h index c63f8660..f7b6056f 100644 --- a/instrumentation/events/lttng-module/module.h +++ b/instrumentation/events/lttng-module/module.h @@ -11,10 +11,10 @@ #define TRACE_SYSTEM module #endif -#if !defined(_TRACE_MODULE_H) || defined(TRACE_HEADER_MULTI_READ) -#define _TRACE_MODULE_H +#if !defined(LTTNG_TRACE_MODULE_H) || defined(TRACE_HEADER_MULTI_READ) +#define LTTNG_TRACE_MODULE_H -#include +#include #include #ifdef CONFIG_MODULES @@ -23,52 +23,35 @@ #define _TRACE_MODULE_DEF struct module; -#define show_module_flags(flags) __print_flags(flags, "", \ - { (1UL << TAINT_PROPRIETARY_MODULE), "P" }, \ - { (1UL << TAINT_FORCED_MODULE), "F" }, \ - { (1UL << TAINT_CRAP), "C" }) #endif -TRACE_EVENT(module_load, +LTTNG_TRACEPOINT_EVENT(module_load, TP_PROTO(struct module *mod), TP_ARGS(mod), - TP_STRUCT__entry( - __field( unsigned int, taints ) - __string( name, mod->name ) - ), - - TP_fast_assign( - tp_assign(taints, mod->taints) - tp_strcpy(name, mod->name) - ), - - TP_printk("%s %s", __get_str(name), show_module_flags(__entry->taints)) + TP_FIELDS( + ctf_integer(unsigned int, taints, mod->taints) + ctf_string(name, mod->name) + ) ) -TRACE_EVENT(module_free, +LTTNG_TRACEPOINT_EVENT(module_free, TP_PROTO(struct module *mod), TP_ARGS(mod), - TP_STRUCT__entry( - __string( name, mod->name ) - ), - - TP_fast_assign( - tp_strcpy(name, mod->name) - ), - - TP_printk("%s", __get_str(name)) + TP_FIELDS( + ctf_string(name, mod->name) + ) ) #ifdef CONFIG_MODULE_UNLOAD /* trace_module_get/put are only used if CONFIG_MODULE_UNLOAD is defined */ -DECLARE_EVENT_CLASS(module_refcnt, +LTTNG_TRACEPOINT_EVENT_CLASS(module_refcnt, #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) TP_PROTO(struct module *mod, unsigned long ip), @@ -80,27 +63,20 @@ DECLARE_EVENT_CLASS(module_refcnt, TP_ARGS(mod, ip, refcnt), #endif - TP_STRUCT__entry( - __field( unsigned long, ip ) - __field( int, refcnt ) - __string( name, mod->name ) - ), - - TP_fast_assign( - tp_assign(ip, ip) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) - tp_assign(refcnt, __this_cpu_read(mod->refptr->incs) + __this_cpu_read(mod->refptr->decs)) + TP_FIELDS( + ctf_integer(unsigned long, ip, ip) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0)) + ctf_integer(int, refcnt, atomic_read(&mod->refcnt)) +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) + ctf_integer(int, refcnt, __this_cpu_read(mod->refptr->incs) + __this_cpu_read(mod->refptr->decs)) #else - tp_assign(refcnt, refcnt) + ctf_integer(int, refcnt, refcnt) #endif - tp_strcpy(name, mod->name) - ), - - TP_printk("%s call_site=%pf refcnt=%d", - __get_str(name), (void *)__entry->ip, __entry->refcnt) + ctf_string(name, mod->name) + ) ) -DEFINE_EVENT(module_refcnt, module_get, +LTTNG_TRACEPOINT_EVENT_INSTANCE(module_refcnt, module_get, #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) TP_PROTO(struct module *mod, unsigned long ip), @@ -113,7 +89,7 @@ DEFINE_EVENT(module_refcnt, module_get, #endif ) -DEFINE_EVENT(module_refcnt, module_put, +LTTNG_TRACEPOINT_EVENT_INSTANCE(module_refcnt, module_put, #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) TP_PROTO(struct module *mod, unsigned long ip), @@ -127,31 +103,22 @@ DEFINE_EVENT(module_refcnt, module_put, ) #endif /* CONFIG_MODULE_UNLOAD */ -TRACE_EVENT(module_request, +LTTNG_TRACEPOINT_EVENT(module_request, TP_PROTO(char *name, bool wait, unsigned long ip), TP_ARGS(name, wait, ip), - TP_STRUCT__entry( - __field( unsigned long, ip ) - __field( bool, wait ) - __string( name, name ) - ), - - TP_fast_assign( - tp_assign(ip, ip) - tp_assign(wait, wait) - tp_strcpy(name, name) - ), - - TP_printk("%s wait=%d call_site=%pf", - __get_str(name), (int)__entry->wait, (void *)__entry->ip) + TP_FIELDS( + ctf_integer(unsigned long, ip, ip) + ctf_integer(bool, wait, wait) + ctf_string(name, name) + ) ) #endif /* CONFIG_MODULES */ -#endif /* _TRACE_MODULE_H */ +#endif /* LTTNG_TRACE_MODULE_H */ /* This part must be outside protection */ -#include "../../../probes/define_trace.h" +#include