X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=libmarkers%2Fmarker.h;h=7c3d8c565a512d082df3fc304882747eab97930e;hb=e0baa9906b1c443228605a2b29c37b4bc004c61c;hp=27d538bf7700ca40cacadfa05df79a3453314853;hpb=a72ca31a14a2250246d530ed8c39ec010140cf20;p=lttng-ust.git diff --git a/libmarkers/marker.h b/libmarkers/marker.h index 27d538bf..7c3d8c56 100644 --- a/libmarkers/marker.h +++ b/libmarkers/marker.h @@ -1,24 +1,28 @@ -#ifndef _LINUX_MARKER_H -#define _LINUX_MARKER_H - /* * Code markup for dynamic and static tracing. * * See Documentation/marker.txt. * * (C) Copyright 2006 Mathieu Desnoyers + * (C) Copyright 2009 Pierre-Marc Fournier * * This file is released under the GPLv2. * See the file COPYING for more details. */ -#include -#include -#include -#include +#ifndef _LINUX_MARKER_H +#define _LINUX_MARKER_H -struct module; -struct task_struct; +#include +//ust// #include +#include "immediate.h" +//ust// #include +#include "kernelcompat.h" +#include "compiler.h" +#include "list.h" + +//ust// struct module; +//ust// struct task_struct; struct marker; /** @@ -49,7 +53,7 @@ struct marker { const char *format; /* Marker format string, describing the * variable argument list. */ - DEFINE_IMV(char, state);/* Immediate value state. */ + DEFINE_IMV(char, state);/* Immediate value state. */ char ptype; /* probe type : 0 : single, 1 : multi */ /* Probe wrapper */ u16 channel_id; /* Numeric channel identifier, dynamic */ @@ -61,7 +65,7 @@ struct marker { void *tp_cb; /* Optional tracepoint callback */ } __attribute__((aligned(8))); -#ifdef CONFIG_MARKERS +//ust// #ifdef CONFIG_MARKERS #define _DEFINE_MARKER(channel, name, tp_name_str, tp_cb, format) \ static const char __mstrtab_##channel##_##name[] \ @@ -129,24 +133,24 @@ extern void marker_update_probe_range(struct marker *begin, #define GET_MARKER(channel, name) (__mark_##channel##_##name) -#else /* !CONFIG_MARKERS */ -#define DEFINE_MARKER(channel, name, tp_name, tp_cb, format) -#define __trace_mark(generic, channel, name, call_private, format, args...) \ - __mark_check_format(format, ## args) -#define __trace_mark_tp(channel, name, call_private, tp_name, tp_cb, \ - format, args...) \ - do { \ - void __check_tp_type(void) \ - { \ - register_trace_##tp_name(tp_cb); \ - } \ - __mark_check_format(format, ## args); \ - } while (0) -static inline void marker_update_probe_range(struct marker *begin, - struct marker *end) -{ } -#define GET_MARKER(channel, name) -#endif /* CONFIG_MARKERS */ +//ust// #else /* !CONFIG_MARKERS */ +//ust// #define DEFINE_MARKER(channel, name, tp_name, tp_cb, format) +//ust// #define __trace_mark(generic, channel, name, call_private, format, args...) \ +//ust// __mark_check_format(format, ## args) +//ust// #define __trace_mark_tp(channel, name, call_private, tp_name, tp_cb, \ +//ust// format, args...) \ +//ust// do { \ +//ust// void __check_tp_type(void) \ +//ust// { \ +//ust// register_trace_##tp_name(tp_cb); \ +//ust// } \ +//ust// __mark_check_format(format, ## args); \ +//ust// } while (0) +//ust// static inline void marker_update_probe_range(struct marker *begin, +//ust// struct marker *end) +//ust// { } +//ust// #define GET_MARKER(channel, name) +//ust// #endif /* CONFIG_MARKERS */ /** * trace_mark - Marker using code patching @@ -248,7 +252,8 @@ extern void *marker_get_private_data(const char *channel, const char *name, #define marker_synchronize_unregister() synchronize_sched() struct marker_iter { - struct module *module; +//ust// struct module *module; + struct lib *lib; struct marker *marker; }; @@ -262,12 +267,32 @@ extern int marker_get_iter_range(struct marker **marker, struct marker *begin, extern void marker_update_process(void); extern int is_marker_enabled(const char *channel, const char *name); -#ifdef CONFIG_MARKERS_USERSPACE -extern void exit_user_markers(struct task_struct *p); -#else -static inline void exit_user_markers(struct task_struct *p) -{ +//ust// #ifdef CONFIG_MARKERS_USERSPACE +//ust// extern void exit_user_markers(struct task_struct *p); +//ust// #else +//ust// static inline void exit_user_markers(struct task_struct *p) +//ust// { +//ust// } +//ust// #endif + + +struct lib { + struct marker *markers_start; + int markers_count; + struct list_head list; +}; + +int marker_register_lib(struct marker *markers_start, int markers_count); + +#define MARKER_LIB \ +extern struct marker __start___markers[] __attribute__((visibility("hidden"))); \ +extern struct marker __stop___markers[] __attribute__((visibility("hidden"))); \ + \ +static void __attribute__((constructor)) __markers__init(void) \ +{ \ + marker_register_lib(__start___markers, (((long)__stop___markers)-((long)__start___markers))/sizeof(struct marker));\ } -#endif + +void marker_set_new_marker_cb(void (*cb)(struct marker *)); #endif