Questions Concepts
GitHub icon

DTrace

DTrace - Programming language

< >

DTrace is a programming language created in 2005.

#400on PLDB 18Years Old 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 Token Example
Strings "
"Hello world"
Comments
/* A comment
*/
MultiLine Comments /* */
/* A comment
*/
Print() Debugging printf
Semantic Indentation X

View source

- Build the next great programming language · Search · Add Language · Features · Creators · Resources · About · Blog · Acknowledgements · Queries · Stats · Sponsor · Traffic · Traffic Today · Day 305 · feedback@pldb.com · Logout