#include <bits/wordsize.h>
-struct marker;
+struct ust_marker;
/**
- * marker_probe_func - Type of a marker probe function
+ * ust_marker_probe_func - Type of a marker probe function
* @mdata: marker data
* @probe_private: probe private data
* @call_private: call site private data
* Type of marker probe functions. They receive the mdata and need to parse the
* format string to recover the variable argument list.
*/
-typedef void marker_probe_func(const struct marker *mdata,
+typedef void ust_marker_probe_func(const struct ust_marker *mdata,
void *probe_private, struct registers *regs, void *call_private,
const char *fmt, va_list *args);
-struct marker_probe_closure {
- marker_probe_func *func; /* Callback */
+struct ust_marker_probe_closure {
+ ust_marker_probe_func *func; /* Callback */
void *probe_private; /* Private probe data */
};
-struct marker {
+struct ust_marker {
const char *channel; /* Name of channel where to send data */
const char *name; /* Marker name */
const char *format; /* Marker format string, describing the
/* Probe wrapper */
u16 channel_id; /* Numeric channel identifier, dynamic */
u16 event_id; /* Numeric event identifier, dynamic */
- void (*call)(const struct marker *mdata, void *call_private, struct registers *regs, ...);
- struct marker_probe_closure single;
- struct marker_probe_closure *multi;
+ void (*call)(const struct ust_marker *mdata, void *call_private, struct registers *regs, ...);
+ struct ust_marker_probe_closure single;
+ struct ust_marker_probe_closure *multi;
const char *tp_name; /* Optional tracepoint name */
void *tp_cb; /* Optional tracepoint callback */
void *location; /* Address of marker in code */
};
-#define GET_MARKER(name) (__mark_ust_##name)
+#define GET_UST_MARKER(name) (__ust_marker_ust_##name)
-#define _DEFINE_MARKER(channel, name, tp_name_str, tp_cb, format, unique, m) \
- struct registers __marker_regs; \
+#define _DEFINE_UST_MARKER(channel, name, tp_name_str, tp_cb, format, unique, m) \
+ struct registers __ust_marker_regs; \
\
/* This next asm has to be a basic inline asm (no input/output/clobber), \
* because it must not require %-sign escaping, as we most certainly \
* is not unusual as it can be the result of function inlining. \
*/ \
".ifndef __mstrtab_" __stringify(channel) "_" __stringify(name) "_channel_" __stringify(unique) "\n\t" \
- /*".section __markers_strings\n\t"*/ \
- ".section __markers_strings,\"aw\"\n\t" \
+ /*".section __ust_marker_strings\n\t"*/ \
+ ".section __ust_marker_strings,\"aw\"\n\t" \
"__mstrtab_" __stringify(channel) "_" __stringify(name) "_channel_" __stringify(unique) ":\n\t" \
".string \"" __stringify(channel) "\"\n\t" \
"__mstrtab_" __stringify(channel) "_" __stringify(name) "_name_" __stringify(unique) ":\n\t" \
".endif\n\t" \
); \
asm volatile ( \
- /*".section __markers\n\t"*/ \
- ".section __markers,\"aw\"\n\t" \
+ /*".section __ust_marker\n\t"*/ \
+ ".section __ust_marker,\"aw\"\n\t" \
"2:\n\t" \
_ASM_PTR "(__mstrtab_" __stringify(channel) "_" __stringify(name) "_channel_" __stringify(unique) ")\n\t" /* channel string */ \
_ASM_PTR "(__mstrtab_" __stringify(channel) "_" __stringify(name) "_name_" __stringify(unique) ")\n\t" /* name string */ \
".hword 0\n\t" /* channel_id */ \
".hword 0\n\t" /* event_id */ \
".balign " __stringify(__WORDSIZE) " / 8\n\t" /* alignment */ \
- _ASM_PTR "(marker_probe_cb)\n\t" /* call */ \
- _ASM_PTR "(__mark_empty_function)\n\t" /* marker_probe_closure single.field1 */ \
- _ASM_PTR "0\n\t" /* marker_probe_closure single.field2 */ \
- _ASM_PTR "0\n\t" /* marker_probe_closure *multi */ \
+ _ASM_PTR "(ust_marker_probe_cb)\n\t" /* call */ \
+ _ASM_PTR "(__ust_marker_empty_function)\n\t" /* ust_marker_probe_closure single.field1 */ \
+ _ASM_PTR "0\n\t" /* ust_marker_probe_closure single.field2 */ \
+ _ASM_PTR "0\n\t" /* ust_marker_probe_closure *multi */ \
_ASM_PTR "0\n\t" /* tp_name */ \
_ASM_PTR "0\n\t" /* tp_cb */ \
_ASM_PTR "(1f)\n\t" /* location */ \
".previous\n\t" \
- /*".section __markers_ptrs\n\t"*/ \
- ".section __markers_ptrs,\"a\"\n\t" \
+ /*".section __ust_marker_ptrs\n\t"*/ \
+ ".section __ust_marker_ptrs,\"a\"\n\t" \
_ASM_PTR "(2b)\n\t" \
".previous\n\t" \
"1:\n\t" \
ARCH_COPY_ADDR("%[outptr]") \
: [outptr] "=r" (m) ); \
\
- save_registers(&__marker_regs)
+ save_registers(&__ust_marker_regs)
-#define DEFINE_MARKER(name, format, unique, m) \
- _DEFINE_MARKER(ust, name, NULL, NULL, format, unique, m)
+#define DEFINE_UST_MARKER(name, format, unique, m) \
+ _DEFINE_UST_MARKER(ust, name, NULL, NULL, format, unique, m)
-#define DEFINE_MARKER_TP(name, tp_name, tp_cb, format) \
- _DEFINE_MARKER_TP(ust, name, #tp_name, tp_cb, format)
+#define DEFINE_UST_MARKER_TP(name, tp_name, tp_cb, format) \
+ _DEFINE_UST_MARKER_TP(ust, name, #tp_name, tp_cb, format)
-#define _DEFINE_MARKER_TP(channel, name, tp_name_str, tp_cb, format) \
+#define _DEFINE_UST_MARKER_TP(channel, name, tp_name_str, tp_cb, format)\
static const char __mstrtab_##channel##_##name[] \
- __attribute__((section("__markers_strings"))) \
+ __attribute__((section("__ust_marker_strings"))) \
= #channel "\0" #name "\0" format; \
- static struct marker __mark_##channel##_##name \
- __attribute__((section("__markers"))) = \
+ static struct ust_marker __ust_marker_##channel##_##name\
+ __attribute__((section("__ust_marker"))) = \
{ __mstrtab_##channel##_##name, \
- &__mstrtab_##channel##_##name[sizeof(#channel)], \
+ &__mstrtab_##channel##_##name[sizeof(#channel)],\
&__mstrtab_##channel##_##name[sizeof(#channel) + sizeof(#name)], \
- 0, 0, 0, 0, marker_probe_cb, \
- { __mark_empty_function, NULL}, \
+ 0, 0, 0, 0, ust_marker_probe_cb, \
+ { __ust_marker_empty_function, NULL}, \
NULL, tp_name_str, tp_cb }; \
- static struct marker * const __mark_ptr_##channel##_##name \
- __attribute__((used, section("__markers_ptrs"))) = \
- &__mark_##channel##_##name;
+ static struct ust_marker * const __ust_marker_ptr_##channel##_##name \
+ __attribute__((used, section("__ust_marker_ptrs"))) = \
+ &__ust_marker_##channel##_##name;
/*
- * Make sure the alignment of the structure in the __markers section will
+ * Make sure the alignment of the structure in the __ust_marker section will
* not add unwanted padding between the beginning of the section and the
* structure. Force alignment to the same alignment as the section start.
*
#define __ust_marker_counter(generic, channel, name, unique, call_private, format, args...) \
do { \
- struct marker *__marker_counter_ptr; \
- _DEFINE_MARKER(channel, name, NULL, NULL, format, unique, __marker_counter_ptr); \
- __mark_check_format(format, ## args); \
+ struct ust_marker *__ust_marker_counter_ptr; \
+ _DEFINE_UST_MARKER(channel, name, NULL, NULL, format, unique, __ust_marker_counter_ptr); \
+ __ust_marker_check_format(format, ## args); \
if (!generic) { \
- if (unlikely(imv_read(__marker_counter_ptr->state))) \
- (__marker_counter_ptr->call)(__marker_counter_ptr, call_private, &__marker_regs, ## args); \
+ if (unlikely(imv_read(__ust_marker_counter_ptr->state))) \
+ (__ust_marker_counter_ptr->call)(__ust_marker_counter_ptr, call_private, &__ust_marker_regs, ## args); \
} else { \
- if (unlikely(_imv_read(__marker_counter_ptr->state))) \
- (__marker_counter_ptr->call)(__marker_counter_ptr, call_private, &__marker_regs, ## args); \
+ if (unlikely(_imv_read(__ust_marker_counter_ptr->state))) \
+ (__ust_marker_counter_ptr->call)(__ust_marker_counter_ptr, call_private, &__ust_marker_regs, ## args); \
} \
} while (0)
#define __ust_marker_tp_counter(channel, name, unique, call_private, tp_name, tp_cb, format, args...) \
do { \
- struct registers __marker_regs; \
+ struct registers __ust_marker_regs; \
void __check_tp_type(void) \
{ \
register_trace_##tp_name(tp_cb, call_private); \
} \
- _DEFINE_MARKER_TP(channel, name, #tp_name, tp_cb, format); \
- __mark_check_format(format, ## args); \
- (*__mark_##channel##_##name.call)(&__mark_##channel##_##name, \
- call_private, &__marker_regs, ## args); \
+ _DEFINE_UST_MARKER_TP(channel, name, #tp_name, tp_cb, format); \
+ __ust_marker_check_format(format, ## args); \
+ (*__ust_marker_##channel##_##name.call)(&__ust_marker_##channel##_##name, \
+ call_private, &__ust_marker_regs, ## args); \
} while (0)
-extern void marker_update_probe_range(struct marker * const *begin,
- struct marker * const *end);
+extern void ust_marker_update_probe_range(struct ust_marker * const *begin,
+ struct ust_marker * const *end);
/**
* ust_marker - Marker using code patching
__ust_marker_tp(ust, name, NULL, tp_name, tp_cb, format, ## args)
/**
- * MARK_NOARGS - Format string for a marker with no argument.
+ * UST_MARKER_NOARGS - Format string for a marker with no argument.
*/
-#define MARK_NOARGS " "
+#define UST_MARKER_NOARGS " "
-extern void lock_markers(void);
-extern void unlock_markers(void);
+extern void lock_ust_marker(void);
+extern void unlock_ust_marker(void);
-extern void markers_compact_event_ids(void);
+extern void ust_marker_compact_event_ids(void);
/* To be used for string format validity checking with gcc */
-static inline void __printf(1, 2) ___mark_check_format(const char *fmt, ...)
+static inline void __printf(1, 2) ___ust_marker_check_format(const char *fmt, ...)
{
}
-#define __mark_check_format(format, args...) \
+#define __ust_marker_check_format(format, args...) \
do { \
if (0) \
- ___mark_check_format(format, ## args); \
+ ___ust_marker_check_format(format, ## args); \
} while (0)
-extern marker_probe_func __mark_empty_function;
+extern ust_marker_probe_func __ust_marker_empty_function;
-extern void marker_probe_cb(const struct marker *mdata,
+extern void ust_marker_probe_cb(const struct ust_marker *mdata,
void *call_private, struct registers *regs, ...);
/*
* Connect a probe to a marker.
* private data pointer must be a valid allocated memory address, or NULL.
*/
-extern int marker_probe_register(const char *channel, const char *name,
- const char *format, marker_probe_func *probe, void *probe_private);
+extern int ust_marker_probe_register(const char *channel, const char *name,
+ const char *format, ust_marker_probe_func *probe, void *probe_private);
/*
- * Returns the private data given to marker_probe_register.
+ * Returns the private data given to ust_marker_probe_register.
*/
-extern int marker_probe_unregister(const char *channel, const char *name,
- marker_probe_func *probe, void *probe_private);
+extern int ust_marker_probe_unregister(const char *channel, const char *name,
+ ust_marker_probe_func *probe, void *probe_private);
/*
* Unregister a marker by providing the registered private data.
*/
-extern int marker_probe_unregister_private_data(marker_probe_func *probe,
+extern int ust_marker_probe_unregister_private_data(ust_marker_probe_func *probe,
void *probe_private);
-extern void *marker_get_private_data(const char *channel, const char *name,
- marker_probe_func *probe, int num);
+extern void *ust_marker_get_private_data(const char *channel, const char *name,
+ ust_marker_probe_func *probe, int num);
/*
- * marker_synchronize_unregister must be called between the last marker probe
+ * ust_marker_synchronize_unregister must be called between the last marker probe
* unregistration and the first one of
* - the end of module exit function
* - the free of any resource used by the probes
* to ensure the code and data are valid for any possibly running probes.
*/
-#define marker_synchronize_unregister() synchronize_sched()
+#define ust_marker_synchronize_unregister() synchronize_sched()
-struct marker_iter {
+struct ust_marker_iter {
//ust// struct module *module;
- struct lib *lib;
- struct marker * const *marker;
+ struct ust_marker_lib *lib;
+ struct ust_marker * const *ust_marker;
};
-extern void marker_iter_start(struct marker_iter *iter);
-extern void marker_iter_next(struct marker_iter *iter);
-extern void marker_iter_stop(struct marker_iter *iter);
-extern void marker_iter_reset(struct marker_iter *iter);
-extern int marker_get_iter_range(struct marker * const **marker, struct marker * const *begin,
- struct marker * const *end);
+extern void ust_marker_iter_start(struct ust_marker_iter *iter);
+extern void ust_marker_iter_next(struct ust_marker_iter *iter);
+extern void ust_marker_iter_stop(struct ust_marker_iter *iter);
+extern void ust_marker_iter_reset(struct ust_marker_iter *iter);
+extern int ust_marker_get_iter_range(struct ust_marker * const **marker, struct ust_marker * const *begin,
+ struct ust_marker * const *end);
-extern void marker_update_process(void);
-extern int is_marker_enabled(const char *channel, const char *name);
+extern void ust_marker_update_process(void);
+extern int is_ust_marker_enabled(const char *channel, const char *name);
-//ust// #ifdef CONFIG_MARKERS_USERSPACE
-//ust// extern void exit_user_markers(struct task_struct *p);
+//ust// #ifdef CONFIG_UST_MARKER_USERSPACE
+//ust// extern void exit_user_ust_marker(struct task_struct *p);
//ust// #else
-//ust// static inline void exit_user_markers(struct task_struct *p)
+//ust// static inline void exit_user_ust_marker(struct task_struct *p)
//ust// {
//ust// }
//ust// #endif
-struct marker_addr {
- struct marker *marker;
+struct ust_marker_addr {
+ struct ust_marker *marker;
void *addr;
};
-struct lib {
- struct marker * const *markers_start;
+struct ust_marker_lib {
+ struct ust_marker * const *ust_marker_start;
#ifdef CONFIG_UST_GDB_INTEGRATION
- struct marker_addr *markers_addr_start;
+ struct ust_marker_addr *ust_marker_addr_start;
#endif
- int markers_count;
+ int ust_marker_count;
struct cds_list_head list;
};
-extern int marker_register_lib(struct marker * const *markers_start, int markers_count);
-extern int marker_unregister_lib(struct marker * const *markers_start);
+extern int ust_marker_register_lib(struct ust_marker * const *ust_marker_start, int ust_marker_count);
+extern int ust_marker_unregister_lib(struct ust_marker * const *ust_marker_start);
-#define MARKER_LIB \
- extern struct marker * const __start___markers_ptrs[] __attribute__((weak, visibility("hidden"))); \
- extern struct marker * const __stop___markers_ptrs[] __attribute__((weak, visibility("hidden"))); \
- static struct marker * const __mark_ptr_dummy \
- __attribute__((used, section("__markers_ptrs"))) = NULL;\
+#define UST_MARKER_LIB \
+ extern struct ust_marker * const __start___ust_marker_ptrs[] __attribute__((weak, visibility("hidden"))); \
+ extern struct ust_marker * const __stop___ust_marker_ptrs[] __attribute__((weak, visibility("hidden"))); \
+ static struct ust_marker * const __ust_marker_ptr_dummy \
+ __attribute__((used, section("__ust_marker_ptrs"))) = NULL;\
\
- static void __attribute__((constructor)) __markers__init(void) \
+ static void __attribute__((constructor)) __ust_marker__init(void) \
{ \
- marker_register_lib(__start___markers_ptrs, \
- __stop___markers_ptrs \
- - __start___markers_ptrs); \
+ ust_marker_register_lib(__start___ust_marker_ptrs, \
+ __stop___ust_marker_ptrs \
+ - __start___ust_marker_ptrs); \
} \
\
- static void __attribute__((destructor)) __markers__destroy(void)\
+ static void __attribute__((destructor)) __ust_marker__destroy(void)\
{ \
- marker_unregister_lib(__start___markers_ptrs); \
+ ust_marker_unregister_lib(__start___ust_marker_ptrs); \
}
-extern void marker_set_new_marker_cb(void (*cb)(struct marker *));
-extern void init_markers(void);
+extern void ust_marker_set_new_ust_marker_cb(void (*cb)(struct ust_marker *));
+extern void init_ust_marker(void);
#endif /* _UST_MARKER_H */
struct ltt_available_probe {
const char *name; /* probe name */
const char *format;
- marker_probe_func *probe_func;
+ ust_marker_probe_func *probe_func;
ltt_serialize_cb callbacks[LTT_NR_CALLBACKS];
struct cds_list_head node; /* registered probes list */
};
extern int ltt_probe_register(struct ltt_available_probe *pdata);
extern int ltt_probe_unregister(struct ltt_available_probe *pdata);
-extern int ltt_marker_connect(const char *channel, const char *mname,
+extern int ltt_ust_marker_connect(const char *channel, const char *mname,
const char *pname);
-extern int ltt_marker_disconnect(const char *channel, const char *mname,
+extern int ltt_ust_marker_disconnect(const char *channel, const char *mname,
const char *pname);
#endif /* _UST_PROBE_H */
* largest_align must be non-zero, equal to the minimum between the largest type
* and sizeof(void *).
*/
-extern void _ltt_specialized_trace(const struct marker *mdata, void *probe_data,
+extern void _ltt_specialized_trace(const struct ust_marker *mdata, void *probe_data,
void *serialize_private, unsigned int data_size,
unsigned int largest_align);
* dumb-proof. It will make sure 0 is changed into 1 and unsigned long long is
* changed into sizeof(void *) on 32-bit architectures.
*/
-static inline void ltt_specialized_trace(const struct marker *mdata,
+static inline void ltt_specialized_trace(const struct ust_marker *mdata,
void *probe_data,
void *serialize_private, unsigned int data_size,
unsigned int largest_align)
#define USTCTL_SOCK_PATH "/tmp/socks/"
/* Channel/marker/state/format string (cmsf) info. structure */
-struct marker_status {
- char *channel; /* Channel name (end of marker_status array if NULL) */
- char *marker; /* Marker name (end of marker_status array if NULL) */
+struct ust_marker_status {
+ char *channel; /* Channel name (end of ust_marker_status array if NULL) */
+ char *ust_marker; /* Marker name (end of ust_marker_status array if NULL) */
int state; /* State (0 := marker disabled, 1 := marker enabled) */
- char *fs; /* Format string (end of marker_status array if NULL) */
+ char *fs; /* Format string (end of ust_marker_status array if NULL) */
};
struct trace_event_status {
extern int ustctl_connect_pid(pid_t pid);
-extern int ustctl_set_marker_state(int sock, const char *trace,
- const char *channel, const char *marker,
+extern int ustctl_set_ust_marker_state(int sock, const char *trace,
+ const char *channel, const char *ust_marker,
int state);
extern int ustctl_set_subbuf_size(int sock, const char *trace,
extern int ustctl_alloc_trace(int sock, const char *trace);
-extern int ustctl_free_cmsf(struct marker_status *);
+extern int ustctl_free_cmsf(struct ust_marker_status *);
extern int ustctl_free_tes(struct trace_event_status *);
extern unsigned int ustctl_count_nl(const char *);
-extern int ustctl_get_cmsf(int sock, struct marker_status **);
+extern int ustctl_get_cmsf(int sock, struct ust_marker_status **);
extern int ustctl_get_tes(int sock, struct trace_event_status **);
ust_marker(ust, java_event, "name %s args %s", ev_name_cstr, args_cstr);
}
-MARKER_LIB
+UST_MARKER_LIB
#include <ust/marker.h>
#include <ust/tracepoint.h>
-MARKER_LIB;
+UST_MARKER_LIB;
TRACEPOINT_LIB;
TRACE_EVENT_LIB;
*/
void ltt_channels_trace_free(struct ust_channel *channels)
{
- lock_markers();
+ lock_ust_marker();
pthread_mutex_lock(<t_channel_mutex);
free(channels);
urcu_ref_put(&index_urcu_ref, release_trace_channel);
pthread_mutex_unlock(<t_channel_mutex);
- unlock_markers();
+ unlock_ust_marker();
}
//ust// EXPORT_SYMBOL_GPL(ltt_channels_trace_free);
*
*/
-/* This file contains a high-level API for activating and deactivating markers,
- * and making sure markers in a given library can be released when the library
+/* This file contains a high-level API for activating and deactivating ust_markers,
+ * and making sure ust_markers in a given library can be released when the library
* is unloaded.
*/
.callbacks[0] = ltt_serialize_data,
};
-//ust//static struct kmem_cache *markers_loaded_cachep;
-static CDS_LIST_HEAD(markers_loaded_list);
+//ust//static struct kmem_cache *ust_markers_loaded_cachep;
+static CDS_LIST_HEAD(ust_markers_loaded_list);
/*
* List sorted by name strcmp order.
*/
return buf;
}
-static void get_marker_string(char *buf, char **start,
+static void get_ust_marker_string(char *buf, char **start,
char **end)
{
*start = skip_spaces(buf);
int ltt_probe_unregister(struct ltt_available_probe *pdata)
{
int ret = 0;
- struct ltt_active_marker *amark, *tmp;
+ struct ltt_active_ust_marker *amark, *tmp;
pthread_mutex_lock(&probes_mutex);
- cds_list_for_each_entry_safe(amark, tmp, &markers_loaded_list, node) {
+ cds_list_for_each_entry_safe(amark, tmp, &ust_markers_loaded_list, node) {
if (amark->probe == pdata) {
- ret = marker_probe_unregister_private_data(
+ ret = ust_marker_probe_unregister_private_data(
pdata->probe_func, amark);
if (ret)
goto end;
}
/*
- * Connect marker "mname" to probe "pname".
- * Only allow _only_ probe instance to be connected to a marker.
+ * Connect ust_marker "mname" to probe "pname".
+ * Only allow _only_ probe instance to be connected to a ust_marker.
*/
-int ltt_marker_connect(const char *channel, const char *mname,
+int ltt_ust_marker_connect(const char *channel, const char *mname,
const char *pname)
{
int ret;
- struct ltt_active_marker *pdata;
+ struct ltt_active_ust_marker *pdata;
struct ltt_available_probe *probe;
ltt_lock_traces();
ret = -ENOENT;
goto end;
}
- pdata = marker_get_private_data(channel, mname, probe->probe_func, 0);
+ pdata = ust_marker_get_private_data(channel, mname, probe->probe_func, 0);
if (pdata && !IS_ERR(pdata)) {
ret = -EEXIST;
goto end;
}
- pdata = zmalloc(sizeof(struct ltt_active_marker));
+ pdata = zmalloc(sizeof(struct ltt_active_ust_marker));
if (!pdata) {
ret = -ENOMEM;
goto end;
/*
* ID has priority over channel in case of conflict.
*/
- ret = marker_probe_register(channel, mname, NULL,
+ ret = ust_marker_probe_register(channel, mname, NULL,
probe->probe_func, pdata);
if (ret)
free(pdata);
else
- cds_list_add(&pdata->node, &markers_loaded_list);
+ cds_list_add(&pdata->node, &ust_markers_loaded_list);
end:
pthread_mutex_unlock(&probes_mutex);
ltt_unlock_traces();
}
/*
- * Disconnect marker "mname", probe "pname".
+ * Disconnect ust_marker "mname", probe "pname".
*/
-int ltt_marker_disconnect(const char *channel, const char *mname,
+int ltt_ust_marker_disconnect(const char *channel, const char *mname,
const char *pname)
{
- struct ltt_active_marker *pdata;
+ struct ltt_active_ust_marker *pdata;
struct ltt_available_probe *probe;
int ret = 0;
ret = -ENOENT;
goto end;
}
- pdata = marker_get_private_data(channel, mname, probe->probe_func, 0);
+ pdata = ust_marker_get_private_data(channel, mname, probe->probe_func, 0);
if (IS_ERR(pdata)) {
ret = PTR_ERR(pdata);
goto end;
ret = -EPERM;
goto end;
}
- ret = marker_probe_unregister(channel, mname, probe->probe_func, pdata);
+ ret = ust_marker_probe_unregister(channel, mname, probe->probe_func, pdata);
if (ret)
goto end;
else {
/*
* function handling proc entry write.
*
- * connect <channel name> <marker name> [<probe name>]]
- * disconnect <channel name> <marker name> [<probe name>]
+ * connect <channel name> <ust_marker name> [<probe name>]]
+ * disconnect <channel name> <ust_marker name> [<probe name>]
*/
//ust// static ssize_t ltt_write(struct file *file, const char __user *buffer,
//ust// size_t count, loff_t *offset)
//ust// {
//ust// char *kbuf;
-//ust// char *iter, *marker_action, *arg[4];
+//ust// char *iter, *ust_marker_action, *arg[4];
//ust// ssize_t ret;
//ust// int i;
//ust//
//ust// ret = -EINVAL;
//ust// goto end;
//ust// }
-//ust// get_marker_string(kbuf, &marker_action, &iter);
-//ust// if (!marker_action || marker_action == iter) {
+//ust// get_ust_marker_string(kbuf, &ust_marker_action, &iter);
+//ust// if (!ust_marker_action || ust_marker_action == iter) {
//ust// ret = -EINVAL;
//ust// goto end;
//ust// }
//ust// arg[i] = NULL;
//ust// if (iter < kbuf + count) {
//ust// iter++; /* skip the added '\0' */
-//ust// get_marker_string(iter, &arg[i], &iter);
+//ust// get_ust_marker_string(iter, &arg[i], &iter);
//ust// if (arg[i] == iter)
//ust// arg[i] = NULL;
//ust// }
//ust// goto end;
//ust// }
//ust//
-//ust// if (!strcmp(marker_action, "connect")) {
-//ust// ret = ltt_marker_connect(arg[0], arg[1], arg[2]);
+//ust// if (!strcmp(ust_marker_action, "connect")) {
+//ust// ret = ltt_ust_marker_connect(arg[0], arg[1], arg[2]);
//ust// if (ret)
//ust// goto end;
-//ust// } else if (!strcmp(marker_action, "disconnect")) {
-//ust// ret = ltt_marker_disconnect(arg[0], arg[1], arg[2]);
+//ust// } else if (!strcmp(ust_marker_action, "disconnect")) {
+//ust// ret = ltt_ust_marker_disconnect(arg[0], arg[1], arg[2]);
//ust// if (ret)
//ust// goto end;
//ust// }
//ust//
//ust// static void *s_next(struct seq_file *m, void *p, loff_t *pos)
//ust// {
-//ust// struct marker_iter *iter = m->private;
+//ust// struct ust_marker_iter *iter = m->private;
//ust//
-//ust// marker_iter_next(iter);
-//ust// if (!iter->marker) {
+//ust// ust_marker_iter_next(iter);
+//ust// if (!iter->ust_marker) {
//ust// /*
//ust// * Setting the iter module to -1UL will make sure
-//ust// * that no module can possibly hold the current marker.
+//ust// * that no module can possibly hold the current ust_marker.
//ust// */
//ust// iter->module = (void *)-1UL;
//ust// return NULL;
//ust// }
-//ust// return iter->marker;
+//ust// return iter->ust_marker;
//ust// }
//ust//
//ust// static void *s_start(struct seq_file *m, loff_t *pos)
//ust// {
-//ust// struct marker_iter *iter = m->private;
+//ust// struct ust_marker_iter *iter = m->private;
//ust//
//ust// if (!*pos)
-//ust// marker_iter_reset(iter);
-//ust// marker_iter_start(iter);
-//ust// if (!iter->marker) {
+//ust// ust_marker_iter_reset(iter);
+//ust// ust_marker_iter_start(iter);
+//ust// if (!iter->ust_marker) {
//ust// /*
//ust// * Setting the iter module to -1UL will make sure
-//ust// * that no module can possibly hold the current marker.
+//ust// * that no module can possibly hold the current ust_marker.
//ust// */
//ust// iter->module = (void *)-1UL;
//ust// return NULL;
//ust// }
-//ust// return iter->marker;
+//ust// return iter->ust_marker;
//ust// }
//ust//
//ust// static void s_stop(struct seq_file *m, void *p)
//ust// {
-//ust// marker_iter_stop(m->private);
+//ust// ust_marker_iter_stop(m->private);
//ust// }
//ust//
//ust// static int s_show(struct seq_file *m, void *p)
//ust// {
-//ust// struct marker_iter *iter = m->private;
+//ust// struct ust_marker_iter *iter = m->private;
//ust//
-//ust// seq_printf(m, "channel: %s marker: %s format: \"%s\" state: %d "
+//ust// seq_printf(m, "channel: %s ust_marker: %s format: \"%s\" state: %d "
//ust// "event_id: %hu call: 0x%p probe %s : 0x%p\n",
-//ust// iter->marker->channel,
-//ust// iter->marker->name, iter->marker->format,
-//ust// _imv_read(iter->marker->state),
-//ust// iter->marker->event_id,
-//ust// iter->marker->call,
-//ust// iter->marker->ptype ? "multi" : "single",
-//ust// iter->marker->ptype ?
-//ust// (void*)iter->marker->multi : (void*)iter->marker->single.func);
+//ust// iter->ust_marker->channel,
+//ust// iter->ust_marker->name, iter->ust_marker->format,
+//ust// _imv_read(iter->ust_marker->state),
+//ust// iter->ust_marker->event_id,
+//ust// iter->ust_marker->call,
+//ust// iter->ust_marker->ptype ? "multi" : "single",
+//ust// iter->ust_marker->ptype ?
+//ust// (void*)iter->ust_marker->multi : (void*)iter->ust_marker->single.func);
//ust// return 0;
//ust// }
//ust//
//ust// * the module mutex between those.
//ust// */
//ust// int ret;
-//ust// struct marker_iter *iter;
+//ust// struct ust_marker_iter *iter;
//ust//
//ust// iter = kzalloc(sizeof(*iter), GFP_KERNEL);
//ust// if (!iter)
//ust// .release = seq_release_private,
//ust// };
-static void disconnect_all_markers(void)
+static void disconnect_all_ust_markers(void)
{
- struct ltt_active_marker *pdata, *tmp;
+ struct ltt_active_ust_marker *pdata, *tmp;
- cds_list_for_each_entry_safe(pdata, tmp, &markers_loaded_list, node) {
- marker_probe_unregister_private_data(pdata->probe->probe_func,
+ cds_list_for_each_entry_safe(pdata, tmp, &ust_markers_loaded_list, node) {
+ ust_marker_probe_unregister_private_data(pdata->probe->probe_func,
pdata);
cds_list_del(&pdata->node);
free(pdata);
static char initialized = 0;
-void __attribute__((constructor)) init_marker_control(void)
+void __attribute__((constructor)) init_ust_marker_control(void)
{
if(!initialized) {
int ret;
//ust// pentry = create_proc_entry("ltt", S_IRUSR|S_IWUSR, NULL);
//ust// if (!pentry)
//ust// return -EBUSY;
-//ust// markers_loaded_cachep = KMEM_CACHE(ltt_active_marker, 0);
+//ust// ust_markers_loaded_cachep = KMEM_CACHE(ltt_active_ust_marker, 0);
ret = ltt_probe_register(&default_probe);
BUG_ON(ret);
- ret = ltt_marker_connect("metadata", "core_marker_format",
+ ret = ltt_ust_marker_connect("metadata", "core_marker_format",
DEFAULT_PROBE);
BUG_ON(ret);
- ret = ltt_marker_connect("metadata", "core_marker_id", DEFAULT_PROBE);
+ ret = ltt_ust_marker_connect("metadata", "core_marker_id", DEFAULT_PROBE);
BUG_ON(ret);
//ust// pentry->proc_fops = <t_fops;
initialized = 1;
}
}
-//ust// module_init(marker_control_init);
+//ust// module_init(ust_marker_control_init);
-static void __attribute__((destructor)) marker_control_exit(void)
+static void __attribute__((destructor)) ust_marker_control_exit(void)
{
int ret;
//ust// remove_proc_entry("ltt", NULL);
- ret = ltt_marker_disconnect("metadata", "core_marker_format",
+ ret = ltt_ust_marker_disconnect("metadata", "core_marker_format",
DEFAULT_PROBE);
BUG_ON(ret);
- ret = ltt_marker_disconnect("metadata", "core_marker_id",
+ ret = ltt_ust_marker_disconnect("metadata", "core_marker_id",
DEFAULT_PROBE);
BUG_ON(ret);
ret = ltt_probe_unregister(&default_probe);
BUG_ON(ret);
- disconnect_all_markers();
-//ust// kmem_cache_destroy(markers_loaded_cachep);
-//ust// marker_synchronize_unregister();
+ disconnect_all_ust_markers();
+//ust// kmem_cache_destroy(ust_markers_loaded_cachep);
+//ust// ust_marker_synchronize_unregister();
}
-//ust// module_exit(marker_control_exit);
+//ust// module_exit(ust_marker_control_exit);
//ust// MODULE_LICENSE("GPL");
//ust// MODULE_AUTHOR("Mathieu Desnoyers");
#ifndef MARKER_CONTROL_H
#define MARKER_CONTROL_H
-int init_marker_control(void);
+int init_ust_marker_control(void);
int ltt_probe_register(struct ltt_available_probe *pdata);
#endif /* MARKER_CONTROL_H */
__thread long ust_reg_stack[500];
volatile __thread long *ust_reg_stack_ptr = (long *) 0;
-extern struct marker * const __start___markers_ptrs[] __attribute__((visibility("hidden")));
-extern struct marker * const __stop___markers_ptrs[] __attribute__((visibility("hidden")));
+extern struct ust_marker * const __start___ust_marker_ptrs[] __attribute__((visibility("hidden")));
+extern struct ust_marker * const __stop___ust_marker_ptrs[] __attribute__((visibility("hidden")));
-/* Set to 1 to enable marker debug output */
-static const int marker_debug;
+/* Set to 1 to enable ust_marker debug output */
+static const int ust_marker_debug;
/*
- * markers_mutex nests inside module_mutex. Markers mutex protects the builtin
- * and module markers and the hash table.
+ * ust_marker_mutex nests inside module_mutex. ust_marker mutex protects
+ * the builtin and module ust_marker and the hash table.
*/
-static DEFINE_MUTEX(markers_mutex);
+static DEFINE_MUTEX(ust_marker_mutex);
-static CDS_LIST_HEAD(libs);
+static CDS_LIST_HEAD(ust_marker_libs);
-void lock_markers(void)
+void lock_ust_marker(void)
{
- pthread_mutex_lock(&markers_mutex);
+ pthread_mutex_lock(&ust_marker_mutex);
}
-void unlock_markers(void)
+void unlock_ust_marker(void)
{
- pthread_mutex_unlock(&markers_mutex);
+ pthread_mutex_unlock(&ust_marker_mutex);
}
/*
- * Marker hash table, containing the active markers.
+ * ust_marker hash table, containing the active ust_marker.
* Protected by module_mutex.
*/
-#define MARKER_HASH_BITS 6
-#define MARKER_TABLE_SIZE (1 << MARKER_HASH_BITS)
-static struct cds_hlist_head marker_table[MARKER_TABLE_SIZE];
+#define ust_marker_HASH_BITS 6
+#define ust_marker_TABLE_SIZE (1 << ust_marker_HASH_BITS)
+static struct cds_hlist_head ust_marker_table[ust_marker_TABLE_SIZE];
/*
* Note about RCU :
- * It is used to make sure every handler has finished using its private data
- * between two consecutive operation (add or remove) on a given marker. It is
- * also used to delay the free of multiple probes array until a quiescent state
- * is reached.
- * marker entries modifications are protected by the markers_mutex.
+ * It is used to make sure every handler has finished using its private
+ * data between two consecutive operation (add or remove) on a given
+ * ust_marker. It is also used to delay the free of multiple probes
+ * array until a quiescent state is reached. ust_marker entries
+ * modifications are protected by the ust_marker_mutex.
*/
-struct marker_entry {
+struct ust_marker_entry {
struct cds_hlist_node hlist;
char *format;
char *name;
/* Probe wrapper */
- void (*call)(const struct marker *mdata, void *call_private, struct registers *regs, ...);
- struct marker_probe_closure single;
- struct marker_probe_closure *multi;
+ void (*call)(const struct ust_marker *mdata, void *call_private, struct registers *regs, ...);
+ struct ust_marker_probe_closure single;
+ struct ust_marker_probe_closure *multi;
int refcount; /* Number of times armed. 0 if disarmed. */
struct rcu_head rcu;
void *oldptr;
char channel[0]; /* Contains channel'\0'name'\0'format'\0' */
};
-#ifdef CONFIG_MARKERS_USERSPACE
-static void marker_update_processes(void);
+#ifdef CONFIG_UST_MARKER_USERSPACE
+static void ust_marker_update_processes(void);
#else
-static void marker_update_processes(void)
+static void ust_marker_update_processes(void)
{
}
#endif
/**
- * __mark_empty_function - Empty probe callback
- * @mdata: marker data
+ * __ust_marker_empty_function - Empty probe callback
+ * @mdata: ust_marker data
* @probe_private: probe private data
* @call_private: call site private data
* @fmt: format string
* @...: variable argument list
*
- * Empty callback provided as a probe to the markers. By providing this to a
- * disabled marker, we make sure the execution flow is always valid even
- * though the function pointer change and the marker enabling are two distinct
- * operations that modifies the execution flow of preemptible code.
+ * Empty callback provided as a probe to the ust_marker. By providing
+ * this to a disabled ust_marker, we make sure the execution flow is
+ * always valid even though the function pointer change and the
+ * ust_marker enabling are two distinct operations that modifies the
+ * execution flow of preemptible code.
*/
-notrace void __mark_empty_function(const struct marker *mdata,
+notrace void __ust_marker_empty_function(const struct ust_marker *mdata,
void *probe_private, struct registers *regs, void *call_private, const char *fmt, va_list *args)
{
}
-//ust// EXPORT_SYMBOL_GPL(__mark_empty_function);
+//ust// EXPORT_SYMBOL_GPL(__ust_marker_empty_function);
/*
- * marker_probe_cb Callback that prepares the variable argument list for probes.
- * @mdata: pointer of type struct marker
+ * ust_marker_probe_cb Callback that prepares the variable argument list for probes.
+ * @mdata: pointer of type struct ust_marker
* @call_private: caller site private data
* @...: Variable argument list.
*
* need to put a full cmm_smp_rmb() in this branch. This is why we do not use
* rcu_dereference() for the pointer read.
*/
-notrace void marker_probe_cb(const struct marker *mdata,
+notrace void ust_marker_probe_cb(const struct ust_marker *mdata,
void *call_private, struct registers *regs, ...)
{
va_list args;
//ust// rcu_read_lock_sched_notrace();
ptype = mdata->ptype;
if (likely(!ptype)) {
- marker_probe_func *func;
+ ust_marker_probe_func *func;
/* Must read the ptype before ptr. They are not data dependant,
* so we put an explicit cmm_smp_rmb() here. */
cmm_smp_rmb();
mdata->format, &args);
va_end(args);
} else {
- struct marker_probe_closure *multi;
+ struct ust_marker_probe_closure *multi;
int i;
/*
* Read mdata->ptype before mdata->multi.
}
//ust// rcu_read_unlock_sched_notrace();
}
-//ust// EXPORT_SYMBOL_GPL(marker_probe_cb);
+//ust// EXPORT_SYMBOL_GPL(ust_marker_probe_cb);
/*
- * marker_probe_cb Callback that does not prepare the variable argument list.
- * @mdata: pointer of type struct marker
+ * ust_marker_probe_cb Callback that does not prepare the variable argument list.
+ * @mdata: pointer of type struct ust_marker
* @call_private: caller site private data
* @...: Variable argument list.
*
- * Should be connected to markers "MARK_NOARGS".
+ * Should be connected to ust_marker "UST_MARKER_NOARGS".
*/
-static notrace void marker_probe_cb_noarg(const struct marker *mdata,
+static notrace void ust_marker_probe_cb_noarg(const struct ust_marker *mdata,
void *call_private, struct registers *regs, ...)
{
va_list args; /* not initialized */
//ust// rcu_read_lock_sched_notrace();
ptype = mdata->ptype;
if (likely(!ptype)) {
- marker_probe_func *func;
+ ust_marker_probe_func *func;
/* Must read the ptype before ptr. They are not data dependant,
* so we put an explicit cmm_smp_rmb() here. */
cmm_smp_rmb();
func(mdata, mdata->single.probe_private, regs, call_private,
mdata->format, &args);
} else {
- struct marker_probe_closure *multi;
+ struct ust_marker_probe_closure *multi;
int i;
/*
* Read mdata->ptype before mdata->multi.
static void free_old_closure(struct rcu_head *head)
{
- struct marker_entry *entry = _ust_container_of(head,
- struct marker_entry, rcu);
+ struct ust_marker_entry *entry = _ust_container_of(head,
+ struct ust_marker_entry, rcu);
free(entry->oldptr);
/* Make sure we free the data before setting the pending flag to 0 */
cmm_smp_wmb();
entry->rcu_pending = 0;
}
-static void debug_print_probes(struct marker_entry *entry)
+static void debug_print_probes(struct ust_marker_entry *entry)
{
int i;
- if (!marker_debug)
+ if (!ust_marker_debug)
return;
if (!entry->ptype) {
}
}
-static struct marker_probe_closure *
-marker_entry_add_probe(struct marker_entry *entry,
- marker_probe_func *probe, void *probe_private)
+static struct ust_marker_probe_closure *
+ust_marker_entry_add_probe(struct ust_marker_entry *entry,
+ ust_marker_probe_func *probe, void *probe_private)
{
int nr_probes = 0;
- struct marker_probe_closure *old, *new;
+ struct ust_marker_probe_closure *old, *new;
WARN_ON(!probe);
if (entry->single.func == probe &&
entry->single.probe_private == probe_private)
return ERR_PTR(-EBUSY);
- if (entry->single.func == __mark_empty_function) {
+ if (entry->single.func == __ust_marker_empty_function) {
/* 0 -> 1 probes */
entry->single.func = probe;
entry->single.probe_private = probe_private;
return ERR_PTR(-EBUSY);
}
/* + 2 : one for new probe, one for NULL func */
- new = zmalloc((nr_probes + 2) * sizeof(struct marker_probe_closure));
+ new = zmalloc((nr_probes + 2) * sizeof(struct ust_marker_probe_closure));
if (new == NULL)
return ERR_PTR(-ENOMEM);
if (!old)
new[0] = entry->single;
else
memcpy(new, old,
- nr_probes * sizeof(struct marker_probe_closure));
+ nr_probes * sizeof(struct ust_marker_probe_closure));
new[nr_probes].func = probe;
new[nr_probes].probe_private = probe_private;
entry->refcount = nr_probes + 1;
return old;
}
-static struct marker_probe_closure *
-marker_entry_remove_probe(struct marker_entry *entry,
- marker_probe_func *probe, void *probe_private)
+static struct ust_marker_probe_closure *
+ust_marker_entry_remove_probe(struct ust_marker_entry *entry,
+ ust_marker_probe_func *probe, void *probe_private)
{
int nr_probes = 0, nr_del = 0, i;
- struct marker_probe_closure *old, *new;
+ struct ust_marker_probe_closure *old, *new;
old = entry->multi;
debug_print_probes(entry);
if (!entry->ptype) {
/* 0 -> N is an error */
- WARN_ON(entry->single.func == __mark_empty_function);
+ WARN_ON(entry->single.func == __ust_marker_empty_function);
/* 1 -> 0 probes */
WARN_ON(probe && entry->single.func != probe);
WARN_ON(entry->single.probe_private != probe_private);
- entry->single.func = __mark_empty_function;
+ entry->single.func = __ust_marker_empty_function;
entry->refcount = 0;
entry->ptype = 0;
debug_print_probes(entry);
if (nr_probes - nr_del == 0) {
/* N -> 0, (N > 1) */
- entry->single.func = __mark_empty_function;
+ entry->single.func = __ust_marker_empty_function;
entry->refcount = 0;
entry->ptype = 0;
} else if (nr_probes - nr_del == 1) {
int j = 0;
/* N -> M, (N > 1, M > 1) */
/* + 1 for NULL */
- new = zmalloc((nr_probes - nr_del + 1) * sizeof(struct marker_probe_closure));
+ new = zmalloc((nr_probes - nr_del + 1) * sizeof(struct ust_marker_probe_closure));
if (new == NULL)
return ERR_PTR(-ENOMEM);
for (i = 0; old[i].func; i++)
}
/*
- * Get marker if the marker is present in the marker hash table.
- * Must be called with markers_mutex held.
+ * Get ust_marker if the ust_marker is present in the ust_marker hash table.
+ * Must be called with ust_marker_mutex held.
* Returns NULL if not present.
*/
-static struct marker_entry *get_marker(const char *channel, const char *name)
+static struct ust_marker_entry *get_ust_marker(const char *channel, const char *name)
{
struct cds_hlist_head *head;
struct cds_hlist_node *node;
- struct marker_entry *e;
+ struct ust_marker_entry *e;
size_t channel_len = strlen(channel) + 1;
size_t name_len = strlen(name) + 1;
u32 hash;
hash = jhash(channel, channel_len-1, 0) ^ jhash(name, name_len-1, 0);
- head = &marker_table[hash & ((1 << MARKER_HASH_BITS)-1)];
+ head = &ust_marker_table[hash & ((1 << ust_marker_HASH_BITS)-1)];
cds_hlist_for_each_entry(e, node, head, hlist) {
if (!strcmp(channel, e->channel) && !strcmp(name, e->name))
return e;
}
/*
- * Add the marker to the marker hash table. Must be called with markers_mutex
- * held.
+ * Add the ust_marker to the ust_marker hash table. Must be called with
+ * ust_marker_mutex held.
*/
-static struct marker_entry *add_marker(const char *channel, const char *name,
+static struct ust_marker_entry *add_ust_marker(const char *channel, const char *name,
const char *format)
{
struct cds_hlist_head *head;
struct cds_hlist_node *node;
- struct marker_entry *e;
+ struct ust_marker_entry *e;
size_t channel_len = strlen(channel) + 1;
size_t name_len = strlen(name) + 1;
size_t format_len = 0;
hash = jhash(channel, channel_len-1, 0) ^ jhash(name, name_len-1, 0);
if (format)
format_len = strlen(format) + 1;
- head = &marker_table[hash & ((1 << MARKER_HASH_BITS)-1)];
+ head = &ust_marker_table[hash & ((1 << ust_marker_HASH_BITS)-1)];
cds_hlist_for_each_entry(e, node, head, hlist) {
if (!strcmp(channel, e->channel) && !strcmp(name, e->name)) {
- DBG("Marker %s.%s busy", channel, name);
+ DBG("ust_marker %s.%s busy", channel, name);
return ERR_PTR(-EBUSY); /* Already there */
}
}
* Using zmalloc here to allocate a variable length element. Could
* cause some memory fragmentation if overused.
*/
- e = zmalloc(sizeof(struct marker_entry)
+ e = zmalloc(sizeof(struct ust_marker_entry)
+ channel_len + name_len + format_len);
if (!e)
return ERR_PTR(-ENOMEM);
if (format) {
e->format = &e->name[name_len];
memcpy(e->format, format, format_len);
- if (strcmp(e->format, MARK_NOARGS) == 0)
- e->call = marker_probe_cb_noarg;
+ if (strcmp(e->format, UST_MARKER_NOARGS) == 0)
+ e->call = ust_marker_probe_cb_noarg;
else
- e->call = marker_probe_cb;
+ e->call = ust_marker_probe_cb;
__ust_marker(0, metadata, core_marker_format, NULL,
"channel %s name %s format %s",
e->channel, e->name, e->format);
} else {
e->format = NULL;
- e->call = marker_probe_cb;
+ e->call = ust_marker_probe_cb;
}
- e->single.func = __mark_empty_function;
+ e->single.func = __ust_marker_empty_function;
e->single.probe_private = NULL;
e->multi = NULL;
e->ptype = 0;
}
/*
- * Remove the marker from the marker hash table. Must be called with mutex_lock
+ * Remove the ust_marker from the ust_marker hash table. Must be called with mutex_lock
* held.
*/
-static int remove_marker(const char *channel, const char *name)
+static int remove_ust_marker(const char *channel, const char *name)
{
struct cds_hlist_head *head;
struct cds_hlist_node *node;
- struct marker_entry *e;
+ struct ust_marker_entry *e;
int found = 0;
size_t channel_len = strlen(channel) + 1;
size_t name_len = strlen(name) + 1;
int ret;
hash = jhash(channel, channel_len-1, 0) ^ jhash(name, name_len-1, 0);
- head = &marker_table[hash & ((1 << MARKER_HASH_BITS)-1)];
+ head = &ust_marker_table[hash & ((1 << ust_marker_HASH_BITS)-1)];
cds_hlist_for_each_entry(e, node, head, hlist) {
if (!strcmp(channel, e->channel) && !strcmp(name, e->name)) {
found = 1;
}
if (!found)
return -ENOENT;
- if (e->single.func != __mark_empty_function)
+ if (e->single.func != __ust_marker_empty_function)
return -EBUSY;
cds_hlist_del(&e->hlist);
if (e->format_allocated)
/*
* Set the mark_entry format to the format found in the element.
*/
-static int marker_set_format(struct marker_entry *entry, const char *format)
+static int ust_marker_set_format(struct ust_marker_entry *entry, const char *format)
{
entry->format = strdup(format);
if (!entry->format)
}
/*
- * Sets the probe callback corresponding to one marker.
+ * Sets the probe callback corresponding to one ust_marker.
*/
-static int set_marker(struct marker_entry *entry, struct marker *elem,
+static int set_ust_marker(struct ust_marker_entry *entry, struct ust_marker *elem,
int active)
{
int ret = 0;
if (entry->format) {
if (strcmp(entry->format, elem->format) != 0) {
- ERR("Format mismatch for probe %s (%s), marker (%s)",
+ ERR("Format mismatch for probe %s (%s), ust_marker (%s)",
entry->name,
entry->format,
elem->format);
return -EPERM;
}
} else {
- ret = marker_set_format(entry, elem->format);
+ ret = ust_marker_set_format(entry, elem->format);
if (ret)
return ret;
}
* We only update the single probe private data when the ptr is
* set to a _non_ single probe! (0 -> 1 and N -> 1, N != 1)
*/
- WARN_ON(elem->single.func != __mark_empty_function
+ WARN_ON(elem->single.func != __ust_marker_empty_function
&& elem->single.probe_private != entry->single.probe_private
&& !elem->ptype);
elem->single.probe_private = entry->single.probe_private;
if (active) {
/*
* try_module_get should always succeed because we hold
- * markers_mutex to get the tp_cb address.
+ * ust_marker_mutex to get the tp_cb address.
*/
//ust// ret = try_module_get(__module_text_address(
//ust// (unsigned long)elem->tp_cb));
}
/*
- * Disable a marker and its probe callback.
+ * Disable a ust_marker and its probe callback.
* Note: only waiting an RCU period after setting elem->call to the empty
* function insures that the original callback is not used anymore. This insured
* by rcu_read_lock_sched around the call site.
*/
-static void disable_marker(struct marker *elem)
+static void disable_ust_marker(struct ust_marker *elem)
{
int ret;
//ust// module_put(__module_text_address((unsigned long)elem->tp_cb));
}
elem->state__imv = 0;
- elem->single.func = __mark_empty_function;
+ elem->single.func = __ust_marker_empty_function;
/* Update the function before setting the ptype */
cmm_smp_wmb();
elem->ptype = 0; /* single probe */
}
/*
- * is_marker_enabled - Check if a marker is enabled
+ * is_ust_marker_enabled - Check if a ust_marker is enabled
* @channel: channel name
- * @name: marker name
+ * @name: ust_marker name
*
- * Returns 1 if the marker is enabled, 0 if disabled.
+ * Returns 1 if the ust_marker is enabled, 0 if disabled.
*/
-int is_marker_enabled(const char *channel, const char *name)
+int is_ust_marker_enabled(const char *channel, const char *name)
{
- struct marker_entry *entry;
+ struct ust_marker_entry *entry;
- pthread_mutex_lock(&markers_mutex);
- entry = get_marker(channel, name);
- pthread_mutex_unlock(&markers_mutex);
+ pthread_mutex_lock(&ust_marker_mutex);
+ entry = get_ust_marker(channel, name);
+ pthread_mutex_unlock(&ust_marker_mutex);
return entry && !!entry->refcount;
}
/**
- * marker_update_probe_range - Update a probe range
+ * ust_marker_update_probe_range - Update a probe range
* @begin: beginning of the range
* @end: end of the range
*
- * Updates the probe callback corresponding to a range of markers.
+ * Updates the probe callback corresponding to a range of ust_marker.
*/
-void marker_update_probe_range(struct marker * const *begin,
- struct marker * const *end)
+void ust_marker_update_probe_range(struct ust_marker * const *begin,
+ struct ust_marker * const *end)
{
- struct marker * const *iter;
- struct marker_entry *mark_entry;
+ struct ust_marker * const *iter;
+ struct ust_marker_entry *mark_entry;
- pthread_mutex_lock(&markers_mutex);
+ pthread_mutex_lock(&ust_marker_mutex);
for (iter = begin; iter < end; iter++) {
if (!*iter)
continue; /* skip dummy */
- mark_entry = get_marker((*iter)->channel, (*iter)->name);
+ mark_entry = get_ust_marker((*iter)->channel, (*iter)->name);
if (mark_entry) {
- set_marker(mark_entry, *iter, !!mark_entry->refcount);
+ set_ust_marker(mark_entry, *iter, !!mark_entry->refcount);
/*
* ignore error, continue
*/
} else {
- disable_marker(*iter);
+ disable_ust_marker(*iter);
}
}
- pthread_mutex_unlock(&markers_mutex);
+ pthread_mutex_unlock(&ust_marker_mutex);
}
-static void lib_update_markers(void)
+static void lib_update_ust_marker(void)
{
- struct lib *lib;
+ struct ust_marker_lib *lib;
/* FIXME: we should probably take a mutex here on libs */
//ust// pthread_mutex_lock(&module_mutex);
- cds_list_for_each_entry(lib, &libs, list)
- marker_update_probe_range(lib->markers_start,
- lib->markers_start + lib->markers_count);
+ cds_list_for_each_entry(lib, &ust_marker_libs, list)
+ ust_marker_update_probe_range(lib->ust_marker_start,
+ lib->ust_marker_start + lib->ust_marker_count);
//ust// pthread_mutex_unlock(&module_mutex);
}
* 1 -> 2 callbacks
* 2 -> 1 callbacks
* Other updates all behave the same, just like the 2 -> 3 or 3 -> 2 updates.
- * Site effect : marker_set_format may delete the marker entry (creating a
+ * Site effect : ust_marker_set_format may delete the ust_marker entry (creating a
* replacement).
*/
-static void marker_update_probes(void)
+static void ust_marker_update_probes(void)
{
- lib_update_markers();
+ lib_update_ust_marker();
tracepoint_probe_update_all();
/* Update immediate values */
core_imv_update();
//ust// module_imv_update(); /* FIXME: need to port for libs? */
- marker_update_processes();
+ ust_marker_update_processes();
}
/**
- * marker_probe_register - Connect a probe to a marker
- * @channel: marker channel
- * @name: marker name
+ * ust_marker_probe_register - Connect a probe to a ust_marker
+ * @channel: ust_marker channel
+ * @name: ust_marker name
* @format: format string
* @probe: probe handler
* @probe_private: probe private data
* Returns 0 if ok, error value on error.
* The probe address must at least be aligned on the architecture pointer size.
*/
-int marker_probe_register(const char *channel, const char *name,
- const char *format, marker_probe_func *probe,
+int ust_marker_probe_register(const char *channel, const char *name,
+ const char *format, ust_marker_probe_func *probe,
void *probe_private)
{
- struct marker_entry *entry;
+ struct ust_marker_entry *entry;
int ret = 0, ret_err;
- struct marker_probe_closure *old;
+ struct ust_marker_probe_closure *old;
int first_probe = 0;
- pthread_mutex_lock(&markers_mutex);
- entry = get_marker(channel, name);
+ pthread_mutex_lock(&ust_marker_mutex);
+ entry = get_ust_marker(channel, name);
if (!entry) {
first_probe = 1;
- entry = add_marker(channel, name, format);
+ entry = add_ust_marker(channel, name, format);
if (IS_ERR(entry))
ret = PTR_ERR(entry);
if (ret)
goto end;
ret = ltt_channels_register(channel);
if (ret)
- goto error_remove_marker;
+ goto error_remove_ust_marker;
ret = ltt_channels_get_index_from_name(channel);
if (ret < 0)
goto error_unregister_channel;
sizeof(size_t), ltt_get_alignment());
} else if (format) {
if (!entry->format)
- ret = marker_set_format(entry, format);
+ ret = ust_marker_set_format(entry, format);
else if (strcmp(entry->format, format))
ret = -EPERM;
if (ret)
}
/*
- * If we detect that a call_rcu is pending for this marker,
+ * If we detect that a call_rcu is pending for this ust_marker,
* make sure it's executed now.
*/
//ust// if (entry->rcu_pending)
//ust// rcu_cmm_barrier_sched();
- old = marker_entry_add_probe(entry, probe, probe_private);
+ old = ust_marker_entry_add_probe(entry, probe, probe_private);
if (IS_ERR(old)) {
ret = PTR_ERR(old);
if (first_probe)
else
goto end;
}
- pthread_mutex_unlock(&markers_mutex);
+ pthread_mutex_unlock(&ust_marker_mutex);
- /* Activate marker if necessary */
- marker_update_probes();
+ /* Activate ust_marker if necessary */
+ ust_marker_update_probes();
- pthread_mutex_lock(&markers_mutex);
- entry = get_marker(channel, name);
+ pthread_mutex_lock(&ust_marker_mutex);
+ entry = get_ust_marker(channel, name);
if (!entry)
goto end;
//ust// if (entry->rcu_pending)
error_unregister_channel:
ret_err = ltt_channels_unregister(channel);
WARN_ON(ret_err);
-error_remove_marker:
- ret_err = remove_marker(channel, name);
+error_remove_ust_marker:
+ ret_err = remove_ust_marker(channel, name);
WARN_ON(ret_err);
end:
- pthread_mutex_unlock(&markers_mutex);
+ pthread_mutex_unlock(&ust_marker_mutex);
return ret;
}
-//ust// EXPORT_SYMBOL_GPL(marker_probe_register);
+//ust// EXPORT_SYMBOL_GPL(ust_marker_probe_register);
/**
- * marker_probe_unregister - Disconnect a probe from a marker
- * @channel: marker channel
- * @name: marker name
+ * ust_marker_probe_unregister - Disconnect a probe from a ust_marker
+ * @channel: ust_marker channel
+ * @name: ust_marker name
* @probe: probe function pointer
* @probe_private: probe private data
*
- * Returns the private data given to marker_probe_register, or an ERR_PTR().
+ * Returns the private data given to ust_marker_probe_register, or an ERR_PTR().
* We do not need to call a synchronize_sched to make sure the probes have
* finished running before doing a module unload, because the module unload
* itself uses stop_machine(), which insures that every preempt disabled section
* have finished.
*/
-int marker_probe_unregister(const char *channel, const char *name,
- marker_probe_func *probe, void *probe_private)
+int ust_marker_probe_unregister(const char *channel, const char *name,
+ ust_marker_probe_func *probe, void *probe_private)
{
- struct marker_entry *entry;
- struct marker_probe_closure *old;
+ struct ust_marker_entry *entry;
+ struct ust_marker_probe_closure *old;
int ret = -ENOENT;
- pthread_mutex_lock(&markers_mutex);
- entry = get_marker(channel, name);
+ pthread_mutex_lock(&ust_marker_mutex);
+ entry = get_ust_marker(channel, name);
if (!entry)
goto end;
//ust// if (entry->rcu_pending)
//ust// rcu_cmm_barrier_sched();
- old = marker_entry_remove_probe(entry, probe, probe_private);
- pthread_mutex_unlock(&markers_mutex);
+ old = ust_marker_entry_remove_probe(entry, probe, probe_private);
+ pthread_mutex_unlock(&ust_marker_mutex);
- marker_update_probes();
+ ust_marker_update_probes();
- pthread_mutex_lock(&markers_mutex);
- entry = get_marker(channel, name);
+ pthread_mutex_lock(&ust_marker_mutex);
+ entry = get_ust_marker(channel, name);
if (!entry)
goto end;
//ust// if (entry->rcu_pending)
cmm_smp_wmb();
//ust// call_rcu_sched(&entry->rcu, free_old_closure);
synchronize_rcu(); free_old_closure(&entry->rcu);
- remove_marker(channel, name); /* Ignore busy error message */
+ remove_ust_marker(channel, name); /* Ignore busy error message */
ret = 0;
end:
- pthread_mutex_unlock(&markers_mutex);
+ pthread_mutex_unlock(&ust_marker_mutex);
return ret;
}
-//ust// EXPORT_SYMBOL_GPL(marker_probe_unregister);
+//ust// EXPORT_SYMBOL_GPL(ust_marker_probe_unregister);
-static struct marker_entry *
-get_marker_from_private_data(marker_probe_func *probe, void *probe_private)
+static struct ust_marker_entry *
+get_ust_marker_from_private_data(ust_marker_probe_func *probe, void *probe_private)
{
- struct marker_entry *entry;
+ struct ust_marker_entry *entry;
unsigned int i;
struct cds_hlist_head *head;
struct cds_hlist_node *node;
- for (i = 0; i < MARKER_TABLE_SIZE; i++) {
- head = &marker_table[i];
+ for (i = 0; i < ust_marker_TABLE_SIZE; i++) {
+ head = &ust_marker_table[i];
cds_hlist_for_each_entry(entry, node, head, hlist) {
if (!entry->ptype) {
if (entry->single.func == probe
== probe_private)
return entry;
} else {
- struct marker_probe_closure *closure;
+ struct ust_marker_probe_closure *closure;
closure = entry->multi;
for (i = 0; closure[i].func; i++) {
if (closure[i].func == probe &&
}
/**
- * marker_probe_unregister_private_data - Disconnect a probe from a marker
+ * ust_marker_probe_unregister_private_data - Disconnect a probe from a ust_marker
* @probe: probe function
* @probe_private: probe private data
*
* Unregister a probe by providing the registered private data.
- * Only removes the first marker found in hash table.
+ * Only removes the first ust_marker found in hash table.
* Return 0 on success or error value.
* We do not need to call a synchronize_sched to make sure the probes have
* finished running before doing a module unload, because the module unload
* itself uses stop_machine(), which insures that every preempt disabled section
* have finished.
*/
-int marker_probe_unregister_private_data(marker_probe_func *probe,
+int ust_marker_probe_unregister_private_data(ust_marker_probe_func *probe,
void *probe_private)
{
- struct marker_entry *entry;
+ struct ust_marker_entry *entry;
int ret = 0;
- struct marker_probe_closure *old;
+ struct ust_marker_probe_closure *old;
char *channel = NULL, *name = NULL;
- pthread_mutex_lock(&markers_mutex);
- entry = get_marker_from_private_data(probe, probe_private);
+ pthread_mutex_lock(&ust_marker_mutex);
+ entry = get_ust_marker_from_private_data(probe, probe_private);
if (!entry) {
ret = -ENOENT;
goto end;
}
//ust// if (entry->rcu_pending)
//ust// rcu_cmm_barrier_sched();
- old = marker_entry_remove_probe(entry, NULL, probe_private);
+ old = ust_marker_entry_remove_probe(entry, NULL, probe_private);
channel = strdup(entry->channel);
name = strdup(entry->name);
- pthread_mutex_unlock(&markers_mutex);
+ pthread_mutex_unlock(&ust_marker_mutex);
- marker_update_probes();
+ ust_marker_update_probes();
- pthread_mutex_lock(&markers_mutex);
- entry = get_marker(channel, name);
+ pthread_mutex_lock(&ust_marker_mutex);
+ entry = get_ust_marker(channel, name);
if (!entry)
goto end;
//ust// if (entry->rcu_pending)
//ust// call_rcu_sched(&entry->rcu, free_old_closure);
synchronize_rcu(); free_old_closure(&entry->rcu);
/* Ignore busy error message */
- remove_marker(channel, name);
+ remove_ust_marker(channel, name);
end:
- pthread_mutex_unlock(&markers_mutex);
+ pthread_mutex_unlock(&ust_marker_mutex);
free(channel);
free(name);
return ret;
}
-//ust// EXPORT_SYMBOL_GPL(marker_probe_unregister_private_data);
+//ust// EXPORT_SYMBOL_GPL(ust_marker_probe_unregister_private_data);
/**
- * marker_get_private_data - Get a marker's probe private data
- * @channel: marker channel
- * @name: marker name
+ * ust_marker_get_private_data - Get a ust_marker's probe private data
+ * @channel: ust_marker channel
+ * @name: ust_marker name
* @probe: probe to match
* @num: get the nth matching probe's private data
*
* owner of the data, or its content could vanish. This is mostly used to
* confirm that a caller is the owner of a registered probe.
*/
-void *marker_get_private_data(const char *channel, const char *name,
- marker_probe_func *probe, int num)
+void *ust_marker_get_private_data(const char *channel, const char *name,
+ ust_marker_probe_func *probe, int num)
{
struct cds_hlist_head *head;
struct cds_hlist_node *node;
- struct marker_entry *e;
+ struct ust_marker_entry *e;
size_t channel_len = strlen(channel) + 1;
size_t name_len = strlen(name) + 1;
int i;
u32 hash;
hash = jhash(channel, channel_len-1, 0) ^ jhash(name, name_len-1, 0);
- head = &marker_table[hash & ((1 << MARKER_HASH_BITS)-1)];
+ head = &ust_marker_table[hash & ((1 << ust_marker_HASH_BITS)-1)];
cds_hlist_for_each_entry(e, node, head, hlist) {
if (!strcmp(channel, e->channel) && !strcmp(name, e->name)) {
if (!e->ptype) {
if (num == 0 && e->single.func == probe)
return e->single.probe_private;
} else {
- struct marker_probe_closure *closure;
+ struct ust_marker_probe_closure *closure;
int match = 0;
closure = e->multi;
for (i = 0; closure[i].func; i++) {
}
return ERR_PTR(-ENOENT);
}
-//ust// EXPORT_SYMBOL_GPL(marker_get_private_data);
+//ust// EXPORT_SYMBOL_GPL(ust_marker_get_private_data);
/**
- * markers_compact_event_ids - Compact markers event IDs and reassign channels
+ * ust_marker_compact_event_ids - Compact ust_marker event IDs and reassign channels
*
* Called when no channel users are active by the channel infrastructure.
- * Called with lock_markers() and channel mutex held.
+ * Called with lock_ust_marker() and channel mutex held.
*/
-//ust// void markers_compact_event_ids(void)
+//ust// void ust_marker_compact_event_ids(void)
//ust// {
-//ust// struct marker_entry *entry;
+//ust// struct ust_marker_entry *entry;
//ust// unsigned int i;
//ust// struct hlist_head *head;
//ust// struct hlist_node *node;
//ust// int ret;
//ust//
-//ust// for (i = 0; i < MARKER_TABLE_SIZE; i++) {
-//ust// head = &marker_table[i];
+//ust// for (i = 0; i < ust_marker_TABLE_SIZE; i++) {
+//ust// head = &ust_marker_table[i];
//ust// hlist_for_each_entry(entry, node, head, hlist) {
//ust// ret = ltt_channels_get_index_from_name(entry->channel);
//ust// WARN_ON(ret < 0);
* Returns 0 if current not found.
* Returns 1 if current found.
*/
-int lib_get_iter_markers(struct marker_iter *iter)
+int lib_get_iter_ust_marker(struct ust_marker_iter *iter)
{
- struct lib *iter_lib;
+ struct ust_marker_lib *iter_lib;
int found = 0;
//ust// pthread_mutex_lock(&module_mutex);
- cds_list_for_each_entry(iter_lib, &libs, list) {
+ cds_list_for_each_entry(iter_lib, &ust_marker_libs, list) {
if (iter_lib < iter->lib)
continue;
else if (iter_lib > iter->lib)
- iter->marker = NULL;
- found = marker_get_iter_range(&iter->marker,
- iter_lib->markers_start,
- iter_lib->markers_start + iter_lib->markers_count);
+ iter->ust_marker = NULL;
+ found = ust_marker_get_iter_range(&iter->ust_marker,
+ iter_lib->ust_marker_start,
+ iter_lib->ust_marker_start + iter_lib->ust_marker_count);
if (found) {
iter->lib = iter_lib;
break;
}
/**
- * marker_get_iter_range - Get a next marker iterator given a range.
- * @marker: current markers (in), next marker (out)
+ * ust_marker_get_iter_range - Get a next ust_marker iterator given a range.
+ * @ust_marker: current ust_marker (in), next ust_marker (out)
* @begin: beginning of the range
* @end: end of the range
*
- * Returns whether a next marker has been found (1) or not (0).
- * Will return the first marker in the range if the input marker is NULL.
+ * Returns whether a next ust_marker has been found (1) or not (0).
+ * Will return the first ust_marker in the range if the input ust_marker is NULL.
*/
-int marker_get_iter_range(struct marker * const **marker,
- struct marker * const *begin,
- struct marker * const *end)
+int ust_marker_get_iter_range(struct ust_marker * const **ust_marker,
+ struct ust_marker * const *begin,
+ struct ust_marker * const *end)
{
- if (!*marker && begin != end)
- *marker = begin;
- while (*marker >= begin && *marker < end) {
- if (!**marker)
- (*marker)++; /* skip dummy */
+ if (!*ust_marker && begin != end)
+ *ust_marker = begin;
+ while (*ust_marker >= begin && *ust_marker < end) {
+ if (!**ust_marker)
+ (*ust_marker)++; /* skip dummy */
else
return 1;
}
return 0;
}
-//ust// EXPORT_SYMBOL_GPL(marker_get_iter_range);
+//ust// EXPORT_SYMBOL_GPL(ust_marker_get_iter_range);
-static void marker_get_iter(struct marker_iter *iter)
+static void ust_marker_get_iter(struct ust_marker_iter *iter)
{
int found = 0;
- found = lib_get_iter_markers(iter);
+ found = lib_get_iter_ust_marker(iter);
if (!found)
- marker_iter_reset(iter);
+ ust_marker_iter_reset(iter);
}
-void marker_iter_start(struct marker_iter *iter)
+void ust_marker_iter_start(struct ust_marker_iter *iter)
{
- marker_get_iter(iter);
+ ust_marker_get_iter(iter);
}
-//ust// EXPORT_SYMBOL_GPL(marker_iter_start);
+//ust// EXPORT_SYMBOL_GPL(ust_marker_iter_start);
-void marker_iter_next(struct marker_iter *iter)
+void ust_marker_iter_next(struct ust_marker_iter *iter)
{
- iter->marker++;
+ iter->ust_marker++;
/*
- * iter->marker may be invalid because we blindly incremented it.
- * Make sure it is valid by marshalling on the markers, getting the
- * markers from following modules if necessary.
+ * iter->ust_marker may be invalid because we blindly incremented it.
+ * Make sure it is valid by marshalling on the ust_marker, getting the
+ * ust_marker from following modules if necessary.
*/
- marker_get_iter(iter);
+ ust_marker_get_iter(iter);
}
-//ust// EXPORT_SYMBOL_GPL(marker_iter_next);
+//ust// EXPORT_SYMBOL_GPL(ust_marker_iter_next);
-void marker_iter_stop(struct marker_iter *iter)
+void ust_marker_iter_stop(struct ust_marker_iter *iter)
{
}
-//ust// EXPORT_SYMBOL_GPL(marker_iter_stop);
+//ust// EXPORT_SYMBOL_GPL(ust_marker_iter_stop);
-void marker_iter_reset(struct marker_iter *iter)
+void ust_marker_iter_reset(struct ust_marker_iter *iter)
{
iter->lib = NULL;
- iter->marker = NULL;
+ iter->ust_marker = NULL;
}
-//ust// EXPORT_SYMBOL_GPL(marker_iter_reset);
+//ust// EXPORT_SYMBOL_GPL(ust_marker_iter_reset);
-#ifdef CONFIG_MARKERS_USERSPACE
+#ifdef CONFIG_UST_MARKER_USERSPACE
/*
- * must be called with current->user_markers_mutex held
+ * must be called with current->user_ust_marker_mutex held
*/
-static void free_user_marker(char __user *state, struct cds_hlist_head *head)
+static void free_user_ust_marker(char __user *state, struct cds_hlist_head *head)
{
- struct user_marker *umark;
+ struct user_ust_marker *umark;
struct cds_hlist_node *pos, *n;
cds_hlist_for_each_entry_safe(umark, pos, n, head, hlist) {
/*
* Update current process.
* Note that we have to wait a whole scheduler period before we are sure that
- * every running userspace threads have their markers updated.
+ * every running userspace threads have their ust_marker updated.
* (synchronize_sched() can be used to insure this).
*/
-//ust// void marker_update_process(void)
+//ust// void ust_marker_update_process(void)
//ust// {
-//ust// struct user_marker *umark;
+//ust// struct user_ust_marker *umark;
//ust// struct hlist_node *pos;
-//ust// struct marker_entry *entry;
+//ust// struct ust_marker_entry *entry;
//ust//
-//ust// pthread_mutex_lock(&markers_mutex);
-//ust// pthread_mutex_lock(¤t->group_leader->user_markers_mutex);
+//ust// pthread_mutex_lock(&ust_marker_mutex);
+//ust// pthread_mutex_lock(¤t->group_leader->user_ust_marker_mutex);
//ust// if (strcmp(current->comm, "testprog") == 0)
//ust// DBG("do update pending for testprog");
//ust// hlist_for_each_entry(umark, pos,
-//ust// ¤t->group_leader->user_markers, hlist) {
-//ust// DBG("Updating marker %s in %s", umark->name, current->comm);
-//ust// entry = get_marker("userspace", umark->name);
+//ust// ¤t->group_leader->user_ust_marker, hlist) {
+//ust// DBG("Updating ust_marker %s in %s", umark->name, current->comm);
+//ust// entry = get_ust_marker("userspace", umark->name);
//ust// if (entry) {
//ust// if (entry->format &&
//ust// strcmp(entry->format, umark->format) != 0) {
//ust// break;
//ust// }
//ust// if (put_user(!!entry->refcount, umark->state)) {
-//ust// WARN("Marker in %s caused a fault",
+//ust// WARN("ust_marker in %s caused a fault",
//ust// current->comm);
//ust// break;
//ust// }
//ust// } else {
//ust// if (put_user(0, umark->state)) {
-//ust// WARN("Marker in %s caused a fault", current->comm);
+//ust// WARN("ust_marker in %s caused a fault", current->comm);
//ust// break;
//ust// }
//ust// }
//ust// }
-//ust// clear_thread_flag(TIF_MARKER_PENDING);
-//ust// pthread_mutex_unlock(¤t->group_leader->user_markers_mutex);
-//ust// pthread_mutex_unlock(&markers_mutex);
+//ust// clear_thread_flag(TIF_ust_marker_PENDING);
+//ust// pthread_mutex_unlock(¤t->group_leader->user_ust_marker_mutex);
+//ust// pthread_mutex_unlock(&ust_marker_mutex);
//ust// }
/*
* We assume that when the leader exits, no more references can be done to the
* leader structure by the other threads.
*/
-void exit_user_markers(struct task_struct *p)
+void exit_user_ust_marker(struct task_struct *p)
{
- struct user_marker *umark;
+ struct user_ust_marker *umark;
struct cds_hlist_node *pos, *n;
if (thread_group_leader(p)) {
- pthread_mutex_lock(&markers_mutex);
- pthread_mutex_lock(&p->user_markers_mutex);
- cds_hlist_for_each_entry_safe(umark, pos, n, &p->user_markers,
+ pthread_mutex_lock(&ust_marker_mutex);
+ pthread_mutex_lock(&p->user_ust_marker_mutex);
+ cds_hlist_for_each_entry_safe(umark, pos, n, &p->user_ust_marker,
hlist)
free(umark);
- INIT_HLIST_HEAD(&p->user_markers);
- p->user_markers_sequence++;
- pthread_mutex_unlock(&p->user_markers_mutex);
- pthread_mutex_unlock(&markers_mutex);
+ INIT_HLIST_HEAD(&p->user_ust_marker);
+ p->user_ust_marker_sequence++;
+ pthread_mutex_unlock(&p->user_ust_marker_mutex);
+ pthread_mutex_unlock(&ust_marker_mutex);
}
}
-int is_marker_enabled(const char *channel, const char *name)
+int is_ust_marker_enabled(const char *channel, const char *name)
{
- struct marker_entry *entry;
+ struct ust_marker_entry *entry;
- pthread_mutex_lock(&markers_mutex);
- entry = get_marker(channel, name);
- pthread_mutex_unlock(&markers_mutex);
+ pthread_mutex_lock(&ust_marker_mutex);
+ entry = get_ust_marker(channel, name);
+ pthread_mutex_unlock(&ust_marker_mutex);
return entry && !!entry->refcount;
}
//ust// #endif
-int marker_module_notify(struct notifier_block *self,
+int ust_marker_module_notify(struct notifier_block *self,
unsigned long val, void *data)
{
struct module *mod = data;
switch (val) {
case MODULE_STATE_COMING:
- marker_update_probe_range(mod->markers,
- mod->markers + mod->num_markers);
+ ust_marker_update_probe_range(mod->ust_marker,
+ mod->ust_marker + mod->num_ust_marker);
break;
case MODULE_STATE_GOING:
- marker_update_probe_range(mod->markers,
- mod->markers + mod->num_markers);
+ ust_marker_update_probe_range(mod->ust_marker,
+ mod->ust_marker + mod->num_ust_marker);
break;
}
return 0;
}
-struct notifier_block marker_module_nb = {
- .notifier_call = marker_module_notify,
+struct notifier_block ust_marker_module_nb = {
+ .notifier_call = ust_marker_module_notify,
.priority = 0,
};
-//ust// static int init_markers(void)
+//ust// static int init_ust_marker(void)
//ust// {
-//ust// return register_module_notifier(&marker_module_nb);
+//ust// return register_module_notifier(&ust_marker_module_nb);
//ust// }
-//ust// __initcall(init_markers);
-/* TODO: call marker_module_nb() when a library is linked at runtime (dlopen)? */
+//ust// __initcall(init_ust_marker);
+/* TODO: call ust_marker_module_nb() when a library is linked at runtime (dlopen)? */
#endif /* CONFIG_MODULES */
-void ltt_dump_marker_state(struct ust_trace *trace)
+void ltt_dump_ust_marker_state(struct ust_trace *trace)
{
- struct marker_entry *entry;
+ struct ust_marker_entry *entry;
struct ltt_probe_private_data call_data;
struct cds_hlist_head *head;
struct cds_hlist_node *node;
unsigned int i;
- pthread_mutex_lock(&markers_mutex);
+ pthread_mutex_lock(&ust_marker_mutex);
call_data.trace = trace;
call_data.serializer = NULL;
- for (i = 0; i < MARKER_TABLE_SIZE; i++) {
- head = &marker_table[i];
+ for (i = 0; i < ust_marker_TABLE_SIZE; i++) {
+ head = &ust_marker_table[i];
cds_hlist_for_each_entry(entry, node, head, hlist) {
__ust_marker(0, metadata, core_marker_id,
&call_data,
entry->format);
}
}
- pthread_mutex_unlock(&markers_mutex);
+ pthread_mutex_unlock(&ust_marker_mutex);
}
-//ust// EXPORT_SYMBOL_GPL(ltt_dump_marker_state);
+//ust// EXPORT_SYMBOL_GPL(ltt_dump_ust_marker_state);
-static void (*new_marker_cb)(struct marker *) = NULL;
+static void (*new_ust_marker_cb)(struct ust_marker *) = NULL;
-void marker_set_new_marker_cb(void (*cb)(struct marker *))
+void ust_marker_set_new_ust_marker_cb(void (*cb)(struct ust_marker *))
{
- new_marker_cb = cb;
+ new_ust_marker_cb = cb;
}
-static void new_markers(struct marker * const *start, struct marker * const *end)
+static void new_ust_marker(struct ust_marker * const *start, struct ust_marker * const *end)
{
- if (new_marker_cb) {
- struct marker * const *m;
+ if (new_ust_marker_cb) {
+ struct ust_marker * const *m;
for(m = start; m < end; m++) {
if (*m)
- new_marker_cb(*m);
+ new_ust_marker_cb(*m);
}
}
}
-int marker_register_lib(struct marker * const *markers_start, int markers_count)
+int ust_marker_register_lib(struct ust_marker * const *ust_marker_start, int ust_marker_count)
{
- struct lib *pl, *iter;
+ struct ust_marker_lib *pl, *iter;
- pl = (struct lib *) zmalloc(sizeof(struct lib));
+ pl = (struct ust_marker_lib *) zmalloc(sizeof(struct ust_marker_lib));
- pl->markers_start = markers_start;
- pl->markers_count = markers_count;
+ pl->ust_marker_start = ust_marker_start;
+ pl->ust_marker_count = ust_marker_count;
/* FIXME: maybe protect this with its own mutex? */
- lock_markers();
+ lock_ust_marker();
/*
* We sort the libs by struct lib pointer address.
*/
- cds_list_for_each_entry_reverse(iter, &libs, list) {
+ cds_list_for_each_entry_reverse(iter, &ust_marker_libs, list) {
BUG_ON(iter == pl); /* Should never be in the list twice */
if (iter < pl) {
/* We belong to the location right after iter. */
}
}
/* We should be added at the head of the list */
- cds_list_add(&pl->list, &libs);
+ cds_list_add(&pl->list, &ust_marker_libs);
lib_added:
- unlock_markers();
+ unlock_ust_marker();
- new_markers(markers_start, markers_start + markers_count);
+ new_ust_marker(ust_marker_start, ust_marker_start + ust_marker_count);
/* FIXME: update just the loaded lib */
- lib_update_markers();
+ lib_update_ust_marker();
- DBG("just registered a markers section from %p and having %d markers (minus dummy markers)", markers_start, markers_count);
+ DBG("just registered a ust_marker section from %p and having %d ust_marker (minus dummy ust_marker)", ust_marker_start, ust_marker_count);
return 0;
}
-int marker_unregister_lib(struct marker * const *markers_start)
+int ust_marker_unregister_lib(struct ust_marker * const *ust_marker_start)
{
- struct lib *lib;
+ struct ust_marker_lib *lib;
- /*FIXME: implement; but before implementing, marker_register_lib must
+ /*FIXME: implement; but before implementing, ust_marker_register_lib must
have appropriate locking. */
- lock_markers();
+ lock_ust_marker();
/* FIXME: we should probably take a mutex here on libs */
//ust// pthread_mutex_lock(&module_mutex);
- cds_list_for_each_entry(lib, &libs, list) {
- if(lib->markers_start == markers_start) {
- struct lib *lib2free = lib;
+ cds_list_for_each_entry(lib, &ust_marker_libs, list) {
+ if(lib->ust_marker_start == ust_marker_start) {
+ struct ust_marker_lib *lib2free = lib;
cds_list_del(&lib->list);
free(lib2free);
break;
}
}
- unlock_markers();
+ unlock_ust_marker();
return 0;
}
static int initialized = 0;
-void __attribute__((constructor)) init_markers(void)
+void __attribute__((constructor)) init_ust_marker(void)
{
if (!initialized) {
- marker_register_lib(__start___markers_ptrs,
- __stop___markers_ptrs
- - __start___markers_ptrs);
+ ust_marker_register_lib(__start___ust_marker_ptrs,
+ __stop___ust_marker_ptrs
+ - __start___ust_marker_ptrs);
initialized = 1;
}
}
-void __attribute__((destructor)) destroy_markers(void)
+void __attribute__((destructor)) destroy_ust_marker(void)
{
- marker_unregister_lib(__start___markers_ptrs);
+ ust_marker_unregister_lib(__start___ust_marker_ptrs);
}
}
-notrace void ltt_vtrace(const struct marker *mdata, void *probe_data,
+notrace void ltt_vtrace(const struct ust_marker *mdata, void *probe_data,
struct registers *regs, void *call_data,
const char *fmt, va_list *args)
{
int largest_align, ret;
- struct ltt_active_marker *pdata;
+ struct ltt_active_ust_marker *pdata;
uint16_t eID;
size_t data_size, slot_size;
unsigned int chan_index;
stack_pos_ctx = tracer_stack_pos;
cmm_barrier();
- pdata = (struct ltt_active_marker *)probe_data;
+ pdata = (struct ltt_active_ust_marker *)probe_data;
eID = mdata->event_id;
chan_index = mdata->channel_id;
closure.callbacks = pdata->probe->callbacks;
rcu_read_unlock(); //ust// rcu_read_unlock_sched_notrace();
}
-notrace void ltt_trace(const struct marker *mdata, void *probe_data,
+notrace void ltt_trace(const struct ust_marker *mdata, void *probe_data,
struct registers *regs, void *call_data,
const char *fmt, ...)
{
return retval;
}
-static void print_markers(FILE *fp)
+static void print_ust_marker(FILE *fp)
{
- struct marker_iter iter;
-
- lock_markers();
- marker_iter_reset(&iter);
- marker_iter_start(&iter);
-
- while (iter.marker) {
- fprintf(fp, "marker: %s/%s %d \"%s\" %p\n",
- (*iter.marker)->channel,
- (*iter.marker)->name,
- (int)imv_read((*iter.marker)->state),
- (*iter.marker)->format,
- (*iter.marker)->location);
- marker_iter_next(&iter);
- }
- unlock_markers();
+ struct ust_marker_iter iter;
+
+ lock_ust_marker();
+ ust_marker_iter_reset(&iter);
+ ust_marker_iter_start(&iter);
+
+ while (iter.ust_marker) {
+ fprintf(fp, "ust_marker: %s/%s %d \"%s\" %p\n",
+ (*iter.ust_marker)->channel,
+ (*iter.ust_marker)->name,
+ (int)imv_read((*iter.ust_marker)->state),
+ (*iter.ust_marker)->format,
+ (*iter.ust_marker)->location);
+ ust_marker_iter_next(&iter);
+ }
+ unlock_ust_marker();
}
static void print_trace_events(FILE *fp)
}
-static void process_marker_cmd(int sock, int command,
- struct ustcomm_marker_info *marker_inf)
+static void process_ust_marker_cmd(int sock, int command,
+ struct ustcomm_ust_marker_info *ust_marker_inf)
{
struct ustcomm_header _reply_header;
struct ustcomm_header *reply_header = &_reply_header;
switch(command) {
case ENABLE_MARKER:
- result = ltt_marker_connect(marker_inf->channel,
- marker_inf->marker,
+ result = ltt_ust_marker_connect(ust_marker_inf->channel,
+ ust_marker_inf->ust_marker,
"default");
if (result < 0) {
- WARN("could not enable marker; channel=%s,"
+ WARN("could not enable ust_marker; channel=%s,"
" name=%s",
- marker_inf->channel,
- marker_inf->marker);
+ ust_marker_inf->channel,
+ ust_marker_inf->ust_marker);
}
break;
case DISABLE_MARKER:
- result = ltt_marker_disconnect(marker_inf->channel,
- marker_inf->marker,
+ result = ltt_ust_marker_disconnect(ust_marker_inf->channel,
+ ust_marker_inf->ust_marker,
"default");
if (result < 0) {
- WARN("could not disable marker; channel=%s,"
+ WARN("could not disable ust_marker; channel=%s,"
" name=%s",
- marker_inf->channel,
- marker_inf->marker);
+ ust_marker_inf->channel,
+ ust_marker_inf->ust_marker);
}
break;
}
case ENABLE_MARKER:
case DISABLE_MARKER:
{
- struct ustcomm_marker_info *marker_inf;
- marker_inf = (struct ustcomm_marker_info *)recv_buf;
- result = ustcomm_unpack_marker_info(marker_inf);
+ struct ustcomm_ust_marker_info *ust_marker_inf;
+ ust_marker_inf = (struct ustcomm_ust_marker_info *)recv_buf;
+ result = ustcomm_unpack_ust_marker_info(ust_marker_inf);
if (result < 0) {
- ERR("couldn't unpack marker info");
+ ERR("couldn't unpack ust_marker info");
reply_header->result = -EINVAL;
goto send_response;
}
- process_marker_cmd(sock, recv_header->command, marker_inf);
+ process_ust_marker_cmd(sock, recv_header->command, ust_marker_inf);
return;
}
case LIST_MARKERS:
ERR("opening memstream failed");
return;
}
- print_markers(fp);
+ print_ust_marker(fp);
fclose(fp);
reply_header->size = size + 1; /* Include final \0 */
free(ptr);
if (result < 0) {
- PERROR("failed to send markers list");
+ PERROR("failed to send ust_marker list");
}
break;
static int autoprobe_method = AUTOPROBE_DISABLED;
static regex_t autoprobe_regex;
-static void auto_probe_connect(struct marker *m)
+static void auto_probe_connect(struct ust_marker *m)
{
int result;
} else if (autoprobe_method == AUTOPROBE_ENABLE_REGEX) {
result = asprintf(&concat_name, "%s/%s", m->channel, m->name);
if (result == -1) {
- ERR("auto_probe_connect: asprintf failed (marker %s/%s)",
+ ERR("auto_probe_connect: asprintf failed (ust_marker %s/%s)",
m->channel, m->name);
return;
}
free(concat_name);
}
- result = ltt_marker_connect(m->channel, m->name, probe_name);
+ result = ltt_ust_marker_connect(m->channel, m->name, probe_name);
if (result && result != -EEXIST)
- ERR("ltt_marker_connect (marker = %s/%s, errno = %d)", m->channel, m->name, -result);
+ ERR("ltt_ust_marker_connect (ust_marker = %s/%s, errno = %d)", m->channel, m->name, -result);
- DBG("auto connected marker %s (addr: %p) %s to probe default", m->channel, m, m->name);
+ DBG("auto connected ust_marker %s (addr: %p) %s to probe default", m->channel, m, m->name);
}
autoprobe_val = getenv("UST_AUTOPROBE");
if (autoprobe_val) {
- struct marker_iter iter;
+ struct ust_marker_iter iter;
DBG("Autoprobe enabled.");
- /* Ensure markers are initialized */
- //init_markers();
+ /* Ensure ust_marker are initialized */
+ //init_ust_marker();
- /* Ensure marker control is initialized, for the probe */
- init_marker_control();
+ /* Ensure ust_marker control is initialized, for the probe */
+ init_ust_marker_control();
/* first, set the callback that will connect the
- * probe on new markers
+ * probe on new ust_marker
*/
if (autoprobe_val[0] == '/') {
result = regcomp(&autoprobe_regex, autoprobe_val+1, 0);
autoprobe_method = AUTOPROBE_ENABLE_ALL;
}
- marker_set_new_marker_cb(auto_probe_connect);
+ ust_marker_set_new_ust_marker_cb(auto_probe_connect);
/* Now, connect the probes that were already registered. */
- marker_iter_reset(&iter);
- marker_iter_start(&iter);
-
- DBG("now iterating on markers already registered");
- while (iter.marker) {
- DBG("now iterating on marker %s", (*iter.marker)->name);
- auto_probe_connect(*iter.marker);
- marker_iter_next(&iter);
+ ust_marker_iter_reset(&iter);
+ ust_marker_iter_start(&iter);
+
+ DBG("now iterating on ust_marker already registered");
+ while (iter.ust_marker) {
+ DBG("now iterating on ust_marker %s", (*iter.ust_marker)->name);
+ auto_probe_connect(*iter.ust_marker);
+ ust_marker_iter_next(&iter);
}
}
DBG("starting early tracing");
- /* Ensure marker control is initialized */
- init_marker_control();
+ /* Ensure ust_marker control is initialized */
+ init_ust_marker_control();
- /* Ensure markers are initialized */
- init_markers();
+ /* Ensure ust_marker are initialized */
+ init_ust_marker();
/* Ensure buffers are initialized, for the transport to be available.
* We are about to set a trace type and it will fail without this.
init_ustrelay_transport();
/* FIXME: When starting early tracing (here), depending on the
- * order of constructors, it is very well possible some marker
+ * order of constructors, it is very well possible some ust_marker
* sections are not yet registered. Because of this, some
* channels may not be registered. Yet, we are about to ask the
* daemon to collect the channels. Channels which are not yet
void ust_potential_exec(void)
{
- ust_marker(potential_exec, MARK_NOARGS);
+ ust_marker(potential_exec, UST_MARKER_NOARGS);
DBG("test");
* to record events only in a single trace in the trace session list.
*/
- ltt_dump_marker_state(trace);
+ ltt_dump_ust_marker_state(trace);
return err;
#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;
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;
struct ltt_available_probe *probe;
};
-struct marker; //ust//
-extern void ltt_vtrace(const struct marker *mdata, void *probe_data,
+struct ust_marker; //ust//
+extern void ltt_vtrace(const struct ust_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,
+extern void ltt_trace(const struct ust_marker *mdata, void *probe_data,
struct registers *regs, 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 {
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);
#include "tracer.h"
notrace
-void _ltt_specialized_trace(const struct marker *mdata, void *probe_data,
+void _ltt_specialized_trace(const struct ust_marker *mdata, void *probe_data,
void *serialize_private, unsigned int data_size,
unsigned int largest_align)
{
return 0;
}
-int ustcomm_pack_marker_info(struct ustcomm_header *header,
- struct ustcomm_marker_info *marker_inf,
+int ustcomm_pack_ust_marker_info(struct ustcomm_header *header,
+ struct ustcomm_ust_marker_info *ust_marker_inf,
const char *trace,
const char *channel,
- const char *marker)
+ const char *ust_marker)
{
int offset = 0;
- marker_inf->trace = ustcomm_print_data(marker_inf->data,
- sizeof(marker_inf->data),
+ ust_marker_inf->trace = ustcomm_print_data(ust_marker_inf->data,
+ sizeof(ust_marker_inf->data),
&offset,
trace);
- if (marker_inf->trace == USTCOMM_POISON_PTR) {
+ if (ust_marker_inf->trace == USTCOMM_POISON_PTR) {
return -ENOMEM;
}
- marker_inf->channel = ustcomm_print_data(marker_inf->data,
- sizeof(marker_inf->data),
+ ust_marker_inf->channel = ustcomm_print_data(ust_marker_inf->data,
+ sizeof(ust_marker_inf->data),
&offset,
channel);
- if (marker_inf->channel == USTCOMM_POISON_PTR) {
+ if (ust_marker_inf->channel == USTCOMM_POISON_PTR) {
return -ENOMEM;
}
- marker_inf->marker = ustcomm_print_data(marker_inf->data,
- sizeof(marker_inf->data),
+ ust_marker_inf->ust_marker = ustcomm_print_data(ust_marker_inf->data,
+ sizeof(ust_marker_inf->data),
&offset,
- marker);
+ ust_marker);
- if (marker_inf->marker == USTCOMM_POISON_PTR) {
+ if (ust_marker_inf->ust_marker == USTCOMM_POISON_PTR) {
return -ENOMEM;
}
- header->size = COMPUTE_MSG_SIZE(marker_inf, offset);
+ header->size = COMPUTE_MSG_SIZE(ust_marker_inf, offset);
return 0;
}
-int ustcomm_unpack_marker_info(struct ustcomm_marker_info *marker_inf)
+int ustcomm_unpack_ust_marker_info(struct ustcomm_ust_marker_info *ust_marker_inf)
{
- marker_inf->trace = ustcomm_restore_ptr(marker_inf->trace,
- marker_inf->data,
- sizeof(marker_inf->data));
- if (!marker_inf->trace) {
+ ust_marker_inf->trace = ustcomm_restore_ptr(ust_marker_inf->trace,
+ ust_marker_inf->data,
+ sizeof(ust_marker_inf->data));
+ if (!ust_marker_inf->trace) {
return -EINVAL;
}
- marker_inf->channel = ustcomm_restore_ptr(marker_inf->channel,
- marker_inf->data,
- sizeof(marker_inf->data));
- if (!marker_inf->channel) {
+ ust_marker_inf->channel = ustcomm_restore_ptr(ust_marker_inf->channel,
+ ust_marker_inf->data,
+ sizeof(ust_marker_inf->data));
+ if (!ust_marker_inf->channel) {
return -EINVAL;
}
- marker_inf->marker = ustcomm_restore_ptr(marker_inf->marker,
- marker_inf->data,
- sizeof(marker_inf->data));
- if (!marker_inf->marker) {
+ ust_marker_inf->ust_marker = ustcomm_restore_ptr(ust_marker_inf->ust_marker,
+ ust_marker_inf->data,
+ sizeof(ust_marker_inf->data));
+ if (!ust_marker_inf->ust_marker) {
return -EINVAL;
}
char data[USTCOMM_DATA_SIZE];
};
-struct ustcomm_marker_info {
+struct ustcomm_ust_marker_info {
char *trace;
char *channel;
- char *marker;
+ char *ust_marker;
char data[USTCOMM_DATA_SIZE];
};
extern int ustcomm_unpack_buffer_info(struct ustcomm_buffer_info *buf_inf);
-extern int ustcomm_pack_marker_info(struct ustcomm_header *header,
- struct ustcomm_marker_info *marker_inf,
+extern int ustcomm_pack_ust_marker_info(struct ustcomm_header *header,
+ struct ustcomm_ust_marker_info *ust_marker_inf,
const char *trace,
const char *channel,
- const char *marker);
+ const char *ust_marker);
-extern int ustcomm_unpack_marker_info(struct ustcomm_marker_info *marker_inf);
+extern int ustcomm_unpack_ust_marker_info(struct ustcomm_ust_marker_info *ust_marker_inf);
#endif /* USTCOMM_H */
}
/**
- * Sets marker state (USTCTL_MS_ON or USTCTL_MS_OFF).
+ * Sets ust_marker state (USTCTL_MS_ON or USTCTL_MS_OFF).
*
* @param mn Marker name
* @param state Marker's new state
* @param pid Traced process ID
* @return 0 if successful, or errors {USTCTL_ERR_GEN, USTCTL_ERR_ARG}
*/
-int ustctl_set_marker_state(int sock, const char *trace, const char *channel,
- const char *marker, int state)
+int ustctl_set_ust_marker_state(int sock, const char *trace, const char *channel,
+ const char *ust_marker, int state)
{
struct ustcomm_header req_header, res_header;
- struct ustcomm_marker_info marker_inf;
+ struct ustcomm_ust_marker_info ust_marker_inf;
int result;
- result = ustcomm_pack_marker_info(&req_header,
- &marker_inf,
+ result = ustcomm_pack_ust_marker_info(&req_header,
+ &ust_marker_inf,
trace,
channel,
- marker);
+ ust_marker);
if (result < 0) {
errno = -result;
return -1;
req_header.command = state ? ENABLE_MARKER : DISABLE_MARKER;
- return do_cmd(sock, &req_header, (char *)&marker_inf,
+ return do_cmd(sock, &req_header, (char *)&ust_marker_inf,
&res_header, NULL);
}
* @param cmsf CMSF array to free
* @return 0 if successful, or error USTCTL_ERR_ARG
*/
-int ustctl_free_cmsf(struct marker_status *cmsf)
+int ustctl_free_cmsf(struct ust_marker_status *cmsf)
{
if (cmsf == NULL) {
return USTCTL_ERR_ARG;
unsigned int i = 0;
while (cmsf[i].channel != NULL) {
free(cmsf[i].channel);
- free(cmsf[i].marker);
+ free(cmsf[i].ust_marker);
free(cmsf[i].fs);
++i;
}
}
/**
- * Gets channel/marker/state/format string for a given PID.
+ * Gets channel/ust_marker/state/format string for a given PID.
*
* @param cmsf Pointer to CMSF array to be filled (callee allocates, caller
* frees with `ustctl_free_cmsf')
* @param pid Targeted PID
* @return 0 if successful, or -1 on error
*/
-int ustctl_get_cmsf(int sock, struct marker_status **cmsf)
+int ustctl_get_cmsf(int sock, struct ust_marker_status **cmsf)
{
struct ustcomm_header req_header, res_header;
char *big_str = NULL;
int result;
- struct marker_status *tmp_cmsf = NULL;
+ struct ust_marker_status *tmp_cmsf = NULL;
unsigned int i = 0, cmsf_ind = 0;
if (cmsf == NULL) {
result = ustcomm_send(sock, &req_header, NULL);
if (result <= 0) {
- PERROR("error while requesting markers list");
+ PERROR("error while requesting ust_marker list");
return -1;
}
result = ustcomm_recv_alloc(sock, &res_header, &big_str);
if (result <= 0) {
- ERR("error while receiving markers list");
+ ERR("error while receiving ust_marker list");
return -1;
}
- tmp_cmsf = (struct marker_status *) zmalloc(sizeof(struct marker_status) *
+ tmp_cmsf = (struct ust_marker_status *) zmalloc(sizeof(struct ust_marker_status) *
(ustctl_count_nl(big_str) + 1));
if (tmp_cmsf == NULL) {
ERR("Failed to allocate CMSF array");
while (big_str[i] != '\0') {
char state;
- sscanf(big_str + i, "marker: %a[^/]/%a[^ ] %c %a[^\n]",
+ sscanf(big_str + i, "ust_marker: %a[^/]/%a[^ ] %c %a[^\n]",
&tmp_cmsf[cmsf_ind].channel,
- &tmp_cmsf[cmsf_ind].marker,
+ &tmp_cmsf[cmsf_ind].ust_marker,
&state,
&tmp_cmsf[cmsf_ind].fs);
tmp_cmsf[cmsf_ind].state = (state == USTCTL_MS_CHR_ON ?
++cmsf_ind;
}
tmp_cmsf[cmsf_ind].channel = NULL;
- tmp_cmsf[cmsf_ind].marker = NULL;
+ tmp_cmsf[cmsf_ind].ust_marker = NULL;
tmp_cmsf[cmsf_ind].fs = NULL;
*cmsf = tmp_cmsf;
result = ustcomm_recv_alloc(sock, &res_header, &big_str);
if (result != 1) {
- ERR("error while receiving markers list");
+ ERR("error while receiving ust_marker list");
return -1;
}
plibc_free(ptr);
}
-MARKER_LIB
+UST_MARKER_LIB
}
printf("Fork test program, parent pid is %d\n", getpid());
- ust_marker(before_fork, MARK_NOARGS);
+ ust_marker(before_fork, UST_MARKER_NOARGS);
/* Sleep here to make sure the consumer is initialized before we fork */
sleep(1);
printf("Child pid is %d\n", getpid());
- ust_marker(after_fork_child, MARK_NOARGS);
+ ust_marker(after_fork_child, UST_MARKER_NOARGS);
ust_marker(before_exec, "pid %d", getpid());
ust_marker(after_exec, "pid %d", getpid());
}
else {
- ust_marker(after_fork_parent, MARK_NOARGS);
+ ust_marker(after_fork_parent, UST_MARKER_NOARGS);
}
return 0;
{
printf("IN FORK2\n");
- ust_marker(after_exec, MARK_NOARGS);
+ ust_marker(after_exec, UST_MARKER_NOARGS);
return 0;
}
int result, sock;
unsigned int subbuf_size, subbuf_num;
unsigned int new_subbuf_size, new_subbuf_num;
- struct marker_status *marker_status, *ms_ptr;
+ struct ust_marker_status *marker_status, *ms_ptr;
char *old_socket_path, *new_socket_path;
char *tmp_ustd_socket = "/tmp/tmp_ustd_socket";
char *trace = "auto";
result = 0;
for (ms_ptr = marker_status; ms_ptr->channel; ms_ptr++) {
if (!strcmp(ms_ptr->channel, "ust") &&
- !strcmp(ms_ptr->marker, "bar")) {
+ !strcmp(ms_ptr->ust_marker, "bar")) {
result = 1;
}
}
free(old_socket_path);
/* Enable, disable markers */
- tap_ok(!ustctl_set_marker_state(sock, trace, "ust", "bar", 1),
- "ustctl_set_marker_state - existing marker ust bar");
+ tap_ok(!ustctl_set_ust_marker_state(sock, trace, "ust", "bar", 1),
+ "ustctl_set_ust_marker_state - existing marker ust bar");
/* Create and allocate a trace */
tap_ok(!ustctl_create_trace(sock, trace), "ustctl_create_trace");
* Activate a non-existent marker, this should be possible as the marker
* can be loaded at a later time.
*/
- tap_ok(ustctl_set_marker_state(sock, trace, "ustl", "blar", 1) == 0,
+ tap_ok(ustctl_set_ust_marker_state(sock, trace, "ustl", "blar", 1) == 0,
"Enable non-existent marker ustl blar");
printf("##### Tests that definetly should work are completed #####\n");
printf("############## Start expected failure cases ##############\n");
- tap_ok(ustctl_set_marker_state(sock, trace, "ust","bar", 1),
+ tap_ok(ustctl_set_ust_marker_state(sock, trace, "ust","bar", 1),
"Enable already enabled marker ust/bar");
tap_ok(EEXIST == errno,
printf("testfunc\n");
}
-//MARKER_LIB
+//UST_MARKER_LIB
void tp_probe(void *data, unsigned int p1);
-DEFINE_MARKER_TP(event, ust_event, tp_probe, "p1 %u");
+DEFINE_UST_MARKER_TP(event, ust_event, tp_probe, "p1 %u");
/*
* Probe 1 --> ust_event
*/
void tp_probe(void *data, unsigned int p1)
{
- struct marker *marker;
+ struct ust_marker *marker;
- marker = &GET_MARKER(event);
+ marker = &GET_UST_MARKER(event);
ltt_specialized_trace(marker, data, &p1, sizeof(p1), sizeof(p1));
}
static int list_markers(int argc, char *argv[])
{
- struct marker_status *cmsf = NULL;
+ struct ust_marker_status *cmsf = NULL;
int i, sock;
sock = parse_and_connect_pid(argv[1]);
"state: %u, fmt: %s}\n",
argv[1],
cmsf[i].channel,
- cmsf[i].marker,
+ cmsf[i].ust_marker,
cmsf[i].state,
cmsf[i].fs);
}
if (marker)
free(marker);
}
- if (ustctl_set_marker_state(sock, argv[2], channel, marker, 1)) {
+ if (ustctl_set_ust_marker_state(sock, argv[2], channel, marker, 1)) {
PERROR("error while trying to enable marker %s with PID %s",
argv[i], argv[1]);
result = -1;
free(marker);
return -1;
}
- if (ustctl_set_marker_state(sock, argv[2], channel, marker, 0)) {
+ if (ustctl_set_ust_marker_state(sock, argv[2], channel, marker, 0)) {
PERROR("error while trying to disable marker %s with PID %s",
argv[i], argv[1]);
result = -1;
return result;
}
-struct cli_cmd __cli_cmds marker_cmds[] = {
+struct cli_cmd __cli_cmds ust_marker_cmds[] = {
{
.name = "list-markers",
.description = "List markers for a given pid",