patchGNU Octave - Patches: patch #8364, Add SystemTap user space probes.

 
 

patch #8364: Add SystemTap user space probes.

Submitted by:  Rüdiger Sonderfeld <ruediger>
Submitted on:  Wed 26 Feb 2014 08:13:35 PM UTC  
 
Category: NonePriority: 5 - Normal
Status: NonePrivacy: Public
Assigned to: NoneOpen/Closed: Open

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 26 Feb 2014 08:13:35 PM UTC, original submission:

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.

Rüdiger Sonderfeld <ruediger>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #30715:  userprobes.patch added by ruediger (5kB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by ruediger (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 26 Feb 2014 08:13:35 PM UTCruedigerAttached File-=>Added userprobes.patch, #30715

    Back to the top


    Powered by Savane 3.1-cleanup