Initial support for dtrace and systemtap

This adds static markers for dtrace, which are also usable
by systemtap. Additionally it adds a tapset for systemtap
that makes it easier to use the static markers.

These are enabled by default.

This initial set of probes is rather limited:

* allocation and free using g_malloc & co
* allocation and free using g_slice
* gquark name tracking (useful for converting quarks to strings in probes)

Notes on naming:

Its traditional with dtrace to use probe names with dashes as
delimiter (slice-alloc). Since dashes are not usable in identifiers
the C code uses double underscores (slice__alloc) which is converted
to dashes in the UI. We follow this for the shared lowlevel probe
names.

Additionally dtrace supports putting a "provider" part in the probe
names which is essentially a namespacing thing. On systemtap this
field is currently ignored (but may be implemented in the future), but
this is not really a problem since in systemtap the probes are
specified by combining the solib file and the marker name, so there
can't really be name conflicts.

For the systemtap tapset highlevel probes we instead use names that
are systemtapish with single dashes as separators.

https://bugzilla.gnome.org/show_bug.cgi?id=606044
This commit is contained in:
Alexander Larsson
2009-12-18 21:25:47 +01:00
committed by Colin Walters
parent c3bc0f4f8f
commit bef9efd0a9
10 changed files with 317 additions and 12 deletions

View File

@@ -176,6 +176,19 @@ How to compile GLib itself
<option>--disable-selinux</option> configure option.
</para>
</listitem>
<listitem>
<para>
The optional support for DTrace requires the <filename>sys/sdt.h</filename> header,
which is provided by SystemTap on Linux. To build GLib without DTrace, use the
<option>--disable-dtrace</option> configure option.
</para>
</listitem>
<listitem>
<para>
The optional support for <ulink url="http://sourceware.org/systemtap/">SystemTap</ulink> can be disabled with the
<option>--disable-systemtap</option> configure option.
</para>
</listitem>
</itemizedlist>
</refsect1>
@@ -238,6 +251,14 @@ How to compile GLib itself
<arg>--disable-selinux</arg>
<arg>--enable-selinux</arg>
</group>
<group>
<arg>--disable-dtrace</arg>
<arg>--enable-dtrace</arg>
</group>
<group>
<arg>--disable-systemtap</arg>
<arg>--enable-systemtap</arg>
</group>
<group>
<arg>--with-runtime-libdir=RELPATH</arg>
</group>
@@ -562,6 +583,27 @@ How to compile GLib itself
be included.
</para>
</formalpara>
<formalpara>
<title><systemitem>--disable-dtrace</systemitem> and
<systemitem>--enable-dtrace</systemitem></title>
<para>
By default the <command>configure</command> script will
detect if DTrace support is available, and use it.
</para>
</formalpara>
<formalpara>
<title><systemitem>--disable-systemtap</systemitem> and
<systemitem>--enable-systemtap</systemitem></title>
<para>
This option requires DTrace support. If it is available, then
the <command>configure</command> script will also check for
the presence of SystemTap.
</para>
</formalpara>
<formalpara>
<title><systemitem>--with-runtime-libdir=RELPATH</systemitem></title>

View File

@@ -305,6 +305,19 @@ Which would print the contents of each widget in a list of widgets.
</refsect2>
<refsect2>
<title>SystemTap</title>
<para>
<ulink url="http://sourceware.org/systemtap/">SystemTap</ulink> is a dynamic whole-system
analysis toolkit. GLib ships with a file <filename>glib.stp</filename> which defines a
set of probe points, which you can hook into with custom SystemTap scripts.
See the files <filename>glib.stp</filename> and <filename>gobject.stp</filename> which
are in your shared SystemTap scripts directory.
</para>
</refsect2>
<refsect2>
<title>Memory statistics</title>