Hi,

I come from Linux background, and currently working on Dtrace on FreeBSD.
Having worked on SystemTap on Linux, I worked with para-callgraph.stp a lot to 
trace user-space function calls, of user defined functions to understand new 
utilities.

Is there a utility like para-callgraph.stp available in dtrace. If not, is it 
feasible to create one (provided there are constructs available).

#!/usr/bin/stap

function trace(entry_p, extra) {
  %( $# > 1 %? if (tid() in trace) %)
  printf("%s%s%s %s\n",
         thread_indent (entry_p),
         (entry_p>0?"->":"<-"),
         ppfunc (),
         extra)
}


%( $# > 1 %?
global trace
probe $2.call {
  trace[tid()] = 1
}
probe $2.return {
  delete trace[tid()]
}
%)

probe $1.call   { trace(1, $$parms) }
probe $1.return { trace(-1, $$return) }

I was trying to rewrite this for dtrace, dtrace understands conditional 
compilation as well. So will this work for tracing call-graphs of user space 
programs if written as a dtrace script.

------------------------------------------
DTrace: dtrace-discuss
Permalink: 
https://dtrace.topicbox.com/groups/dtrace-discuss/T97a77925c6df6847-M0654a0c4cdb663551dee9187
Delivery options: https://dtrace.topicbox.com/groups/dtrace-discuss/subscription

Reply via email to