[ltt-dev] [UST PATCH] Add Systemtap to the tracepoint benchmark
Nils Carlson
nils.carlson at ericsson.com
Thu Jan 27 10:28:34 EST 2011
On Thu, 27 Jan 2011, Mathieu Desnoyers wrote:
> * Julien Desfossez (julien.desfossez at polymtl.ca) wrote:
<snip>
>>
>> +### Systemtap header for benchmark ###
>
> Is there a way we could do these checks within the benchmark makefile instead of
> polluting the whole UST configure.ac ?
>
I agree.... This isn't pretty... Alternatively, you could just add some
checks (the simple normal type) and then check for the set variables
directly in the test case... This wouldn't be recommended if it was part
of the library, but as it is just a test we may be able to live with it?
At lest it would be less ugly. :-)
/Nils
> Mathieu
>
>> +AC_MSG_CHECKING([whether to include systemtap tracing support in the tracepoint benchmark])
>> +AC_ARG_ENABLE([systemtap],
>> + [AS_HELP_STRING([--enable-systemtap],
>> + [Enable inclusion of systemtap trace support in tracepoint benchmark])],
>> + [ENABLE_SYSTEMTAP="${enableval}"], [ENABLE_SYSTEMTAP='no'])
>> +AM_CONDITIONAL([ENABLE_SYSTEMTAP], [test x$ENABLE_SYSTEMTAP = xyes])
>> +AC_MSG_RESULT(${ENABLE_SYSTEMTAP})
>> +
>> +if test "x${ENABLE_SYSTEMTAP}" = xyes; then
>> + AC_CHECK_PROGS(DTRACE, dtrace)
>> + if test -z "$DTRACE"; then
>> + AC_MSG_ERROR([dtrace not found])
>> + fi
>> + AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='yes'],
>> + [SDT_H_FOUND='no';
>> + AC_MSG_ERROR([systemtap support needs sys/sdt.h header])])
>> + AC_DEFINE([HAVE_SYSTEMTAP], [1], [Define to 1 if using probes.])
>> +fi
>> +
>> +### end Systemtap ###
>> +
>> AC_CONFIG_FILES([
>> Makefile
>> doc/Makefile
>> diff --git a/tests/tracepoint/benchmark/Makefile.am b/tests/tracepoint/benchmark/Makefile.am
>> index 50f7bf5..82c9ac1 100644
>> --- a/tests/tracepoint/benchmark/Makefile.am
>> +++ b/tests/tracepoint/benchmark/Makefile.am
>> @@ -5,3 +5,16 @@ tracepoint_benchmark_SOURCES = tracepoint_benchmark.c tracepoint_benchmark.h
>> tracepoint_benchmark_LDADD = $(top_builddir)/libust/libust.la $(top_builddir)/libust-initializer.o
>>
>> CFLAGS_tracepoint_benchmark.o = -I$(src) -g
>> +
>> +if ENABLE_SYSTEMTAP
>> +probes.h: probes.d
>> + $(DTRACE) -C -h -s $< -o $@
>> +
>> +probes.o: probes.d
>> + $(DTRACE) -C -G -s $< -o $@
>> +
>> +BUILT_SOURCES = probes.h
>> +
>> +tracepoint_benchmark_SOURCES += probes.d trace.h
>> +tracepoint_benchmark_LDADD += probes.o
>> +endif
>> diff --git a/tests/tracepoint/benchmark/probes.d b/tests/tracepoint/benchmark/probes.d
>> new file mode 100644
>> index 0000000..0dc6a10
>> --- /dev/null
>> +++ b/tests/tracepoint/benchmark/probes.d
>> @@ -0,0 +1,3 @@
>> +provider tracepoint_benchmark {
>> + probe single_trace(int);
>> +};
>> diff --git a/tests/tracepoint/benchmark/testutrace.stp b/tests/tracepoint/benchmark/testutrace.stp
>> index ad8ed68..cc79770 100644
>> --- a/tests/tracepoint/benchmark/testutrace.stp
>> +++ b/tests/tracepoint/benchmark/testutrace.stp
>> @@ -1,4 +1,5 @@
>> -probe process("./.libs/tracepoint_benchmark").function("single_trace") {
>> - printf("%d : %s\n", gettimeofday_ns(), $$parms);
>> +probe process(".libs/tracepoint_benchmark").mark("single_trace")
>> +{
>> + printf("%d : %d\n", gettimeofday_ns(), $arg1);
>> }
>>
>> diff --git a/tests/tracepoint/benchmark/trace.h b/tests/tracepoint/benchmark/trace.h
>> new file mode 100644
>> index 0000000..044c99c
>> --- /dev/null
>> +++ b/tests/tracepoint/benchmark/trace.h
>> @@ -0,0 +1,9 @@
>> +#include "config.h"
>> +#ifdef HAVE_SYSTEMTAP
>> +// include the generated probes header and put markers in code
>> +#include "probes.h"
>> +#define TRACE(probe) probe
>> +#else
>> +// Wrap the probe to allow it to be removed when no systemtap available
>> +#define TRACE(probe)
>> +#endif
>> diff --git a/tests/tracepoint/benchmark/tracepoint_benchmark.c b/tests/tracepoint/benchmark/tracepoint_benchmark.c
>> index 8af4b84..7e443c2 100644
>> --- a/tests/tracepoint/benchmark/tracepoint_benchmark.c
>> +++ b/tests/tracepoint/benchmark/tracepoint_benchmark.c
>> @@ -27,6 +27,7 @@
>> #include <stdio.h>
>> #include "tracepoint_benchmark.h"
>> #include <ust/type-serializer.h>
>> +#include "trace.h"
>>
>> #define NR_EVENTS 10000000
>>
>> @@ -54,6 +55,7 @@ static void __attribute__((constructor)) init()
>>
>> void single_trace(unsigned int v)
>> {
>> + TRACE(TRACEPOINT_BENCHMARK_SINGLE_TRACE(v));
>> trace_ust_event(v);
>> }
>>
>> --
>> 1.7.3.5
>>
>
> --
> Mathieu Desnoyers
> Operating System Efficiency R&D Consultant
> EfficiOS Inc.
> http://www.efficios.com
>
> _______________________________________________
> ltt-dev mailing list
> ltt-dev at lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
>
More information about the lttng-dev
mailing list