X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=libust%2Ftracercore.h;fp=libust%2Ftracercore.h;h=e5ff00f78edc8c0aa4264a2d79b1f2ae7398707d;hb=b4512257eb71d0432554047acf6278dc42a15a75;hp=0000000000000000000000000000000000000000;hpb=e70acc91ae21023149204a245638c1d2dffa7265;p=ust.git diff --git a/libust/tracercore.h b/libust/tracercore.h new file mode 100644 index 0000000..e5ff00f --- /dev/null +++ b/libust/tracercore.h @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2005,2006 Mathieu Desnoyers (mathieu.desnoyers@polymtl.ca) + * + * This contains the core definitions for the Linux Trace Toolkit. + */ + +#ifndef LTT_CORE_H +#define LTT_CORE_H + +#include "list.h" +#include "kernelcompat.h" +//ust// #include + +/* ltt's root dir in debugfs */ +#define LTT_ROOT "ltt" + +/* + * All modifications of ltt_traces must be done by ltt-tracer.c, while holding + * the semaphore. Only reading of this information can be done elsewhere, with + * the RCU mechanism : the preemption must be disabled while reading the + * list. + */ +struct ltt_traces { + struct list_head setup_head; /* Pre-allocated traces list */ + struct list_head head; /* Allocated Traces list */ + unsigned int num_active_traces; /* Number of active traces */ +} ____cacheline_aligned; + +extern struct ltt_traces ltt_traces; + +/* + * get dentry of ltt's root dir + */ +struct dentry *get_ltt_root(void); + +/* Keep track of trap nesting inside LTT */ +//ust// DECLARE_PER_CPU(unsigned int, ltt_nesting); +extern unsigned int ltt_nesting; + +typedef int (*ltt_run_filter_functor)(void *trace, uint16_t eID); +//typedef int (*ltt_run_filter_functor)(void *, __u16); + +extern ltt_run_filter_functor ltt_run_filter; + +extern void ltt_filter_register(ltt_run_filter_functor func); +extern void ltt_filter_unregister(void); + +#if defined(CONFIG_LTT) && defined(CONFIG_LTT_ALIGNMENT) + +/* + * Calculate the offset needed to align the type. + * size_of_type must be non-zero. + */ +static inline unsigned int ltt_align(size_t align_drift, size_t size_of_type) +{ + size_t alignment = min(sizeof(void *), size_of_type); + return (alignment - align_drift) & (alignment - 1); +} +/* Default arch alignment */ +#define LTT_ALIGN + +static inline int ltt_get_alignment(void) +{ + return sizeof(void *); +} + +#else + +static inline unsigned int ltt_align(size_t align_drift, + size_t size_of_type) +{ + return 0; +} + +#define LTT_ALIGN __attribute__((packed)) + +static inline int ltt_get_alignment(void) +{ + return 0; +} +#endif /* defined(CONFIG_LTT) && defined(CONFIG_LTT_ALIGNMENT) */ + +#endif /* LTT_CORE_H */