Advertisement
Guest User

Untitled

a guest
Jan 21st, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. $ source ./strace_sample.sh
  2. $ funk_a
  3. Earth, Wind, Fire and Water
  4. $ funk_b
  5. Get on up
  6. strace: Can't stat 'funk_a': No such file or directory
  7.  
  8. $ dpkg -p strace|grep Vers
  9. Version: 4.8-1ubuntu5
  10. $ lsb_release -a
  11. No LSB modules are available.
  12. Distributor ID: Ubuntu
  13. Description: Ubuntu 14.04.5 LTS
  14. Release: 14.04
  15. Codename: trusty
  16.  
  17. #!/bin/bash
  18.  
  19. function funk_a {
  20. echo "Earth, Wind, Fire and Water"
  21. }
  22.  
  23. function funk_b {
  24. echo "Get on up"
  25. strace -o trace_output.txt -c -Ttt funk_a
  26. }
  27.  
  28. strace -o trace_output.txt -Ttt bash -c "$(typeset -f func_a); func_a"
  29.  
  30. strace -o trace_output.txt -Ttt -p "$$" &
  31. func_a
  32. kill "$!"
  33.  
  34. strace -o trace_output.txt -Ttt -p "$$" &
  35. tail -f trace_output.txt | read # wait for some output in trace_output.txt
  36.  
  37. func_a
  38. kill "$!"
  39.  
  40. #!/bin/bash
  41. echo "Earth, Wind, Fire and Water"
  42.  
  43. #!/bin/bash
  44.  
  45. function funk_b {
  46. echo "Get on up"
  47. #strace -o funk_a.out -c -Ttt funk_a
  48. strace -o util.out -c -Ttt ./util.sh
  49. }
  50.  
  51. $ funk_b
  52. Get on up
  53. Earth, Wind, Fire and Water
  54. $ more util.out
  55. % time seconds usecs/call calls errors syscall
  56. ------ ----------- ----------- --------- --------- ----------------
  57. 0.00 0.000000 0 7 read
  58. 0.00 0.000000 0 1 write
  59. 0.00 0.000000 0 27 18 open
  60. :
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement