Advertisement
Guest User

Untitled

a guest
May 28th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.32 KB | None | 0 0
  1. #!/usr/sbin/dtrace -s
  2.  
  3. #pragma D option quiet
  4. /* #pragma D option flowindent*/
  5.  
  6. /* #pragma D option destructive */
  7.  
  8. /* int cnt=0;*/
  9.  
  10. dtrace:::BEGIN {
  11.         trace("tracing start\n");
  12. }
  13.  
  14. /*
  15. Usage of profile provider
  16. profile:::tick-2s {
  17.         trace("tracing is running\n");
  18. }
  19. */
  20.  
  21. /*
  22. Usage of sched provider
  23. sched:::on-cpu {
  24.         printf("-> Process scheduled child = %d -- cpu = %d -- pid = %d ( execname=%s )\n", chip, cpu, pid, execname);
  25.         cnt++;
  26. }
  27.  
  28. sched:::off-cpu
  29. / cnt > 1000 /
  30. {
  31.         printf("<- Process descheduled \n");
  32. }
  33. */
  34.  
  35. /*
  36. sched:::on-cpu {
  37.  
  38.         print count of processes scheduled on cpu
  39.         @aggr[execname] = count();
  40.  
  41.         @aggr[execname] = lquantize(curthread->t_pri, 0, 159, 1);
  42.         printf("-> Process scheduled child = %d -- cpu = %d -- pid = %d ( execname=%s )\n", chip, cpu, pid, execname);
  43. }
  44. */
  45.  
  46. /* syscall:::entry {
  47.         this->time = timestamp;
  48. }
  49.  
  50. syscall:::return
  51. / this->time !=0 /
  52. {
  53.  
  54.         @aggr[probefunc] = sum((timestamp - this->time) / 1000);
  55.         printf("syscall %s => %d\n", probefunc, (timestamp - this->time) / 1000);
  56. }
  57. */
  58.  
  59. /* fbt:zfs:txg_*: {
  60. }
  61. */
  62.  
  63. /* fbt::fork*: {
  64.  
  65. }*/
  66.  
  67. syscall::open:entry {
  68.         printf("opening file %s from %d\n", copyinstr(arg0), pid);
  69. }
  70.  
  71. dtrace:::END {
  72.         trace("tracing end\n");
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement