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
3
votes
0 answers

DTrace: Tracing user stack size on OS X? (curthread->t_procp->p_stksize?)

I've come across this simple DTrace script for tracing user stack sizes, but it doesn't work on OS X Mountain Lion: dtrace -n 'sched:::on-cpu { @[execname] = max(curthread->t_procp->p_stksize);}' (from:…
jor
  • 121
  • 1
  • 4
3
votes
1 answer

Python Dtrace patched, but still getting "invalid probe specifier" running test scripts

I patched Python 2.7.3 with Issue 13405, then compiled python with the --with-dtrace configure option. When I run the test_dtrace script the tests fail with the error: invalid probe specifier as shown…
3
votes
4 answers

Pthread id from pthread_self() doesn't match data from dtrace script

I'm using this dtrace script from here to try to find when context switches occur for the threads of a java program. I'm trying to match the data gathered from the script with trace data gathered from the running program (things like method…
Paul Johnson
2
votes
1 answer

How to redirect Dtrace output when using the -c flag?

How can I redirect only Dtrace's output when running a script with the -C flag? like in this case: dscript.d -s myscript.d -c date Note: I found the answer to my question before posting it, but I'm putting it here so it's part of SO.
Robert Gould
  • 68,773
  • 61
  • 187
  • 272
2
votes
1 answer

How to generate flamegraphs from macOS process samples?

Anyone have a clean process for converting samples on macOS to FlameGraphs? After a bit of fiddling I thought I could perhaps use a tool such as flamegraph-sample, but it seems to give me some trouble and so I thought perhaps there may be other more…
ylluminate
  • 12,102
  • 17
  • 78
  • 152
2
votes
2 answers

What is the programming paradigm of Dtrace?

I've been using Dtrace for a while, and as time goes by I've began to wonder what's the programming paradigm of the D language used in Dtrace. It's not an imperative language, I guess, so that means it's some sort of declarative functional…
Robert Gould
  • 68,773
  • 61
  • 187
  • 272
2
votes
1 answer

Tracing FreeBSD TCP Retransmits

Brendan Gregg has developed a great tool, "tcpretrans" based on the Dynamic Tracing feature of the Linux kernel. He explained it here: https://www.brendangregg.com/blog/2014-09-06/linux-ftrace-tcp-retransmit-tracing.html The tool utilizes…
Payam
  • 31
  • 1
2
votes
1 answer

How can I trace/snoop route changes?

I have a program that changes the routes on my mac. I want to trace what it is doing. With some dtrace/dtruss, the best I can get is something like: 2455/0x833e: stat64("/sbin/route\0", 0x7FFEE9DB0740, 0x0) = 0 0 But this isn't good…
tladuke
  • 1,337
  • 2
  • 11
  • 22
2
votes
2 answers

Profiling the FreeBSD kernel with DTrace

I'm looking to improve interface destruction time with FreeBSD. Destroying thousands of interfaces takes several minutes on my test machine running -CURRENT, and while -- admittedly -- my use case may be an unusual one, I'd like to understand what's…
xbug
  • 1,394
  • 1
  • 11
  • 18
2
votes
0 answers

Missing/unknown symbols when printing stack traces with BPF in Rust

I am using the memleak BCC tool to trace memory allocations in my Rust code but I notice a lot of my stack traces seem either incomplete or have missing symbol names. Reading Brendan Gregg's BPF Performance Tools book, it seems the two common causes…
adelbertc
  • 7,270
  • 11
  • 47
  • 70
2
votes
1 answer

Can you compare values across probes in a multi-CPU safe way in DTrace?

I'm trying to write a DTrace script which does the following: Whenever a new thread is started, increment a count. Whenever one of these threads exits, decrement the count, and exit the script if the count is now zero. I have something like…
Mark Hildreth
  • 42,023
  • 11
  • 120
  • 109
2
votes
1 answer

Does the DTrace pid provider only work for debug mode compiled programs?

I want to use DTrace to track FFI usage in a wide range of programs. DTrace is designed to work in production environments, but most software is compiled and distributed with compiler optimisations. Do these optimisations prevent using the pid…
zino
  • 1,222
  • 2
  • 17
  • 47
2
votes
3 answers

listing all calls to my library

I'm building a shared library in C, which other programs use. Sometimes, these other programs crash because of some error in my shared library. While reproducing these sort of bugs, it is very useful for me to know which functions of my library are…
Marijn van Vliet
  • 5,239
  • 2
  • 33
  • 45
2
votes
2 answers

DTrace objc : invalid probe specifier : "$1 is not referenced"

For some reason, which I need to determine, in my macOS app, when the Save panel appears for the first time in a newly-duplicated document, macOS is deleting the temporarily auto-saved document file, which of course causes the later save to fail. …
Jerry Krinock
  • 4,860
  • 33
  • 39
2
votes
1 answer

Why arg0 could indicate it is a kernel stack when?

What is the difference between arg0 and arg1 when using dtrace. dtrace -n 'profile-997 /arg0/ { @[stack()] = count() } dtrace -n 'profile-997 /arg1/ { @[ustack()] = count() } For example, the two scripts above record number of each stack. I just…
shengshan zhang
  • 538
  • 8
  • 16