counters.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. * Mach Operating System
  3. * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
  4. * All Rights Reserved.
  5. *
  6. * Permission to use, copy, modify and distribute this software and its
  7. * documentation is hereby granted, provided that both the copyright
  8. * notice and this permission notice appear in all copies of the
  9. * software, derivative works or modified versions, and any portions
  10. * thereof, and that both notices appear in supporting documentation.
  11. *
  12. * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  13. * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  14. * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  15. *
  16. * Carnegie Mellon requests users of this software to return to
  17. *
  18. * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
  19. * School of Computer Science
  20. * Carnegie Mellon University
  21. * Pittsburgh PA 15213-3890
  22. *
  23. * any improvements or extensions that they make and grant Carnegie Mellon
  24. * the rights to redistribute these changes.
  25. */
  26. #ifndef _KERN_COUNTERS_
  27. #define _KERN_COUNTERS_
  28. /*
  29. * We can count various interesting events and paths.
  30. *
  31. * Use counter() to change the counters, eg:
  32. * counter(c_idle_thread_block++);
  33. * Use counter_always() for non-conditional counters.
  34. */
  35. #define counter_always(code) code
  36. #if MACH_COUNTERS
  37. #define counter(code) counter_always(code)
  38. #else /* MACH_COUNTERS */
  39. #define counter(code)
  40. #endif /* MACH_COUNTERS */
  41. /*
  42. * We define the counters with individual integers,
  43. * instead of a big structure, so that ddb
  44. * will know the addresses of the counters.
  45. */
  46. typedef unsigned int mach_counter_t;
  47. #if MACH_COUNTERS
  48. extern mach_counter_t c_thread_invoke_hits;
  49. extern mach_counter_t c_thread_invoke_misses;
  50. extern mach_counter_t c_thread_invoke_csw;
  51. extern mach_counter_t c_thread_handoff_hits;
  52. extern mach_counter_t c_thread_handoff_misses;
  53. extern mach_counter_t c_threads_current;
  54. extern mach_counter_t c_threads_max;
  55. extern mach_counter_t c_threads_min;
  56. extern mach_counter_t c_threads_total;
  57. extern mach_counter_t c_stacks_current;
  58. extern mach_counter_t c_stacks_max;
  59. extern mach_counter_t c_stacks_min;
  60. extern mach_counter_t c_stacks_total;
  61. extern mach_counter_t c_stack_alloc_hits;
  62. extern mach_counter_t c_stack_alloc_misses;
  63. extern mach_counter_t c_stack_alloc_max;
  64. extern mach_counter_t c_clock_ticks;
  65. extern mach_counter_t c_ipc_mqueue_send_block;
  66. extern mach_counter_t c_ipc_mqueue_receive_block_user;
  67. extern mach_counter_t c_ipc_mqueue_receive_block_kernel;
  68. extern mach_counter_t c_mach_msg_trap_block_fast;
  69. extern mach_counter_t c_mach_msg_trap_block_slow;
  70. extern mach_counter_t c_mach_msg_trap_block_exc;
  71. extern mach_counter_t c_exception_raise_block;
  72. extern mach_counter_t c_swtch_block;
  73. extern mach_counter_t c_swtch_pri_block;
  74. extern mach_counter_t c_thread_switch_block;
  75. extern mach_counter_t c_thread_switch_handoff;
  76. extern mach_counter_t c_ast_taken_block;
  77. extern mach_counter_t c_thread_halt_self_block;
  78. extern mach_counter_t c_vm_fault_page_block_busy_user;
  79. extern mach_counter_t c_vm_fault_page_block_busy_kernel;
  80. extern mach_counter_t c_vm_fault_page_block_backoff_user;
  81. extern mach_counter_t c_vm_fault_page_block_backoff_kernel;
  82. extern mach_counter_t c_vm_page_wait_block_user;
  83. extern mach_counter_t c_vm_page_wait_block_kernel;
  84. extern mach_counter_t c_vm_pageout_block;
  85. extern mach_counter_t c_vm_pageout_scan_block;
  86. extern mach_counter_t c_idle_thread_block;
  87. extern mach_counter_t c_idle_thread_handoff;
  88. extern mach_counter_t c_sched_thread_block;
  89. extern mach_counter_t c_io_done_thread_block;
  90. extern mach_counter_t c_net_thread_block;
  91. extern mach_counter_t c_reaper_thread_block;
  92. extern mach_counter_t c_swapin_thread_block;
  93. extern mach_counter_t c_action_thread_block;
  94. #endif /* MACH_COUNTERS */
  95. #endif /* _KERN_COUNTERS_ */