octave-patch-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-patch-tracker] [patch #8364] Add SystemTap user space probes.


From: Rüdiger Sonderfeld
Subject: [Octave-patch-tracker] [patch #8364] Add SystemTap user space probes.
Date: Wed, 26 Feb 2014 20:13:37 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:27.0) Gecko/20100101 Firefox/27.0

URL:
  <http://savannah.gnu.org/patch/?8364>

                 Summary: Add SystemTap user space probes.
                 Project: GNU Octave
            Submitted by: ruediger
            Submitted on: Wed 26 Feb 2014 08:13:35 PM GMT
                Category: None
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

SystemTap (https://sourceware.org/systemtap/) is an advanced tracing framework
for GNU/Linux.  It not only provides functionality to trace the kernel but
also user space probes.  Those probes are low overhead and allow a user to
query information.  They are also supported in recent versions of GDB.

This patch adds the infrastructure for user space probes to the GNU Octave
source code.  Which mainly consists of a configure flag and check and a header
to provide empty probe macros in case sys/sdt.h is not available.  It also
adds two example probes to allow tracing the execution of user functions
(enter/return).

Here is a simple SystemTap script which allows tracing user functions:

probe process("./libinterp/.libs/liboctinterp.so.2.0.0").mark("usr_fcn_enter")
{
  printf("%s ⇒ %s (%s:%d:%d)\n", thread_indent(1), user_string($arg1),
         user_string($arg2), $arg3, $arg4);
}

probe
process("./libinterp/.libs/liboctinterp.so.2.0.0").mark("usr_fcn_return") {
  printf("%s ⇐ %s\n", thread_indent(-1), user_string($arg1));
}

And the output for calling "help help" (executed using: stap example.stp -c
"./run-octave --no-gui")

11215472 QThread(31502):   ⇒ help (:-1:-1)
11219760 QThread(31502):    ⇒ __makeinfo__
(/home/ruediger/src/octave/build/../scripts/help/help.m:99:22)
11220632 QThread(31502):     ⇒ tempdir
(/home/ruediger/src/octave/build/../scripts/help/__makeinfo__.m:122:15)
11220971 QThread(31502):      ⇒ isdir
(/home/ruediger/src/octave/build/../scripts/miscellaneous/tempdir.m:35:3)
11221050 QThread(31502):      ⇐ isdir
11221063 QThread(31502):     ⇐ tempdir
11221092 QThread(31502):     ⇒ fullfile
(/home/ruediger/src/octave/build/../scripts/help/__makeinfo__.m:122:15)
11221294 QThread(31502):     ⇐ fullfile
11425082 QThread(31502):     ⇒ delete
(/home/ruediger/src/octave/build/../scripts/help/__makeinfo__.m:146:7)
11425873 QThread(31502):     ⇐ delete
11425939 QThread(31502):    ⇐ __makeinfo__
11428946 QThread(31502):    ⇒ which
(/home/ruediger/src/octave/build/../scripts/help/help.m:117:7)
11430529 QThread(31502):    ⇐ which
11431545 QThread(31502):    ⇒ __additional_help_message__
(/home/ruediger/src/octave/build/../scripts/help/help.m:118:7)
11431684 QThread(31502):    ⇐ __additional_help_message__
11431864 QThread(31502):   ⇐ help

The script could be further simplified by adding a proper tapset library. 
Adding a probe to the code is straight forward:

DTRACE_PROBE2 (octave, usr_fcn_return, profiler_name ().c_str (), retval);

This adds the probe `usr_fcn_return' to the `octave' provider and passes the
two arguments.

The name DTRACE_PROBE2 is used for potential DTrace compatibility.  The patch
itself is not DTrace compatible because this would require small adjustments
to the build process.  I don't have a DTrace compatible system available and
I'm not sure if DTrace user space probes would even be license compatible.




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Wed 26 Feb 2014 08:13:35 PM GMT  Name: userprobes.patch  Size: 5kB   By:
ruediger

<http://savannah.gnu.org/patch/download.php?file_id=30715>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?8364>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]