PLDB
Languages Features Calendar CSV Lists Blog About Sponsor Add Language
GitHub icon

DTrace

DTrace

DTrace is a pl created in 2005.

#371on PLDB 17Years Old 926Users
2Books 0Papers 534Repos

DTrace is a comprehensive dynamic tracing framework created by Sun Microsystems for troubleshooting kernel and application problems on production systems in real time. Originally developed for Solaris, it has since been released under the free Common Development and Distribution License (CDDL) and has been ported to several other Unix-like systems. DTrace can be used to get a global overview of a running system, such as the amount of memory, CPU time, filesystem and network resources used by the active processes. Read more on Wikipedia...


Example from the web:
# Syscall count by syscall dtrace -n 'syscall:::entry { @num[probefunc] = count(); }' # Syscall count by process dtrace -n 'syscall:::entry { @num[pid,execname] = count(); }'
Example from hello-world:
#!/usr/sbin/dtrace -qs BEGIN { printf("Hello World"); exit(0); }
Example from Linguist:
/* * This software is in the public domain. * * $Id: counts.d 10510 2005-08-15 01:46:19Z kateturner $ */ #pragma D option quiet self int tottime; BEGIN { tottime = timestamp; } php$target:::function-entry @counts[copyinstr(arg0)] = count(); } END { printf("Total time: %dus\n", (timestamp - tottime) / 1000); printf("# calls by function:\n"); printa("%-40s %@d\n", @counts); }
Example from Wikipedia:
# 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); }'

Language features

Feature Supported Example Token
Strings
"Hello world"
"
Comments
/* A comment
*/
MultiLine Comments
/* A comment
*/
/* */
Print() Debugging printf
Semantic Indentation ϴ

Books about DTrace on goodreads

title author year reviews ratings rating
Advanced Apple Debugging & Reverse Engineering: Exploring Apple code through LLDB, Python and DTrace Derek Selander 0 2 5.00
Advanced Apple Debugging & Reverse Engineering Second Edition: Exploring Apple code through LLDB, Python and DTrace raywenderlich.com Team 0 0 0.0
fastq-format.html · dtrace.html · unison.html

View source

PLDB - Build the next great programming language · v2022 · Day 31 · Docs · Build · Acknowledgements · Traffic Today · Traffic Trends · Mirrors · GitHub · feedback@pldb.com