dtrace

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 %d size %d block %llu\n", args[2]->fi_pathname, args[2]->fi_offset, args[0]->b_b...

how do you build DTrace on Mac OS X?

I'm trying to build the dtrace target in the Xcode project using the advice here: http://osx86.boeaja.info/2009/10/building-xnu-kernel-on-snow-leopard/ But I get: libproc.m:24:49: error: CoreSymbolication/CoreSymbolication.h: No such file or directory I realize CoreSymbolication is a private framework, but Apple must make this header ...

How do you print an associative array in dtrace?

The question pretty much sums it up. "dtrace 'print an associative array'" has exactly one google hit and the similar searches are equally useless. EDIT: If I were to use an aggregation, I'm not aware that I'd still be able to remove entries. My application requires that I be able to do things like: file_descriptors[0] = "stdin" fil...

Is there a dtrace equivalent for .Net

Is there a .Net equivalent or analogue for dtrace? ...

How to see bounds of RgnHandle passed to SetPortVisibleRegion in Instruments?

I've got a difficult drawing bug that I am trying to track down. I know what is going on - during the draw routine, the region returned by GetPortVisibleRegion is wrong. I believe it is because someone has done something to cause SetPortVisibleRegion to be called with the bad region. I cannot just search for all of the calls to SetPortVi...

Are there dtrace ustack() helpers on Mac OS X?

Hi, I've been wondering if there is any chance to use dtrace ustack helpers on Mac OS X for python and other interpreted languages? I know that you can figure out what python and php on OpenSolaris are doing when giving the ustack some extra memory for a buffer. Is this somehow possible on Mac OS X? Regards raichoo ...

How can get dtrace to run the traced command with non-root priviledges ?

OS X lacks linux's strace, but it has dtrace which is supposed to be so much better. However, I miss the ability to do simple tracing on individual commands. For example, on linux I can write strace -f gcc hello.c to caputre all system calls, which gives me the list of all the filenames needed by the compiler to compile my program (th...

Which (OS X) dtrace probe fires when a page is faulted in from disk?

I'm writing up a document about page faulting and am trying to get some concrete numbers to work with, so I wrote up a simple program that reads 12*1024*1024 bytes of data. Easy: int main() { FILE*in = fopen("data.bin", "rb"); int i; int total=0; for(i=0; i<1024*1024*12; i++) total += fgetc(in); printf("%d\n", total); } ...

DTrace: how to print out memory buffers.

Hello, I need to trace all pwrite(2) calls done to some specific file and print all buffers that are to be written byte by byte. The data expected is not in ASCII string format so i can't use: printf("%s\n", copyinstr(arg1)) I learned about copyin(arg1, arg2), but that gives me a void* and all examples i've found covert it to string...

Enabling dtrace on Apache on FreeBSD

HI i am using freeBSD as my operating system.I have apache version 2.2.16 installed on it.I want to make this dtrace enabled.How can i do this.Thanks in advance ...

XCode Instruments - equivalents for Windows?

XCode's Instruments make me feel physically I'll. They're based on DTrace - which has some loose equivalents in Windows - but the GUI Apple made for them makes them usable in a day to day way. Visual Studio just doesn't seem to have tools to compete. It has an attempt at a profiler that requires a lot of command line mojo and parsing of...

libdtrace buffered output

I'm trying to use dtrace through libdtrace (on Snow Leopard; 10.6.4). I want to catch the printed output of my dtrace script within my own program. One way to do so would be to have the output go to a temporary file and read it from there. However, libdtrace supports a callback function to catch the output directly which I'd prefer. I a...

How does DTrace pid probes work?

How do DTrace pid probes, specifically entry and return probes, work on assembly level ? My assumption was that upon initialization, DTrace would modify the target code by changing the instruction at the target location to be an interrupt (e.g. 'int 0x1'). Then in the interrupt handler first do the tracing task, then complete the origin...

Recommended books for learning DTrace

Since the last question similar to this one is from 2008, I thought I'd ask it anyway to see what's new since then. I'm looking for books or other resources (though I prefer epubs for reading them on the go) for learning how to use DTrace, preferably but not necessarily for Cocoa, ruby or node.js development. ...