perfctr.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. /*----------------------------------------
  3. PERFORMANCE INSTRUMENTATION
  4. Guillaume Thouvenin 08/10/98
  5. David S. Miller 10/06/98
  6. ---------------------------------------*/
  7. #ifndef PERF_COUNTER_API
  8. #define PERF_COUNTER_API
  9. /* sys_perfctr() interface. First arg is operation code
  10. * from enumeration below. The meaning of further arguments
  11. * are determined by the operation code.
  12. *
  13. * NOTE: This system call is no longer provided, use the perf_events
  14. * infrastructure.
  15. *
  16. * Pointers which are passed by the user are pointers to 64-bit
  17. * integers.
  18. *
  19. * Once enabled, performance counter state is retained until the
  20. * process either exits or performs an exec. That is, performance
  21. * counters remain enabled for fork/clone children.
  22. */
  23. enum perfctr_opcode {
  24. /* Enable UltraSparc performance counters, ARG0 is pointer
  25. * to 64-bit accumulator for D0 counter in PIC, ARG1 is pointer
  26. * to 64-bit accumulator for D1 counter. ARG2 is a pointer to
  27. * the initial PCR register value to use.
  28. */
  29. PERFCTR_ON,
  30. /* Disable UltraSparc performance counters. The PCR is written
  31. * with zero and the user counter accumulator pointers and
  32. * working PCR register value are forgotten.
  33. */
  34. PERFCTR_OFF,
  35. /* Add current D0 and D1 PIC values into user pointers given
  36. * in PERFCTR_ON operation. The PIC is cleared before returning.
  37. */
  38. PERFCTR_READ,
  39. /* Clear the PIC register. */
  40. PERFCTR_CLRPIC,
  41. /* Begin using a new PCR value, the pointer to which is passed
  42. * in ARG0. The PIC is also cleared after the new PCR value is
  43. * written.
  44. */
  45. PERFCTR_SETPCR,
  46. /* Store in pointer given in ARG0 the current PCR register value
  47. * being used.
  48. */
  49. PERFCTR_GETPCR
  50. };
  51. #define PRIV 0x00000001
  52. #define SYS 0x00000002
  53. #define USR 0x00000004
  54. /* Pic.S0 Selection Bit Field Encoding, Ultra-I/II */
  55. #define CYCLE_CNT 0x00000000
  56. #define INSTR_CNT 0x00000010
  57. #define DISPATCH0_IC_MISS 0x00000020
  58. #define DISPATCH0_STOREBUF 0x00000030
  59. #define IC_REF 0x00000080
  60. #define DC_RD 0x00000090
  61. #define DC_WR 0x000000A0
  62. #define LOAD_USE 0x000000B0
  63. #define EC_REF 0x000000C0
  64. #define EC_WRITE_HIT_RDO 0x000000D0
  65. #define EC_SNOOP_INV 0x000000E0
  66. #define EC_RD_HIT 0x000000F0
  67. /* Pic.S0 Selection Bit Field Encoding, Ultra-III */
  68. #define US3_CYCLE_CNT 0x00000000
  69. #define US3_INSTR_CNT 0x00000010
  70. #define US3_DISPATCH0_IC_MISS 0x00000020
  71. #define US3_DISPATCH0_BR_TGT 0x00000030
  72. #define US3_DISPATCH0_2ND_BR 0x00000040
  73. #define US3_RSTALL_STOREQ 0x00000050
  74. #define US3_RSTALL_IU_USE 0x00000060
  75. #define US3_IC_REF 0x00000080
  76. #define US3_DC_RD 0x00000090
  77. #define US3_DC_WR 0x000000a0
  78. #define US3_EC_REF 0x000000c0
  79. #define US3_EC_WR_HIT_RTO 0x000000d0
  80. #define US3_EC_SNOOP_INV 0x000000e0
  81. #define US3_EC_RD_MISS 0x000000f0
  82. #define US3_PC_PORT0_RD 0x00000100
  83. #define US3_SI_SNOOP 0x00000110
  84. #define US3_SI_CIQ_FLOW 0x00000120
  85. #define US3_SI_OWNED 0x00000130
  86. #define US3_SW_COUNT_0 0x00000140
  87. #define US3_IU_BR_MISS_TAKEN 0x00000150
  88. #define US3_IU_BR_COUNT_TAKEN 0x00000160
  89. #define US3_DISP_RS_MISPRED 0x00000170
  90. #define US3_FA_PIPE_COMPL 0x00000180
  91. #define US3_MC_READS_0 0x00000200
  92. #define US3_MC_READS_1 0x00000210
  93. #define US3_MC_READS_2 0x00000220
  94. #define US3_MC_READS_3 0x00000230
  95. #define US3_MC_STALLS_0 0x00000240
  96. #define US3_MC_STALLS_2 0x00000250
  97. /* Pic.S1 Selection Bit Field Encoding, Ultra-I/II */
  98. #define CYCLE_CNT_D1 0x00000000
  99. #define INSTR_CNT_D1 0x00000800
  100. #define DISPATCH0_IC_MISPRED 0x00001000
  101. #define DISPATCH0_FP_USE 0x00001800
  102. #define IC_HIT 0x00004000
  103. #define DC_RD_HIT 0x00004800
  104. #define DC_WR_HIT 0x00005000
  105. #define LOAD_USE_RAW 0x00005800
  106. #define EC_HIT 0x00006000
  107. #define EC_WB 0x00006800
  108. #define EC_SNOOP_CB 0x00007000
  109. #define EC_IT_HIT 0x00007800
  110. /* Pic.S1 Selection Bit Field Encoding, Ultra-III */
  111. #define US3_CYCLE_CNT_D1 0x00000000
  112. #define US3_INSTR_CNT_D1 0x00000800
  113. #define US3_DISPATCH0_MISPRED 0x00001000
  114. #define US3_IC_MISS_CANCELLED 0x00001800
  115. #define US3_RE_ENDIAN_MISS 0x00002000
  116. #define US3_RE_FPU_BYPASS 0x00002800
  117. #define US3_RE_DC_MISS 0x00003000
  118. #define US3_RE_EC_MISS 0x00003800
  119. #define US3_IC_MISS 0x00004000
  120. #define US3_DC_RD_MISS 0x00004800
  121. #define US3_DC_WR_MISS 0x00005000
  122. #define US3_RSTALL_FP_USE 0x00005800
  123. #define US3_EC_MISSES 0x00006000
  124. #define US3_EC_WB 0x00006800
  125. #define US3_EC_SNOOP_CB 0x00007000
  126. #define US3_EC_IC_MISS 0x00007800
  127. #define US3_RE_PC_MISS 0x00008000
  128. #define US3_ITLB_MISS 0x00008800
  129. #define US3_DTLB_MISS 0x00009000
  130. #define US3_WC_MISS 0x00009800
  131. #define US3_WC_SNOOP_CB 0x0000a000
  132. #define US3_WC_SCRUBBED 0x0000a800
  133. #define US3_WC_WB_WO_READ 0x0000b000
  134. #define US3_PC_SOFT_HIT 0x0000c000
  135. #define US3_PC_SNOOP_INV 0x0000c800
  136. #define US3_PC_HARD_HIT 0x0000d000
  137. #define US3_PC_PORT1_RD 0x0000d800
  138. #define US3_SW_COUNT_1 0x0000e000
  139. #define US3_IU_STAT_BR_MIS_UNTAKEN 0x0000e800
  140. #define US3_IU_STAT_BR_COUNT_UNTAKEN 0x0000f000
  141. #define US3_PC_MS_MISSES 0x0000f800
  142. #define US3_MC_WRITES_0 0x00010800
  143. #define US3_MC_WRITES_1 0x00011000
  144. #define US3_MC_WRITES_2 0x00011800
  145. #define US3_MC_WRITES_3 0x00012000
  146. #define US3_MC_STALLS_1 0x00012800
  147. #define US3_MC_STALLS_3 0x00013000
  148. #define US3_RE_RAW_MISS 0x00013800
  149. #define US3_FM_PIPE_COMPLETION 0x00014000
  150. struct vcounter_struct {
  151. unsigned long long vcnt0;
  152. unsigned long long vcnt1;
  153. };
  154. #endif /* !(PERF_COUNTER_API) */