Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
DTrace
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Command line examples== DTrace scripts can be invoked directly from the command line, providing one or more probes and actions as arguments. Some examples: <syntaxhighlight lang="bash"> # New processes with arguments dtrace -n 'proc:::exec-success { trace(curpsinfo->pr_psargs); }' # Files opened by process dtrace -n 'syscall::open*:entry { printf("%s %s",execname,copyinstr(arg0)); }' # Syscall count by program dtrace -n 'syscall:::entry { @num[execname] = count(); }' # Syscall count by syscall dtrace -n 'syscall:::entry { @num[probefunc] = count(); }' # Syscall count by process dtrace -n 'syscall:::entry { @num[pid,execname] = count(); }' # Disk size by process dtrace -n 'io:::start { printf("%d %s %d",pid,execname,args[0]->b_bcount); }' # Pages paged in by process dtrace -n 'vminfo:::pgpgin { @pg[execname] = sum(arg0); }' </syntaxhighlight> Scripts can also be written which can reach hundreds of lines in length, although typically only tens of lines are needed for advanced troubleshooting and analysis. Over 200 examples of open source DTrace scripts can be found in the DTraceToolkit,<ref>{{cite web | url = http://www.brendangregg.com/dtracetoolkit.html | title = DTraceToolkit | publisher = [[Brendan Gregg]] | access-date=2014-06-08 }}</ref> created by [[Brendan Gregg]] (author of the DTrace book<ref>{{cite book | url = http://my.safaribooksonline.com/book/operating-systems-and-server-administration/solaris/9780137061839 | title = DTrace: Dynamic Tracing in Oracle Solaris, Mac OS X and FreeBSD | publisher = [[Safari Books]] | isbn = 978-0132091510 | date = 2011 | access-date = 2011-01-03 | archive-date = 2011-04-06 | archive-url = https://web.archive.org/web/20110406173133/http://my.safaribooksonline.com/book/operating-systems-and-server-administration/solaris/9780137061839 | url-status = dead }}</ref>), which also provides documentation and demonstrations of each.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)