diff options
author | Scott Lystig Fritchie <[email protected]> | 2012-08-17 03:24:20 -0500 |
---|---|---|
committer | Scott Lystig Fritchie <[email protected]> | 2012-08-17 04:39:36 -0500 |
commit | 75552bd3bb4e7f3cf4dab81a5c81cf73b1d3fb99 (patch) | |
tree | 58b9fbc507fbfe46aeee2311e7f308e8b70d7abf /lib/runtime_tools/examples | |
parent | f3c830eddc68d7269d4f48b13ddae40893929573 (diff) | |
download | otp-75552bd3bb4e7f3cf4dab81a5c81cf73b1d3fb99.tar.gz otp-75552bd3bb4e7f3cf4dab81a5c81cf73b1d3fb99.tar.bz2 otp-75552bd3bb4e7f3cf4dab81a5c81cf73b1d3fb99.zip |
Relocate bodies of DTrace probes to the statically-linked VM.
Due to various operating systems (in both the DTrace and SystemTap
worlds) not fully supporting DTrace probes (or SystemTap-compatibility
mode probes) in shared libraries, we relocate those probes to the
statically-linked virtual machine. This could be seen as pollution
of the pristine VM by a (yet) experimental feature. However:
1. This code can be eliminated completely by the C preprocessor.
2. Leaving the probes in the dyntrace NIF shared library simply
does not work correctly on too many platforms.
*Many* thanks to Macneil Shonle at Basho for assisting when my
RSI-injured fingers gave out.
Tested on:
* CentOS 5, SystemTap 1.3
* Solaris 10 (note)
* Solaris 11
* OpenIndiana 151
* SmartOS 20120809T221258Z
* FreeBSD 9.0-RELEASE (note)
I had hoped to be able to test CentOS 6 + SystemTap 1.7, but the
details of dealing with all dependencies for a 2.6.32-279.5.1.el6.x86_64
kernel are too time consuming right now.
(note: Solaris 10 and FreeBSD 9.0-RELEASE can take a long time to compile)
Diffstat (limited to 'lib/runtime_tools/examples')
-rw-r--r-- | lib/runtime_tools/examples/user-probe-n.d | 44 | ||||
-rw-r--r-- | lib/runtime_tools/examples/user-probe-n.systemtap | 53 | ||||
-rw-r--r-- | lib/runtime_tools/examples/user-probe.systemtap | 4 |
3 files changed, 99 insertions, 2 deletions
diff --git a/lib/runtime_tools/examples/user-probe-n.d b/lib/runtime_tools/examples/user-probe-n.d new file mode 100644 index 0000000000..06a3e5c9b9 --- /dev/null +++ b/lib/runtime_tools/examples/user-probe-n.d @@ -0,0 +1,44 @@ +/* example usage: dtrace -q -s /path/to/user-probe.d */ +/* + * %CopyrightBegin% + * + * Copyright Scott Lystig Fritchie 2011-2012. All Rights Reserved. + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * %CopyrightEnd% + */ + +erlang*:::user_trace-n0 +{ + printf("probe n0: %s %s %d %d %d %d '%s' '%s' '%s' '%s'\n", + copyinstr(arg0), + arg1 == NULL ? "" : copyinstr(arg1), + arg2, arg3, arg4, arg5, + arg6 == NULL ? "" : copyinstr(arg6), + arg7 == NULL ? "" : copyinstr(arg7), + arg8 == NULL ? "" : copyinstr(arg8), + arg9 == NULL ? "" : copyinstr(arg9)); +} + +erlang*:::user_trace-n1 +{ + printf("probe n1: %s %s %d %d %d %d '%s' '%s' '%s' '%s'\n", + copyinstr(arg0), + arg1 == NULL ? "" : copyinstr(arg1), + arg2, arg3, arg4, arg5, + arg6 == NULL ? "" : copyinstr(arg6), + arg7 == NULL ? "" : copyinstr(arg7), + arg8 == NULL ? "" : copyinstr(arg8), + arg9 == NULL ? "" : copyinstr(arg9)); +} + diff --git a/lib/runtime_tools/examples/user-probe-n.systemtap b/lib/runtime_tools/examples/user-probe-n.systemtap new file mode 100644 index 0000000000..6aa415bb67 --- /dev/null +++ b/lib/runtime_tools/examples/user-probe-n.systemtap @@ -0,0 +1,53 @@ +/* + * %CopyrightBegin% + * + * Copyright Scott Lystig Fritchie and Andreas Schultz, 2011-2012. All Rights Reserved. + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * %CopyrightEnd% + */ +/* + * Note: This file assumes that you're using the non-SMP-enabled Erlang + * virtual machine, "beam". The SMP-enabled VM is called "beam.smp". + * Note that other variations of the virtual machine also have + * different names, e.g. the debug build of the SMP-enabled VM + * is "beam.debug.smp". + * + * To use a different virtual machine, replace each instance of + * "beam" with "beam.smp" or the VM name appropriate to your + * environment. + */ + +probe process("beam").mark("user_trace-n0") +{ + printf("probe n0: %s %s %d %d %d %d '%s' '%s' '%s' '%s'\n", + user_string($arg1), + $arg2 == NULL ? "" : user_string($arg2), + $arg3, $arg4, $arg5, $arg6, + $arg7 == NULL ? "" : user_string($arg7), + $arg8 == NULL ? "" : user_string($arg8), + $arg9 == NULL ? "" : user_string($arg9), + $arg9 == NULL ? "" : user_string($arg9)); +} + +probe process("beam").mark("user_trace-n1") +{ + printf("probe n1: %s %s %d %d %d %d '%s' '%s' '%s' '%s'\n", + user_string($arg1), + $arg2 == NULL ? "" : user_string($arg2), + $arg3, $arg4, $arg5, $arg6, + $arg7 == NULL ? "" : user_string($arg7), + $arg8 == NULL ? "" : user_string($arg8), + $arg9 == NULL ? "" : user_string($arg9), + $arg9 == NULL ? "" : user_string($arg9)); +} diff --git a/lib/runtime_tools/examples/user-probe.systemtap b/lib/runtime_tools/examples/user-probe.systemtap index b41d7483ad..0482235324 100644 --- a/lib/runtime_tools/examples/user-probe.systemtap +++ b/lib/runtime_tools/examples/user-probe.systemtap @@ -28,12 +28,12 @@ * environment. */ -probe process("dyntrace.so").mark("user_trace-s1") +probe process("beam").mark("user_trace-s1") { printf("%s\n", user_string($arg1)); } -probe process("dyntrace.so").mark("user_trace-i4s4") +probe process("beam").mark("user_trace-i4s4") { printf("%s %s %d %d %d %d '%s' '%s' '%s' '%s'\n", user_string($arg1), |