kprof 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. .TH KPROF 3
  2. .SH NAME
  3. kprof \- kernel profiling
  4. .SH SYNOPSIS
  5. .nf
  6. .B bind -a #K /dev
  7. .sp
  8. .B /dev/kpctl
  9. .B /dev/kpdata
  10. .fi
  11. .SH DESCRIPTION
  12. The
  13. .I kprof
  14. device provides simple profiling
  15. data for the operating system kernel. The data accumulates by
  16. recording the program counter of the kernel at each `tick' of the
  17. system clock.
  18. .PP
  19. The file
  20. .B kpdata
  21. holds the accumulated counts as 4-byte integers in big-endian
  22. byte order.
  23. The size of the file depends on the size of kernel text.
  24. The first count
  25. holds the total number of clock ticks during profiling;
  26. the second the number of ticks that occurred while the kernel
  27. was running. The rest each hold the number of ticks
  28. the kernel program counter was within the
  29. corresponding 8-byte range of kernel text, starting from the base
  30. of kernel text.
  31. .PP
  32. The file
  33. .B kpctl
  34. controls profiling.
  35. Writing the string
  36. .B start
  37. to
  38. .B kpctl
  39. begins profiling;
  40. .B stop
  41. terminates it. The message
  42. .B startclr
  43. restarts profiling after zeroing the array of counts.
  44. .PP
  45. The program
  46. .I kprof
  47. (see
  48. .IR prof (1))
  49. formats the data for presentation.
  50. .SH EXAMPLE
  51. The following
  52. .IR rc (1)
  53. script runs a test program while profiling the kernel
  54. and reports the results.
  55. .sp
  56. .EX
  57. bind -a '#K' /dev
  58. echo start > /dev/kpctl
  59. runtest
  60. echo stop > /dev/kpctl
  61. kprof /386/9pcdisk /dev/kpdata
  62. .EE
  63. .SH SOURCE
  64. .B /sys/src/9/port/devkprof.c
  65. .SH SEE ALSO
  66. .IR prof (1)