X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=libust%2Ftracer.h;h=1e07027beae5de562b7c64edf00e8726c7efbe79;hb=535b0d0af1b6421ceb83e22821e85bc6919d16d9;hp=64996b2d61c392ef40e768fbbbf1473797a154db;hpb=205f7ca77a36f7942a3348e7b8ea3c1f86f1c7ee;p=ust.git diff --git a/libust/tracer.h b/libust/tracer.h index 64996b2..1e07027 100644 --- a/libust/tracer.h +++ b/libust/tracer.h @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include "channels.h" @@ -48,9 +49,9 @@ #define LTT_ARCH_VARIANT LTT_ARCH_VARIANT_NONE #endif -struct ltt_active_marker; +struct ltt_active_ust_marker; -/* Maximum number of callbacks per marker */ +/* Maximum number of callbacks per ust_marker */ #define LTT_NR_CALLBACKS 10 struct ltt_serialize_closure; @@ -93,7 +94,7 @@ struct chan_info_struct { unsigned int def_subbufcount; }; -struct ltt_active_marker { +struct ltt_active_ust_marker { struct cds_list_head node; /* active markers list */ const char *channel; const char *name; @@ -101,30 +102,30 @@ struct ltt_active_marker { struct ltt_available_probe *probe; }; -struct marker; //ust// -extern void ltt_vtrace(const struct marker *mdata, void *probe_data, - struct registers *regs, void *call_data, const char *fmt, va_list *args); -extern void ltt_trace(const struct marker *mdata, void *probe_data, - struct registers *regs, void *call_data, const char *fmt, ...); +struct ust_marker; //ust// +extern void ltt_vtrace(const struct ust_marker *mdata, void *probe_data, + void *call_data, const char *fmt, va_list *args); +extern void ltt_trace(const struct ust_marker *mdata, void *probe_data, + void *call_data, const char *fmt, ...); /* * Unique ID assigned to each registered probe. */ -enum marker_id { - MARKER_ID_SET_MARKER_ID = 0, /* Static IDs available (range 0-7) */ - MARKER_ID_SET_MARKER_FORMAT, - MARKER_ID_COMPACT, /* Compact IDs (range: 8-127) */ - MARKER_ID_DYNAMIC, /* Dynamic IDs (range: 128-65535) */ +enum ust_marker_id { + UST_MARKER_ID_SET_MARKER_ID = 0, /* Static IDs available (range 0-7) */ + UST_MARKER_ID_SET_MARKER_FORMAT, + UST_MARKER_ID_COMPACT, /* Compact IDs (range: 8-127) */ + UST_MARKER_ID_DYNAMIC, /* Dynamic IDs (range: 128-65535) */ }; /* static ids 0-1 reserved for internal use. */ -#define MARKER_CORE_IDS 2 -static __inline__ enum marker_id marker_id_type(uint16_t id) +#define UST_MARKER_CORE_IDS 2 +static __inline__ enum ust_marker_id ust_marker_id_type(uint16_t id) { - if (id < MARKER_CORE_IDS) - return (enum marker_id)id; + if (id < UST_MARKER_CORE_IDS) + return (enum ust_marker_id)id; else - return MARKER_ID_DYNAMIC; + return UST_MARKER_ID_DYNAMIC; } struct user_dbg_data { @@ -343,21 +344,36 @@ static __inline__ void ltt_write_trace_header(struct ust_trace *trace, header->freq_scale = trace->freq_scale; } +#ifndef UST_VALGRIND + static __inline__ int ust_get_cpu(void) { -#ifndef UST_VALGRIND - return sched_getcpu(); -#else - /* Valgrind does not support the sched_getcpu() vsyscall. + int cpu; + + cpu = sched_getcpu(); + if (likely(cpu >= 0)) + return cpu; + /* + * If getcpu(2) is not implemented in the Kernel use CPU 0 as fallback. + */ + return 0; +} + +#else /* #else #ifndef UST_VALGRIND */ + +static __inline__ int ust_get_cpu(void) +{ + /* + * Valgrind does not support the sched_getcpu() vsyscall. * It causes it to detect a segfault in the program and stop it. * So if we want to check libust with valgrind, we have to refrain * from using this call. TODO: it would probably be better to return * other values too, to better test it. */ return 0; -#endif } +#endif /* #else #ifndef UST_VALGRIND */ /* * Size reserved for high priority events (interrupts, NMI, BH) at the end of a @@ -430,7 +446,7 @@ extern void ltt_core_unregister(void); extern void ltt_release_trace(struct urcu_ref *urcu_ref); extern void ltt_release_transport(struct urcu_ref *urcu_ref); -extern void ltt_dump_marker_state(struct ust_trace *trace); +extern void ltt_dump_ust_marker_state(struct ust_trace *trace); extern void ltt_lock_traces(void); extern void ltt_unlock_traces(void);