devinteske

FreeBSD dnode_willuse_space dwatch(8) module

Jun 16th, 2017
553
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. # -*- tab-width: 4 -*- ;; Emacs
  2. # vi: set filetype=sh tabstop=8 shiftwidth=8 noexpandtab :: Vi/ViM
  3. ############################################################ IDENT(1)
  4. #
  5. # $Title: dwatch(8) profile for dnode_willuse_space entry $
  6. # $Copyright: 2014-2017 Devin Teske. All rights reserved. $
  7. # $FreeBSD$
  8. #
  9. ############################################################ DESCRIPTION
  10. #
  11. # Print space argument being passed to dnode_willuse_space()
  12. #
  13. ############################################################ PRAGMAS
  14.  
  15. DTRACE_PRAGMA="
  16. option quiet
  17. option dynvarsize=16m
  18. option switchrate=1hz
  19. " # END-QUOTE
  20.  
  21. ############################################################ PROBE
  22.  
  23. : ${PROBE:=fbt:zfs:dnode_willuse_space:entry}
  24.  
  25. ############################################################ ACTIONS
  26.  
  27. exec 9<<EOF
  28. int bytes;
  29.  
  30. dtrace:::BEGIN { bytes = 0 } /* probe ID $ID */
  31.  
  32. $PROBE { bytes = arg1 } /* probe ID $(( $ID + 1 )) */
  33. EOF
  34. ACTIONS=$( cat <&9 )
  35. ID=$(( $ID + 2 ))
  36.  
  37.  
  38. ############################################################ EVENT DETAILS
  39.  
  40. exec 9<<EOF
  41. printf("%d", arg1);
  42. EOF
  43. EVENT_DETAILS=$( cat <&9 )
  44.  
  45. ################################################################################
  46. # END
  47. ################################################################################
Add Comment
Please, Sign In to add comment