lttng/ust-error.h \
lttng/tracef.h \
lttng/lttng-ust-tracef.h \
+ lttng/tracelog.h \
+ lttng/lttng-ust-tracelog.h \
lttng/ust-clock.h \
lttng/ust-getcpu.h
--- /dev/null
+/*
+ * Copyright (C) 2011-2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <lttng/tracepoint.h>
+#include <stdarg.h>
+
+#define TP_TRACELOG_TEMPLATE(_level_identifier, _level_enum) \
+ TRACEPOINT_EVENT(lttng_ust_tracelog, _level_identifier, \
+ TP_ARGS(const char *, file, int, line, const char *, func, \
+ const char *, msg, unsigned int, len, void *, ip), \
+ TP_FIELDS( \
+ ctf_integer(int, line, line) \
+ ctf_string(file, file) \
+ ctf_string(func, func) \
+ ctf_sequence_text(char, msg, msg, unsigned int, len) \
+ ) \
+ ) \
+ TRACEPOINT_LOGLEVEL(lttng_ust_tracelog, _level_identifier, \
+ TRACE_##_level_enum)
+
+TP_TRACELOG_TEMPLATE(emerg, EMERG)
+TP_TRACELOG_TEMPLATE(alert, ALERT)
+TP_TRACELOG_TEMPLATE(crit, CRIT)
+TP_TRACELOG_TEMPLATE(err, ERR)
+TP_TRACELOG_TEMPLATE(warning, WARNING)
+TP_TRACELOG_TEMPLATE(notice, NOTICE)
+TP_TRACELOG_TEMPLATE(info, INFO)
+TP_TRACELOG_TEMPLATE(debug_system, DEBUG_SYSTEM)
+TP_TRACELOG_TEMPLATE(debug_program, DEBUG_PROGRAM)
+TP_TRACELOG_TEMPLATE(debug_process, DEBUG_PROCESS)
+TP_TRACELOG_TEMPLATE(debug_module, DEBUG_MODULE)
+TP_TRACELOG_TEMPLATE(debug_unit, DEBUG_UNIT)
+TP_TRACELOG_TEMPLATE(debug_function, DEBUG_FUNCTION)
+TP_TRACELOG_TEMPLATE(debug_line, DEBUG_LINE)
+TP_TRACELOG_TEMPLATE(debug, DEBUG)
--- /dev/null
+#ifndef _LTTNG_UST_TRACELOG_H
+#define _LTTNG_UST_TRACELOG_H
+
+/*
+ * Copyright (C) 2013-2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <lttng/lttng-ust-tracelog.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define TP_TRACELOG_CB_TEMPLATE(level) \
+ extern void _lttng_ust_tracelog_##level(const char *file, \
+ int line, const char *func, const char *fmt, ...)
+
+TP_TRACELOG_CB_TEMPLATE(emerg);
+TP_TRACELOG_CB_TEMPLATE(alert);
+TP_TRACELOG_CB_TEMPLATE(crit);
+TP_TRACELOG_CB_TEMPLATE(err);
+TP_TRACELOG_CB_TEMPLATE(warning);
+TP_TRACELOG_CB_TEMPLATE(notice);
+TP_TRACELOG_CB_TEMPLATE(info);
+TP_TRACELOG_CB_TEMPLATE(debug_system);
+TP_TRACELOG_CB_TEMPLATE(debug_program);
+TP_TRACELOG_CB_TEMPLATE(debug_process);
+TP_TRACELOG_CB_TEMPLATE(debug_module);
+TP_TRACELOG_CB_TEMPLATE(debug_unit);
+TP_TRACELOG_CB_TEMPLATE(debug_function);
+TP_TRACELOG_CB_TEMPLATE(debug_line);
+TP_TRACELOG_CB_TEMPLATE(debug);
+
+#undef TP_TRACELOG_CB_TEMPLATE
+
+#define tracelog(level, fmt, ...) \
+ do { \
+ STAP_PROBEV(tracepoint_lttng_ust_tracelog, level, ## __VA_ARGS__); \
+ if (caa_unlikely(__tracepoint_lttng_ust_tracelog___## level.state)) \
+ _lttng_ust_tracelog_##level(__FILE__, __LINE__, __func__, \
+ fmt, ## __VA_ARGS__); \
+ } while (0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _LTTNG_UST_TRACELOG_H */
error.h \
tracef.c \
lttng-ust-tracef-provider.h \
+ tracelog.c \
+ lttng-ust-tracelog-provider.h \
getenv.h
if HAVE_PERF_EVENT
--- /dev/null
+#undef TRACEPOINT_PROVIDER
+#define TRACEPOINT_PROVIDER lttng_ust_tracelog
+
+#if !defined(_TRACEPOINT_LTTNG_UST_TRACELOG_PROVIDER_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
+#define _TRACEPOINT_LTTNG_UST_TRACELOG_PROVIDER_H
+
+/*
+ * Copyright (C) 2011-2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <lttng/lttng-ust-tracelog.h>
+
+#endif /* _TRACEPOINT_LTTNG_UST_TRACEF_PROVIDER_H */
+
+#define TP_IP_PARAM /* IP context received as parameter */
+#undef TRACEPOINT_INCLUDE
+#define TRACEPOINT_INCLUDE "./lttng-ust-tracelog.h"
+
+/* This part must be outside ifdef protection */
+#include <lttng/tracepoint-event.h>
--- /dev/null
+/*
+ * Copyright (C) 2013-2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#define _GNU_SOURCE
+#define _LGPL_SOURCE
+#include <stdio.h>
+
+#define TRACEPOINT_CREATE_PROBES
+#define TRACEPOINT_DEFINE
+#include "lttng-ust-tracelog-provider.h"
+
+#define TRACELOG_CB(level) \
+ void _lttng_ust_tracelog_##level(const char *file, \
+ int line, const char *func, \
+ const char *fmt, ...) \
+ { \
+ va_list ap; \
+ char *msg; \
+ int len; \
+ \
+ va_start(ap, fmt); \
+ len = vasprintf(&msg, fmt, ap); \
+ /* len does not include the final \0 */ \
+ if (len < 0) \
+ goto end; \
+ __tracepoint_cb_lttng_ust_tracelog___##level(file, \
+ line, func, msg, len, \
+ __builtin_return_address(0)); \
+ free(msg); \
+ end: \
+ va_end(ap); \
+ }
+
+TRACELOG_CB(emerg)
+TRACELOG_CB(alert)
+TRACELOG_CB(crit)
+TRACELOG_CB(err)
+TRACELOG_CB(warning)
+TRACELOG_CB(notice)
+TRACELOG_CB(info)
+TRACELOG_CB(debug_system)
+TRACELOG_CB(debug_program)
+TRACELOG_CB(debug_process)
+TRACELOG_CB(debug_module)
+TRACELOG_CB(debug_unit)
+TRACELOG_CB(debug_function)
+TRACELOG_CB(debug_line)
+TRACELOG_CB(debug)