AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
AM_CFLAGS = -fno-strict-aliasing
-lib_LTLIBRARIES = liblttng-ust-cyg-profile.la
+lib_LTLIBRARIES = liblttng-ust-cyg-profile.la \
+ liblttng-ust-cyg-profile-fast.la
+
liblttng_ust_cyg_profile_la_SOURCES = \
lttng-ust-cyg-profile.c \
lttng-ust-cyg-profile.h
-L$(top_builddir)/liblttng-ust/.libs \
-llttng-ust
+liblttng_ust_cyg_profile_fast_la_SOURCES = \
+ lttng-ust-cyg-profile-fast.c \
+ lttng-ust-cyg-profile-fast.h
+liblttng_ust_cyg_profile_fast_la_LIBADD = \
+ -L$(top_builddir)/liblttng-ust/.libs \
+ -llttng-ust
+
if LTTNG_UST_BUILD_WITH_LIBDL
liblttng_ust_cyg_profile_la_LIBADD += -ldl
+liblttng_ust_cyg_profile_fast_la_LIBADD += -ldl
endif
if LTTNG_UST_BUILD_WITH_LIBC_DL
liblttng_ust_cyg_profile_la_LIBADD += -lc
+liblttng_ust_cyg_profile_fast_la_LIBADD += -lc
endif
-noinst_SCRIPTS = run
-EXTRA_DIST = run
+noinst_SCRIPTS = run run-fast
+EXTRA_DIST = run run-fast
--- /dev/null
+/*
+ * Copyright (C) 2011-2013 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#define _GNU_SOURCE
+#define _LGPL_SOURCE
+#include <dlfcn.h>
+#include <sys/types.h>
+#include <stdio.h>
+
+#define TRACEPOINT_DEFINE
+#define TRACEPOINT_CREATE_PROBES
+#include "lttng-ust-cyg-profile-fast.h"
+
+void __cyg_profile_func_enter(void *this_fn, void *call_site)
+ __attribute__((no_instrument_function));
+
+void __cyg_profile_func_exit(void *this_fn, void *call_site)
+ __attribute__((no_instrument_function));
+
+void __cyg_profile_func_enter(void *this_fn, void *call_site)
+{
+ tracepoint(lttng_ust_cyg_profile_fast, func_entry, this_fn);
+}
+
+void __cyg_profile_func_exit(void *this_fn, void *call_site)
+{
+ tracepoint(lttng_ust_cyg_profile_fast, func_exit);
+}
--- /dev/null
+#undef TRACEPOINT_PROVIDER
+#define TRACEPOINT_PROVIDER lttng_ust_cyg_profile_fast
+
+#if !defined(_TRACEPOINT_LTTNG_UST_CYG_PROFILE_FAST_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
+#define _TRACEPOINT_LTTNG_UST_CYG_PROFILE_FAST_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Copyright (C) 2011-2013 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>
+
+TRACEPOINT_EVENT(lttng_ust_cyg_profile_fast, func_entry,
+ TP_ARGS(void *, func_addr),
+ TP_FIELDS(
+ ctf_integer_hex(void *, addr, func_addr)
+ )
+)
+
+TRACEPOINT_LOGLEVEL(lttng_ust_cyg_profile_fast, func_entry,
+ TRACE_DEBUG_FUNCTION)
+
+TRACEPOINT_EVENT(lttng_ust_cyg_profile_fast, func_exit,
+ TP_ARGS(void),
+ TP_FIELDS()
+)
+
+TRACEPOINT_LOGLEVEL(lttng_ust_cyg_profile_fast, func_exit,
+ TRACE_DEBUG_FUNCTION)
+
+#endif /* _TRACEPOINT_LTTNG_UST_CYG_PROFILE_FAST_H */
+
+#undef TRACEPOINT_INCLUDE
+#define TRACEPOINT_INCLUDE "./lttng-ust-cyg-profile-fast.h"
+
+/* This part must be outside ifdef protection */
+#include <lttng/tracepoint-event.h>
+
+#ifdef __cplusplus
+}
+#endif
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#define _LGPL_SOURCE
#define _GNU_SOURCE
#include <dlfcn.h>
#include <sys/types.h>
void __cyg_profile_func_enter(void *this_fn, void *call_site)
{
- tracepoint(lttng_ust_cyg_profile, func_entry, this_fn);
+ tracepoint(lttng_ust_cyg_profile, func_entry, this_fn, call_site);
}
void __cyg_profile_func_exit(void *this_fn, void *call_site)
{
- tracepoint(lttng_ust_cyg_profile, func_exit);
+ tracepoint(lttng_ust_cyg_profile, func_exit, this_fn, call_site);
}
#include <lttng/tracepoint.h>
TRACEPOINT_EVENT(lttng_ust_cyg_profile, func_entry,
- TP_ARGS(void *, func_addr),
+ TP_ARGS(void *, func_addr, void *, call_site),
TP_FIELDS(
ctf_integer_hex(void *, addr, func_addr)
+ ctf_integer_hex(void *, call_site, func_addr)
)
)
TRACE_DEBUG_FUNCTION)
TRACEPOINT_EVENT(lttng_ust_cyg_profile, func_exit,
- TP_ARGS(void),
- TP_FIELDS()
+ TP_ARGS(void *, func_addr, void *, call_site),
+ TP_FIELDS(
+ ctf_integer_hex(void *, addr, func_addr)
+ ctf_integer_hex(void *, call_site, func_addr)
+ )
)
TRACEPOINT_LOGLEVEL(lttng_ust_cyg_profile, func_exit,
--- /dev/null
+#!/bin/sh
+
+LD_VERBOSE=1 LD_PRELOAD=.libs/liblttng-ust-cyg-profile-fast.so ${*}