{"id":17632943,"url":"https://github.com/kenorb/dtrace-tools","last_synced_at":"2026-01-08T02:40:45.226Z","repository":{"id":109200579,"uuid":"55769759","full_name":"kenorb/dtrace-tools","owner":"kenorb","description":"DTrace scripts for binaries that support DTrace Dynamic Tracing.","archived":false,"fork":false,"pushed_at":"2016-07-23T19:03:16.000Z","size":1115,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-05T05:44:38.159Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"DTrace","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kenorb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-04-08T10:08:42.000Z","updated_at":"2023-03-04T23:54:44.000Z","dependencies_parsed_at":"2023-05-05T13:02:02.969Z","dependency_job_id":null,"html_url":"https://github.com/kenorb/dtrace-tools","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenorb%2Fdtrace-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenorb%2Fdtrace-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenorb%2Fdtrace-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenorb%2Fdtrace-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kenorb","download_url":"https://codeload.github.com/kenorb/dtrace-tools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246273532,"owners_count":20750904,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-23T01:46:32.919Z","updated_at":"2026-01-08T02:40:45.202Z","avatar_url":"https://github.com/kenorb.png","language":"DTrace","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dtrace scripts.\n\nDTrace scripts to trace executables that support DTrace Dynamic Tracing.\n\n## Top One-Liners\n\nDTrace is a dynamic troubleshooting and analysis tool first introduced in the Solaris 10 and OpenSolaris operating systems.\n\nThe following are the top 10 one-liners to try out.\n\n### Processes\n\nNew processes with arguments:\n\n    dtrace -n 'proc:::exec-success { trace(curpsinfo-\u003epr_psargs); }'\n\n### Files\n\nFiles opened by process name:\n\n    dtrace -n 'syscall::open*:entry { printf(\"%s %s\",execname,copyinstr(arg0)); }'\n\nFiles created using creat() by process name:\n\n    dtrace -n 'syscall::creat*:entry { printf(\"%s %s\",execname,copyinstr(arg0)); }'\n\n### Syscalls\n\nSyscall count by process name:\n\n    dtrace -n 'syscall:::entry { @num[execname] = count(); }'\n\nSyscall count by syscall:\n\n    dtrace -n 'syscall:::entry { @num[probefunc] = count(); }'\n\nSyscall count by process ID:\n\n    dtrace -n 'syscall:::entry { @num[pid,execname] = count(); }'\n\nRead bytes by process name:\n\n    dtrace -n 'sysinfo:::readch { @bytes[execname] = sum(arg0); }'\n\n### I/O\n\nWrite bytes by process name:\n\n    dtrace -n 'sysinfo:::writech { @bytes[execname] = sum(arg0); }'\n\nRead size distribution by process name:\n\n    dtrace -n 'sysinfo:::readch { @dist[execname] = quantize(arg0); }'\n\nWrite size distribution by process name:\n\n    dtrace -n 'sysinfo:::writech { @dist[execname] = quantize(arg0); }'\n\n### Physical I/O\n\nDisk size by process ID:\n\n    dtrace -n 'io:::start { printf(\"%d %s %d\",pid,execname,args[0]-\u003eb_bcount); }'\n\nDisk size aggregation:\n\n    dtrace -n 'io:::start { @size[execname] = quantize(args[0]-\u003eb_bcount); }'\n\nPages paged in by process name:\n\n    dtrace -n 'vminfo:::pgpgin { @pg[execname] = sum(arg0); }'\n\n### Memory\n\nMinor faults by process name:\n\n    dtrace -n 'vminfo:::as_fault { @mem[execname] = sum(arg0); }'\n\n### User-land\n\nSample user stack trace of specified process ID at 1001 Hertz:\n\n    dtrace -n 'profile-1001 /pid == $target/ { @num[ustack()] = count(); }' -p PID\n\nTrace why threads are context switching off the CPU, from the user-land perspective:\n\n    dtrace -n 'sched:::off-cpu { @[execname, ustack()] = count(); }'\n\nUser stack size for processes:\n\n    dtrace -n 'sched:::on-cpu { @[execname] = max(curthread-\u003et_procp-\u003ep_stksize);}'\n\n### Kernel\n\nSample kernel stack trace at 1001 Hertz:\n\n    dtrace -n 'profile-1001 /!pid/ { @num[stack()] = count(); }'\n\nInterrupts by CPU:\n\n    dtrace -n 'sdt:::interrupt-start { @num[cpu] = count(); }'\n\nCPU cross calls by process name:\n\n    dtrace -n 'sysinfo:::xcalls { @num[execname] = count(); }'\n\nTrace why threads are context switching off the CPU, from the kernel perspective:\n\n    dtrace -n 'sched:::off-cpu { @[execname, stack()] = count(); }'\n\nKernel funtion calls by module:\n\n    dtrace -n 'fbt:::entry { @calls[probemod] = count(); }'\n\n### Locks\n\nTrace user-level lock statistics for 10 seconds, with 8 line stack traces (uses DTrace):\n\n    plockstat -s8 -e10 -p PID\n\nTrace kernel lock statistics for 10 seconds, with 8 line stack traces (uses DTrace):\n\n    lockstat -s8 sleep 10\n\nLock time by process name:\n\n    dtrace -n 'lockstat:::adaptive-block { @time[execname] = sum(arg1); }'\n\nLock distribution by process name:\n\n    dtrace -n 'lockstat:::adaptive-block { @time[execname] = quantize(arg1); }'\n\n### Zones\n\nSyscalls by zonename:\n\n    dtrace -n 'syscall:::entry { @num[zonename] = count(); }'\n\n### DTrace Longer One Liners\n\nNew processes with arguments and time:\n\n    dtrace -qn 'syscall::exec*:return { printf(\"%Y %s\\n\",walltimestamp,curpsinfo-\u003epr_psargs); }'\n\nSuccessful signal details:\n\n    dtrace -n 'proc:::signal-send /pid/ { printf(\"%s -%d %d\",execname,args[2],args[1]-\u003epr_pid); }'\n\nTrace PHP functions:\n\n    sudo dtrace -qn 'php*:::function-entry { printf(\"%Y: PHP function-entry:\\t%s%s%s() in %s:%d\\n\", walltimestamp, copyinstr(arg3), copyinstr(arg4), copyinstr(arg0), basename(copyinstr(arg1)), (int)arg2); }'\n\n\n### References\n\nMost of these onliners are in the [DTraceToolkit](http://www.solarisinternals.com/wiki/index.php/DTraceToolkit) as docs/oneliners.txt, and as Appendix B in Solaris Performance and Tools.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenorb%2Fdtrace-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkenorb%2Fdtrace-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenorb%2Fdtrace-tools/lists"}