Questions tagged [dtrace]

DTrace is a comprehensive dynamic tracing framework for the Solaris Operating Environment, Mac OS X 10.5+ and FreeBSD.

DTrace is a comprehensive dynamic tracing framework for the Solaris Operating Environment; it provides a powerful infrastructure to permit administrators, developers, and service personnel to concisely answer arbitrary questions about the behavior of the operating system and user programs.

DTrace can be used to get a global overview of a running system, such as the amount of memory, CPU time, file-system and network resources used by the active processes. It can also provide much more fine-grained information, such as a log of the arguments with which a specific function is being called, or a list of the processes accessing a specific file.

Resources

266 questions
4
votes
4 answers

Calling C function from DTrace scripts

DTrace is impressive, powerful tracing system originally from Solaris, but it is ported to FreeBSD and Mac OSX. DTrace uses a high-level language called D not unlike AWK or C. Here is an example: io:::start /pid == $1/ { printf("file %s offset…
dmeister
  • 34,704
  • 19
  • 73
  • 95
4
votes
1 answer

Is there any better method of displaying wall clock time except using walltimestamp variable?

I want to print the time when a probe is fired. After checking the Dtrace documents, I find the built-in variable: walltimestamp. And the Dtrace script likes this: pid$1::func:entry { trace(walltimestamp); } But the walltimestamp is "The…
Nan Xiao
  • 16,671
  • 18
  • 103
  • 164
4
votes
2 answers

Show Objective-C class in DTrace output

Using the following DTrace script, I can get an output that is close to what I want: $ cat script.d objc$target:::entry {} objc$target:::return {} $ sudo dtrace -F -s script.d -c /Applications/TextEdit.app/Contents/MacOS/TextEdit dtrace: script…
Tyilo
  • 28,998
  • 40
  • 113
  • 198
4
votes
1 answer

32 bit DTrace on OSX

I need to run DTrace on 32-bit executables on OSX. I have two machines, both running OSX 10.8.2. On one of them, /usr/lib/dtrace/libdtrace_dyld.dylib is a fat binary, on the other it isn't: /usr/lib/dtrace/libdtrace_dyld.dylib: Mach-O universal…
Mark Probst
  • 7,107
  • 7
  • 40
  • 42
4
votes
1 answer

How to view call stack with dtrace

How to view call stack, return value and arguments of the simply program below, with dtrace /** Trival code **/ #include int foo (int *a, int *b) { *a = *b; *b = 4; return 0; } int main (void) { int a, b; …
Aaron
  • 2,823
  • 9
  • 44
  • 57
4
votes
1 answer

Interposing of OS X system calls

I need to interpose (get my functions called instead of the original functions) some OS X system calls to overcome a flaw in a piece of closed-source software. Preferably, the resulting solution would work under 10.5 (Leopard) and newer, but I might…
3
votes
1 answer

Is is possible to use DTrace to view the arguments passed to strncpy?

I know I could write an interposer to watch the arguments being passed to the strncpy library call, but it seems like this should be easy to do with DTrace.
brianegge
  • 29,240
  • 13
  • 74
  • 99
3
votes
1 answer

Is it possible to notify DTrace on Mac OS X of dynamically generated code?

We would like to extend Mono's VM to generate information that can be consumed by DTrace and instruments. I am looking at making changes to the Mono runtime to have it register or notify the code that it has dynamically generated so DTrace can…
miguel.de.icaza
  • 32,654
  • 6
  • 58
  • 76
3
votes
1 answer

Debugging key event flow in OS X before it reaches an app

I have a user who reports that a particular keystroke isn't working (control-apostrophe) in my app on OS X. This does work for him on other machines. I added some logging and my app never receives the NSEvent for the keyDown. Disabling universal…
George
  • 4,189
  • 2
  • 24
  • 23
3
votes
2 answers

Setting my own probes with Dtrace in C++

I have some custom dtrace probes in a C-library, and when linking and using the library with a C application my probes work fine, however when linked against C++ it says it can't find them. The reason seems to be because of C++ mangling, and trying…
Robert Gould
  • 68,773
  • 61
  • 187
  • 272
3
votes
1 answer

Why are there not any execve calls in my dtruss trace?

I have a script like this: script.sh #!/bin/bash clang -v If I do a dtruss on it then I would expect to see an execve call to clang. $ sudo dtruss -f -a -e ./script.sh However, the trace does not contain an execve. Instead there is an error:…
sdgfsdh
  • 33,689
  • 26
  • 132
  • 245
3
votes
1 answer

How do I log messages / break execution for alloc, retain, release and dealloc of CFType objects?

I want to be able to log messages (and preferably break to the debugger) each time a specific CFType object (for my current purposes, a CGPDFDocument) is allocated, retained, released or deallocated. Because there isn't a Create...() method for…
hatfinch
  • 3,095
  • 24
  • 35
3
votes
1 answer

pid provider matching processes that come and go in dtrace

I would like to trace all function calls for a given library in a process, but the process is going to exit and re-open regularly, and I want to keep tracing. I am doing this now: oneshot$target:LIBRARY::entry { printf("%s\n",…
bnovc
  • 449
  • 1
  • 5
  • 13
3
votes
0 answers

dtrace keep getting error "error on enabled probe...invalid user access in action #1"

I am trying to use dtrace to calculate the fps of games in openGL and metal on the macOS. However, I keep getting an error saying: dtrace: error on enabled probe ID 2 (ID 86178: pid2741:OpenGL:CGLFlushDrawable:entry): invalid user access in action…
user2635911
  • 472
  • 2
  • 6
  • 16
3
votes
1 answer

How can I run this DTrace script to profile my application?

I was searching online for something to help me do assembly line profiling. I searched and found something on http://www.webservertalk.com/message897404.html There are two parts of to this problem; finding all instructions of a particular type (inc,…
Syntax_Error
  • 5,964
  • 15
  • 53
  • 73