Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

932 lines
26 KiB

  1. /*++ BUILD Version: 0001 // Increment this if a change has global effects
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. p5data.c
  5. Abstract:
  6. a file containing the constant data structures used by the Performance
  7. Monitor data for the P5 Extensible Objects.
  8. This file contains a set of constant data structures which are
  9. currently defined for the P5 Extensible Objects. This is an
  10. example of how other such objects could be defined.
  11. Created:
  12. Russ Blake 24 Dec 93
  13. Revision History:
  14. None.
  15. --*/
  16. //
  17. // Include Files
  18. //
  19. #include <windows.h>
  20. #include <winperf.h>
  21. #include <assert.h>
  22. #include "p5ctrnam.h"
  23. #include "pentdata.h"
  24. //
  25. // Constant structure initializations for the sturcture defined in p5data.h
  26. //
  27. P5_DATA_DEFINITION P5DataDefinition = {
  28. {
  29. sizeof(P5_DATA_DEFINITION) + sizeof(P5_COUNTER_DATA),
  30. sizeof(P5_DATA_DEFINITION),
  31. sizeof(PERF_OBJECT_TYPE),
  32. PENTIUM,
  33. 0,
  34. PENTIUM,
  35. 0,
  36. PERF_DETAIL_WIZARD,
  37. (sizeof(P5_DATA_DEFINITION)-sizeof(PERF_OBJECT_TYPE))/
  38. sizeof(PERF_COUNTER_DEFINITION),
  39. 62,
  40. 0,
  41. 0
  42. },
  43. {
  44. sizeof(PERF_COUNTER_DEFINITION),
  45. DATA_READ,
  46. 0,
  47. DATA_READ,
  48. 0,
  49. -4,
  50. PERF_DETAIL_WIZARD,
  51. PERF_COUNTER_BULK_COUNT,
  52. sizeof(((PP5_COUNTER_DATA)0)->llData_read),
  53. (DWORD)&((PP5_COUNTER_DATA)0)->llData_read
  54. },
  55. {
  56. sizeof(PERF_COUNTER_DEFINITION),
  57. DATA_WRITE,
  58. 0,
  59. DATA_WRITE,
  60. 0,
  61. -4,
  62. PERF_DETAIL_WIZARD,
  63. PERF_COUNTER_BULK_COUNT,
  64. sizeof(((PP5_COUNTER_DATA)0)->llData_write),
  65. (DWORD)&((PP5_COUNTER_DATA)0)->llData_write
  66. },
  67. {
  68. sizeof(PERF_COUNTER_DEFINITION),
  69. DATA_TLB_MISS,
  70. 0,
  71. DATA_TLB_MISS,
  72. 0,
  73. -2,
  74. PERF_DETAIL_WIZARD,
  75. PERF_COUNTER_BULK_COUNT,
  76. sizeof(((PP5_COUNTER_DATA)0)->llData_tlb_miss),
  77. (DWORD)&((PP5_COUNTER_DATA)0)->llData_tlb_miss
  78. },
  79. {
  80. sizeof(PERF_COUNTER_DEFINITION),
  81. DATA_READ_MISS,
  82. 0,
  83. DATA_READ_MISS,
  84. 0,
  85. -3,
  86. PERF_DETAIL_WIZARD,
  87. PERF_COUNTER_BULK_COUNT,
  88. sizeof(((PP5_COUNTER_DATA)0)->llData_read_miss),
  89. (DWORD)&((PP5_COUNTER_DATA)0)->llData_read_miss
  90. },
  91. {
  92. sizeof(PERF_COUNTER_DEFINITION),
  93. DATA_WRITE_MISS,
  94. 0,
  95. DATA_WRITE_MISS,
  96. 0,
  97. -3,
  98. PERF_DETAIL_WIZARD,
  99. PERF_COUNTER_BULK_COUNT,
  100. sizeof(((PP5_COUNTER_DATA)0)->llData_write_miss),
  101. (DWORD)&((PP5_COUNTER_DATA)0)->llData_write_miss
  102. },
  103. {
  104. sizeof(PERF_COUNTER_DEFINITION),
  105. WRITE_HIT_TO_ME_LINE,
  106. 0,
  107. WRITE_HIT_TO_ME_LINE,
  108. 0,
  109. -4,
  110. PERF_DETAIL_WIZARD,
  111. PERF_COUNTER_BULK_COUNT,
  112. sizeof(((PP5_COUNTER_DATA)0)->llWrite_hit_to_me_line),
  113. (DWORD)&((PP5_COUNTER_DATA)0)->llWrite_hit_to_me_line
  114. },
  115. {
  116. sizeof(PERF_COUNTER_DEFINITION),
  117. DATA_CACHE_LINE_WB,
  118. 0,
  119. DATA_CACHE_LINE_WB,
  120. 0,
  121. -2,
  122. PERF_DETAIL_WIZARD,
  123. PERF_COUNTER_BULK_COUNT,
  124. sizeof(((PP5_COUNTER_DATA)0)->llData_cache_line_wb),
  125. (DWORD)&((PP5_COUNTER_DATA)0)->llData_cache_line_wb
  126. },
  127. {
  128. sizeof(PERF_COUNTER_DEFINITION),
  129. DATA_CACHE_SNOOPS,
  130. 0,
  131. DATA_CACHE_SNOOPS,
  132. 0,
  133. -2,
  134. PERF_DETAIL_WIZARD,
  135. PERF_COUNTER_BULK_COUNT,
  136. sizeof(((PP5_COUNTER_DATA)0)->llData_cache_snoops),
  137. (DWORD)&((PP5_COUNTER_DATA)0)->llData_cache_snoops
  138. },
  139. {
  140. sizeof(PERF_COUNTER_DEFINITION),
  141. DATA_CACHE_SNOOP_HITS,
  142. 0,
  143. DATA_CACHE_SNOOP_HITS,
  144. 0,
  145. -1,
  146. PERF_DETAIL_WIZARD,
  147. PERF_COUNTER_BULK_COUNT,
  148. sizeof(((PP5_COUNTER_DATA)0)->llData_cache_snoop_hits),
  149. (DWORD)&((PP5_COUNTER_DATA)0)->llData_cache_snoop_hits
  150. },
  151. {
  152. sizeof(PERF_COUNTER_DEFINITION),
  153. MEMORY_ACCESSES_IN_PIPES,
  154. 0,
  155. MEMORY_ACCESSES_IN_PIPES,
  156. 0,
  157. -3,
  158. PERF_DETAIL_WIZARD,
  159. PERF_COUNTER_BULK_COUNT,
  160. sizeof(((PP5_COUNTER_DATA)0)->llMemory_accesses_in_pipes),
  161. (DWORD)&((PP5_COUNTER_DATA)0)->llMemory_accesses_in_pipes
  162. },
  163. {
  164. sizeof(PERF_COUNTER_DEFINITION),
  165. BANK_CONFLICTS,
  166. 0,
  167. BANK_CONFLICTS,
  168. 0,
  169. -3,
  170. PERF_DETAIL_WIZARD,
  171. PERF_COUNTER_BULK_COUNT,
  172. sizeof(((PP5_COUNTER_DATA)0)->llBank_conflicts),
  173. (DWORD)&((PP5_COUNTER_DATA)0)->llBank_conflicts
  174. },
  175. {
  176. sizeof(PERF_COUNTER_DEFINITION),
  177. MISADLIGNED_DATA_REF,
  178. 0,
  179. MISADLIGNED_DATA_REF,
  180. 0,
  181. -2,
  182. PERF_DETAIL_WIZARD,
  183. PERF_COUNTER_BULK_COUNT,
  184. sizeof(((PP5_COUNTER_DATA)0)->llMisaligned_data_ref),
  185. (DWORD)&((PP5_COUNTER_DATA)0)->llMisaligned_data_ref
  186. },
  187. {
  188. sizeof(PERF_COUNTER_DEFINITION),
  189. CODE_READ,
  190. 0,
  191. CODE_READ,
  192. 0,
  193. -4,
  194. PERF_DETAIL_WIZARD,
  195. PERF_COUNTER_BULK_COUNT,
  196. sizeof(((PP5_COUNTER_DATA)0)->llCode_read),
  197. (DWORD)&((PP5_COUNTER_DATA)0)->llCode_read
  198. },
  199. {
  200. sizeof(PERF_COUNTER_DEFINITION),
  201. CODE_TLB_MISS,
  202. 0,
  203. CODE_TLB_MISS,
  204. 0,
  205. -2,
  206. PERF_DETAIL_WIZARD,
  207. PERF_COUNTER_BULK_COUNT,
  208. sizeof(((PP5_COUNTER_DATA)0)->llCode_tlb_miss),
  209. (DWORD)&((PP5_COUNTER_DATA)0)->llCode_tlb_miss
  210. },
  211. {
  212. sizeof(PERF_COUNTER_DEFINITION),
  213. CODE_CACHE_MISS,
  214. 0,
  215. CODE_CACHE_MISS,
  216. 0,
  217. -3,
  218. PERF_DETAIL_WIZARD,
  219. PERF_COUNTER_BULK_COUNT,
  220. sizeof(((PP5_COUNTER_DATA)0)->llCode_cache_miss),
  221. (DWORD)&((PP5_COUNTER_DATA)0)->llCode_cache_miss
  222. },
  223. {
  224. sizeof(PERF_COUNTER_DEFINITION),
  225. SEGMENT_LOADS,
  226. 0,
  227. SEGMENT_LOADS,
  228. 0,
  229. -2,
  230. PERF_DETAIL_WIZARD,
  231. PERF_COUNTER_BULK_COUNT,
  232. sizeof(((PP5_COUNTER_DATA)0)->llSegment_loads),
  233. (DWORD)&((PP5_COUNTER_DATA)0)->llSegment_loads
  234. },
  235. {
  236. sizeof(PERF_COUNTER_DEFINITION),
  237. BRANCHES,
  238. 0,
  239. BRANCHES,
  240. 0,
  241. -4,
  242. PERF_DETAIL_WIZARD,
  243. PERF_COUNTER_BULK_COUNT,
  244. sizeof(((PP5_COUNTER_DATA)0)->llBranches),
  245. (DWORD)&((PP5_COUNTER_DATA)0)->llBranches
  246. },
  247. {
  248. sizeof(PERF_COUNTER_DEFINITION),
  249. BTB_HITS,
  250. 0,
  251. BTB_HITS,
  252. 0,
  253. -3,
  254. PERF_DETAIL_WIZARD,
  255. PERF_COUNTER_BULK_COUNT,
  256. sizeof(((PP5_COUNTER_DATA)0)->llBtb_hits),
  257. (DWORD)&((PP5_COUNTER_DATA)0)->llBtb_hits
  258. },
  259. {
  260. sizeof(PERF_COUNTER_DEFINITION),
  261. TAKEN_BRANCH_OR_BTB_HITS,
  262. 0,
  263. TAKEN_BRANCH_OR_BTB_HITS,
  264. 0,
  265. -4,
  266. PERF_DETAIL_WIZARD,
  267. PERF_COUNTER_BULK_COUNT,
  268. sizeof(((PP5_COUNTER_DATA)0)->llTaken_branch_or_btb_hits),
  269. (DWORD)&((PP5_COUNTER_DATA)0)->llTaken_branch_or_btb_hits
  270. },
  271. {
  272. sizeof(PERF_COUNTER_DEFINITION),
  273. PIPELINE_FLUSHES,
  274. 0,
  275. PIPELINE_FLUSHES,
  276. 0,
  277. -3,
  278. PERF_DETAIL_WIZARD,
  279. PERF_COUNTER_BULK_COUNT,
  280. sizeof(((PP5_COUNTER_DATA)0)->llPipeline_flushes),
  281. (DWORD)&((PP5_COUNTER_DATA)0)->llPipeline_flushes
  282. },
  283. {
  284. sizeof(PERF_COUNTER_DEFINITION),
  285. INSTRUCTIONS_EXECUTED,
  286. 0,
  287. INSTRUCTIONS_EXECUTED,
  288. 0,
  289. -5,
  290. PERF_DETAIL_WIZARD,
  291. PERF_COUNTER_BULK_COUNT,
  292. sizeof(((PP5_COUNTER_DATA)0)->llInstructions_executed),
  293. (DWORD)&((PP5_COUNTER_DATA)0)->llInstructions_executed
  294. },
  295. {
  296. sizeof(PERF_COUNTER_DEFINITION),
  297. INSTRUCTIONS_EXECUTED_IN_VPIPE,
  298. 0,
  299. INSTRUCTIONS_EXECUTED_IN_VPIPE,
  300. 0,
  301. -4,
  302. PERF_DETAIL_WIZARD,
  303. PERF_COUNTER_BULK_COUNT,
  304. sizeof(((PP5_COUNTER_DATA)0)->llInstructions_executed_in_vpipe),
  305. (DWORD)&((PP5_COUNTER_DATA)0)->llInstructions_executed_in_vpipe
  306. },
  307. {
  308. sizeof(PERF_COUNTER_DEFINITION),
  309. BUS_UTILIZATION,
  310. 0,
  311. BUS_UTILIZATION,
  312. 0,
  313. -5,
  314. PERF_DETAIL_WIZARD,
  315. PERF_COUNTER_BULK_COUNT,
  316. sizeof(((PP5_COUNTER_DATA)0)->llBus_utilization),
  317. (DWORD)&((PP5_COUNTER_DATA)0)->llBus_utilization
  318. },
  319. {
  320. sizeof(PERF_COUNTER_DEFINITION),
  321. PIPE_STALLED_ON_WRITES,
  322. 0,
  323. PIPE_STALLED_ON_WRITES,
  324. 0,
  325. -4,
  326. PERF_DETAIL_WIZARD,
  327. PERF_COUNTER_BULK_COUNT,
  328. sizeof(((PP5_COUNTER_DATA)0)->llPipe_stalled_on_writes),
  329. (DWORD)&((PP5_COUNTER_DATA)0)->llPipe_stalled_on_writes
  330. },
  331. {
  332. sizeof(PERF_COUNTER_DEFINITION),
  333. PIPE_STALLED_ON_READ,
  334. 0,
  335. PIPE_STALLED_ON_READ,
  336. 0,
  337. -4,
  338. PERF_DETAIL_WIZARD,
  339. PERF_COUNTER_BULK_COUNT,
  340. sizeof(((PP5_COUNTER_DATA)0)->llPipe_stalled_on_read),
  341. (DWORD)&((PP5_COUNTER_DATA)0)->llPipe_stalled_on_read
  342. },
  343. {
  344. sizeof(PERF_COUNTER_DEFINITION),
  345. STALLED_WHILE_EWBE,
  346. 0,
  347. STALLED_WHILE_EWBE,
  348. 0,
  349. -3,
  350. PERF_DETAIL_WIZARD,
  351. PERF_COUNTER_BULK_COUNT,
  352. sizeof(((PP5_COUNTER_DATA)0)->llStalled_while_ewbe),
  353. (DWORD)&((PP5_COUNTER_DATA)0)->llStalled_while_ewbe
  354. },
  355. {
  356. sizeof(PERF_COUNTER_DEFINITION),
  357. LOCKED_BUS_CYCLE,
  358. 0,
  359. LOCKED_BUS_CYCLE,
  360. 0,
  361. -1,
  362. PERF_DETAIL_WIZARD,
  363. PERF_COUNTER_BULK_COUNT,
  364. sizeof(((PP5_COUNTER_DATA)0)->llLocked_bus_cycle),
  365. (DWORD)&((PP5_COUNTER_DATA)0)->llLocked_bus_cycle
  366. },
  367. {
  368. sizeof(PERF_COUNTER_DEFINITION),
  369. IO_RW_CYCLE,
  370. 0,
  371. IO_RW_CYCLE,
  372. 0,
  373. -3,
  374. PERF_DETAIL_WIZARD,
  375. PERF_COUNTER_BULK_COUNT,
  376. sizeof(((PP5_COUNTER_DATA)0)->llIo_rw_cycle),
  377. (DWORD)&((PP5_COUNTER_DATA)0)->llIo_rw_cycle
  378. },
  379. {
  380. sizeof(PERF_COUNTER_DEFINITION),
  381. NON_CACHED_MEMORY_REF,
  382. 0,
  383. NON_CACHED_MEMORY_REF,
  384. 0,
  385. -4,
  386. PERF_DETAIL_WIZARD,
  387. PERF_COUNTER_BULK_COUNT,
  388. sizeof(((PP5_COUNTER_DATA)0)->llNon_cached_memory_ref),
  389. (DWORD)&((PP5_COUNTER_DATA)0)->llNon_cached_memory_ref
  390. },
  391. {
  392. sizeof(PERF_COUNTER_DEFINITION),
  393. PIPE_STALLED_ON_ADDR_GEN,
  394. 0,
  395. PIPE_STALLED_ON_ADDR_GEN,
  396. 0,
  397. -3,
  398. PERF_DETAIL_WIZARD,
  399. PERF_COUNTER_BULK_COUNT,
  400. sizeof(((PP5_COUNTER_DATA)0)->llPipe_stalled_on_addr_gen),
  401. (DWORD)&((PP5_COUNTER_DATA)0)->llPipe_stalled_on_addr_gen
  402. },
  403. {
  404. sizeof(PERF_COUNTER_DEFINITION),
  405. FLOPS,
  406. 0,
  407. FLOPS,
  408. 0,
  409. -3,
  410. PERF_DETAIL_WIZARD,
  411. PERF_COUNTER_BULK_COUNT,
  412. sizeof(((PP5_COUNTER_DATA)0)->llFlops),
  413. (DWORD)&((PP5_COUNTER_DATA)0)->llFlops
  414. },
  415. {
  416. sizeof(PERF_COUNTER_DEFINITION),
  417. DR0,
  418. 0,
  419. DR0,
  420. 0,
  421. -2,
  422. PERF_DETAIL_WIZARD,
  423. PERF_COUNTER_BULK_COUNT,
  424. sizeof(((PP5_COUNTER_DATA)0)->llDebugRegister0),
  425. (DWORD)&((PP5_COUNTER_DATA)0)->llDebugRegister0
  426. },
  427. {
  428. sizeof(PERF_COUNTER_DEFINITION),
  429. DR1,
  430. 0,
  431. DR1,
  432. 0,
  433. -2,
  434. PERF_DETAIL_WIZARD,
  435. PERF_COUNTER_BULK_COUNT,
  436. sizeof(((PP5_COUNTER_DATA)0)->llDebugRegister1),
  437. (DWORD)&((PP5_COUNTER_DATA)0)->llDebugRegister1
  438. },
  439. {
  440. sizeof(PERF_COUNTER_DEFINITION),
  441. DR2,
  442. 0,
  443. DR2,
  444. 0,
  445. -2,
  446. PERF_DETAIL_WIZARD,
  447. PERF_COUNTER_BULK_COUNT,
  448. sizeof(((PP5_COUNTER_DATA)0)->llDebugRegister2),
  449. (DWORD)&((PP5_COUNTER_DATA)0)->llDebugRegister2
  450. },
  451. {
  452. sizeof(PERF_COUNTER_DEFINITION),
  453. DR3,
  454. 0,
  455. DR3,
  456. 0,
  457. -2,
  458. PERF_DETAIL_WIZARD,
  459. PERF_COUNTER_BULK_COUNT,
  460. sizeof(((PP5_COUNTER_DATA)0)->llDebugRegister3),
  461. (DWORD)&((PP5_COUNTER_DATA)0)->llDebugRegister3
  462. },
  463. {
  464. sizeof(PERF_COUNTER_DEFINITION),
  465. INTERRUPTS,
  466. 0,
  467. INTERRUPTS,
  468. 0,
  469. -1,
  470. PERF_DETAIL_WIZARD,
  471. PERF_COUNTER_BULK_COUNT,
  472. sizeof(((PP5_COUNTER_DATA)0)->llInterrupts),
  473. (DWORD)&((PP5_COUNTER_DATA)0)->llInterrupts
  474. },
  475. {
  476. sizeof(PERF_COUNTER_DEFINITION),
  477. DATA_RW,
  478. 0,
  479. DATA_RW,
  480. 0,
  481. -4,
  482. PERF_DETAIL_WIZARD,
  483. PERF_COUNTER_BULK_COUNT,
  484. sizeof(((PP5_COUNTER_DATA)0)->llData_rw),
  485. (DWORD)&((PP5_COUNTER_DATA)0)->llData_rw
  486. },
  487. {
  488. sizeof(PERF_COUNTER_DEFINITION),
  489. DATA_RW_MISS,
  490. 0,
  491. DATA_RW_MISS,
  492. 0,
  493. -3,
  494. PERF_DETAIL_WIZARD,
  495. PERF_COUNTER_BULK_COUNT,
  496. sizeof(((PP5_COUNTER_DATA)0)->llData_rw_miss),
  497. (DWORD)&((PP5_COUNTER_DATA)0)->llData_rw_miss
  498. },
  499. {
  500. sizeof(PERF_COUNTER_DEFINITION),
  501. PCT_DATA_READ_MISS,
  502. 0,
  503. PCT_DATA_READ_MISS,
  504. 0,
  505. 0,
  506. PERF_DETAIL_WIZARD,
  507. PERF_SAMPLE_FRACTION,
  508. sizeof(((PP5_COUNTER_DATA)0)->dwPctDataReadMiss),
  509. (DWORD)&((PP5_COUNTER_DATA)0)->dwPctDataReadMiss
  510. },
  511. {
  512. sizeof(PERF_COUNTER_DEFINITION),
  513. PCT_DATA_READ_MISS,
  514. 0,
  515. PCT_DATA_READ_MISS,
  516. 0,
  517. 0,
  518. PERF_DETAIL_WIZARD,
  519. PERF_SAMPLE_BASE,
  520. sizeof(((PP5_COUNTER_DATA)0)->dwPctDataReadBase),
  521. (DWORD)&((PP5_COUNTER_DATA)0)->dwPctDataReadBase
  522. },
  523. {
  524. sizeof(PERF_COUNTER_DEFINITION),
  525. PCT_DATA_WRITE_MISS,
  526. 0,
  527. PCT_DATA_WRITE_MISS,
  528. 0,
  529. 0,
  530. PERF_DETAIL_WIZARD,
  531. PERF_SAMPLE_FRACTION,
  532. sizeof(((PP5_COUNTER_DATA)0)->dwPctDataWriteMiss),
  533. (DWORD)&((PP5_COUNTER_DATA)0)->dwPctDataWriteMiss
  534. },
  535. {
  536. sizeof(PERF_COUNTER_DEFINITION),
  537. PCT_DATA_WRITE_MISS,
  538. 0,
  539. PCT_DATA_WRITE_MISS,
  540. 0,
  541. 0,
  542. PERF_DETAIL_WIZARD,
  543. PERF_SAMPLE_BASE,
  544. sizeof(((PP5_COUNTER_DATA)0)->dwPctDataWriteBase),
  545. (DWORD)&((PP5_COUNTER_DATA)0)->dwPctDataWriteBase
  546. },
  547. {
  548. sizeof(PERF_COUNTER_DEFINITION),
  549. PCT_DATA_RW_MISS,
  550. 0,
  551. PCT_DATA_RW_MISS,
  552. 0,
  553. 0,
  554. PERF_DETAIL_WIZARD,
  555. PERF_SAMPLE_FRACTION,
  556. sizeof(((PP5_COUNTER_DATA)0)->dwPctDataRWMiss),
  557. (DWORD)&((PP5_COUNTER_DATA)0)->dwPctDataRWMiss
  558. },
  559. {
  560. sizeof(PERF_COUNTER_DEFINITION),
  561. PCT_DATA_RW_MISS,
  562. 0,
  563. PCT_DATA_RW_MISS,
  564. 0,
  565. 0,
  566. PERF_DETAIL_WIZARD,
  567. PERF_SAMPLE_BASE,
  568. sizeof(((PP5_COUNTER_DATA)0)->dwPctDataRWBase),
  569. (DWORD)&((PP5_COUNTER_DATA)0)->dwPctDataRWBase
  570. },
  571. {
  572. sizeof(PERF_COUNTER_DEFINITION),
  573. PCT_DATA_TLB_MISS,
  574. 0,
  575. PCT_DATA_TLB_MISS,
  576. 0,
  577. 0,
  578. PERF_DETAIL_WIZARD,
  579. PERF_SAMPLE_FRACTION,
  580. sizeof(((PP5_COUNTER_DATA)0)->dwPctDataTLBMiss),
  581. (DWORD)&((PP5_COUNTER_DATA)0)->dwPctDataTLBMiss
  582. },
  583. {
  584. sizeof(PERF_COUNTER_DEFINITION),
  585. PCT_DATA_TLB_MISS,
  586. 0,
  587. PCT_DATA_TLB_MISS,
  588. 0,
  589. 0,
  590. PERF_DETAIL_WIZARD,
  591. PERF_SAMPLE_BASE,
  592. sizeof(((PP5_COUNTER_DATA)0)->dwPctDataTLBBase),
  593. (DWORD)&((PP5_COUNTER_DATA)0)->dwPctDataTLBBase
  594. },
  595. {
  596. sizeof(PERF_COUNTER_DEFINITION),
  597. PCT_DATA_SNOOP_HITS,
  598. 0,
  599. PCT_DATA_SNOOP_HITS,
  600. 0,
  601. 0,
  602. PERF_DETAIL_WIZARD,
  603. PERF_SAMPLE_FRACTION,
  604. sizeof(((PP5_COUNTER_DATA)0)->dwPctDataSnoopHits),
  605. (DWORD)&((PP5_COUNTER_DATA)0)->dwPctDataSnoopHits
  606. },
  607. {
  608. sizeof(PERF_COUNTER_DEFINITION),
  609. PCT_DATA_SNOOP_HITS,
  610. 0,
  611. PCT_DATA_SNOOP_HITS,
  612. 0,
  613. 0,
  614. PERF_DETAIL_WIZARD,
  615. PERF_SAMPLE_BASE,
  616. sizeof(((PP5_COUNTER_DATA)0)->dwPctDataSnoopBase),
  617. (DWORD)&((PP5_COUNTER_DATA)0)->dwPctDataSnoopBase
  618. },
  619. {
  620. sizeof(PERF_COUNTER_DEFINITION),
  621. PCT_CODE_READ_MISS,
  622. 0,
  623. PCT_CODE_READ_MISS,
  624. 0,
  625. 0,
  626. PERF_DETAIL_WIZARD,
  627. PERF_SAMPLE_FRACTION,
  628. sizeof(((PP5_COUNTER_DATA)0)->dwPctCodeReadMiss),
  629. (DWORD)&((PP5_COUNTER_DATA)0)->dwPctCodeReadMiss
  630. },
  631. {
  632. sizeof(PERF_COUNTER_DEFINITION),
  633. PCT_CODE_READ_MISS,
  634. 0,
  635. PCT_CODE_READ_MISS,
  636. 0,
  637. 0,
  638. PERF_DETAIL_WIZARD,
  639. PERF_SAMPLE_BASE,
  640. sizeof(((PP5_COUNTER_DATA)0)->dwPctCodeReadBase),
  641. (DWORD)&((PP5_COUNTER_DATA)0)->dwPctCodeReadBase
  642. },
  643. {
  644. sizeof(PERF_COUNTER_DEFINITION),
  645. PCT_CODE_TLB_MISS,
  646. 0,
  647. PCT_CODE_TLB_MISS,
  648. 0,
  649. 0,
  650. PERF_DETAIL_WIZARD,
  651. PERF_SAMPLE_FRACTION,
  652. sizeof(((PP5_COUNTER_DATA)0)->dwPctCodeTLBMiss),
  653. (DWORD)&((PP5_COUNTER_DATA)0)->dwPctCodeTLBMiss
  654. },
  655. {
  656. sizeof(PERF_COUNTER_DEFINITION),
  657. PCT_CODE_TLB_MISS,
  658. 0,
  659. PCT_CODE_TLB_MISS,
  660. 0,
  661. 0,
  662. PERF_DETAIL_WIZARD,
  663. PERF_SAMPLE_BASE,
  664. sizeof(((PP5_COUNTER_DATA)0)->dwPctCodeTLBMiss),
  665. (DWORD)&((PP5_COUNTER_DATA)0)->dwPctCodeTLBMiss
  666. },
  667. {
  668. sizeof(PERF_COUNTER_DEFINITION),
  669. PCT_BTB_HITS,
  670. 0,
  671. PCT_BTB_HITS,
  672. 0,
  673. 0,
  674. PERF_DETAIL_WIZARD,
  675. PERF_SAMPLE_FRACTION,
  676. sizeof(((PP5_COUNTER_DATA)0)->dwPctBTBHits),
  677. (DWORD)&((PP5_COUNTER_DATA)0)->dwPctBTBHits
  678. },
  679. {
  680. sizeof(PERF_COUNTER_DEFINITION),
  681. PCT_BTB_HITS,
  682. 0,
  683. PCT_BTB_HITS,
  684. 0,
  685. 0,
  686. PERF_DETAIL_WIZARD,
  687. PERF_SAMPLE_BASE,
  688. sizeof(((PP5_COUNTER_DATA)0)->dwPctBTBBase),
  689. (DWORD)&((PP5_COUNTER_DATA)0)->dwPctBTBBase
  690. },
  691. {
  692. sizeof(PERF_COUNTER_DEFINITION),
  693. PCT_VPIPE_INST,
  694. 0,
  695. PCT_VPIPE_INST,
  696. 0,
  697. 0,
  698. PERF_DETAIL_WIZARD,
  699. PERF_SAMPLE_FRACTION,
  700. sizeof(((PP5_COUNTER_DATA)0)->dwPctVpipeInst),
  701. (DWORD)&((PP5_COUNTER_DATA)0)->dwPctVpipeInst
  702. },
  703. {
  704. sizeof(PERF_COUNTER_DEFINITION),
  705. PCT_VPIPE_INST,
  706. 0,
  707. PCT_VPIPE_INST,
  708. 0,
  709. 0,
  710. PERF_DETAIL_WIZARD,
  711. PERF_SAMPLE_BASE,
  712. sizeof(((PP5_COUNTER_DATA)0)->dwPctVpipeBase),
  713. (DWORD)&((PP5_COUNTER_DATA)0)->dwPctVpipeBase
  714. },
  715. {
  716. sizeof(PERF_COUNTER_DEFINITION),
  717. PCT_BRANCHES,
  718. 0,
  719. PCT_BRANCHES,
  720. 0,
  721. 0,
  722. PERF_DETAIL_WIZARD,
  723. PERF_SAMPLE_FRACTION,
  724. sizeof(((PP5_COUNTER_DATA)0)->dwPctBranches),
  725. (DWORD)&((PP5_COUNTER_DATA)0)->dwPctBranches
  726. },
  727. {
  728. sizeof(PERF_COUNTER_DEFINITION),
  729. PCT_BRANCHES,
  730. 0,
  731. PCT_BRANCHES,
  732. 0,
  733. 0,
  734. PERF_DETAIL_WIZARD,
  735. PERF_SAMPLE_BASE,
  736. sizeof(((PP5_COUNTER_DATA)0)->dwPctBranchesBase),
  737. (DWORD)&((PP5_COUNTER_DATA)0)->dwPctBranchesBase
  738. }
  739. };
  740. //
  741. // initialize the event Id to direct counter data field
  742. // the index of the element in the array is the event Id of the
  743. // data and the value of the array element is the offset to the
  744. // LONGLONG data location from the start of the counter data
  745. //
  746. DWORD P5IndexToData[] = {
  747. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llData_read),
  748. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llData_write),
  749. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llData_tlb_miss),
  750. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llData_read_miss),
  751. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llData_write_miss),
  752. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llWrite_hit_to_me_line),
  753. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llData_cache_line_wb),
  754. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llData_cache_snoops),
  755. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llData_cache_snoop_hits),
  756. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llMemory_accesses_in_pipes),
  757. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llBank_conflicts),
  758. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llMisaligned_data_ref),
  759. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llCode_read),
  760. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llCode_tlb_miss),
  761. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llCode_cache_miss),
  762. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llSegment_loads),
  763. PENT_INDEX_NOT_USED,
  764. PENT_INDEX_NOT_USED,
  765. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llBranches),
  766. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llBtb_hits),
  767. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llTaken_branch_or_btb_hits),
  768. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llPipeline_flushes),
  769. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llInstructions_executed),
  770. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llInstructions_executed_in_vpipe),
  771. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llBus_utilization),
  772. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llPipe_stalled_on_writes),
  773. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llPipe_stalled_on_read),
  774. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llStalled_while_ewbe),
  775. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llLocked_bus_cycle),
  776. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llIo_rw_cycle),
  777. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llNon_cached_memory_ref),
  778. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llPipe_stalled_on_addr_gen),
  779. PENT_INDEX_NOT_USED,
  780. PENT_INDEX_NOT_USED,
  781. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llFlops),
  782. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llDebugRegister0),
  783. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llDebugRegister1),
  784. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llDebugRegister2),
  785. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llDebugRegister3),
  786. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llInterrupts),
  787. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llData_rw),
  788. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->llData_rw_miss)
  789. };
  790. // define the limit value
  791. DWORD P5IndexMax = sizeof(P5IndexToData) / sizeof (P5IndexToData[0]);
  792. //
  793. // load the table of direct counters used by derived counters. As in the above
  794. // table, the index of the array is the Event Id and the value of the array element
  795. // indicates that the counter is used in a derived counter.
  796. //
  797. BOOL dwDerivedp5Counters[] = {
  798. TRUE, // 0x00
  799. TRUE, // 0x01
  800. TRUE, // 0x02
  801. TRUE, // 0x03
  802. TRUE, // 0x04
  803. FALSE, // 0x05
  804. FALSE, // 0x06
  805. TRUE, // 0x07
  806. TRUE, // 0x08
  807. FALSE, // 0x09
  808. FALSE, // 0x0a
  809. FALSE, // 0x0b
  810. TRUE, // 0x0c
  811. TRUE, // 0x0d
  812. TRUE, // 0x0e
  813. FALSE, // 0x0f
  814. FALSE, // 0x10
  815. FALSE, // 0x11
  816. TRUE, // 0x12
  817. TRUE, // 0x13
  818. FALSE, // 0x14
  819. FALSE, // 0x15
  820. TRUE, // 0x16
  821. TRUE, // 0x17
  822. FALSE, // 0x18
  823. FALSE, // 0x19
  824. FALSE, // 0x1a
  825. FALSE, // 0x1b
  826. FALSE, // 0x1c
  827. FALSE, // 0x1d
  828. FALSE, // 0x1e
  829. FALSE, // 0x1f
  830. FALSE, // 0x20
  831. FALSE, // 0x21
  832. FALSE, // 0x22
  833. FALSE, // 0x23
  834. FALSE, // 0x24
  835. FALSE, // 0x25
  836. FALSE, // 0x26
  837. FALSE, // 0x27
  838. TRUE, // 0x28
  839. TRUE // 0x29
  840. };
  841. //
  842. // this table maps the direct counter event Id's to the derived counters
  843. // that use the data. Both event ID's must match for the data to be stored.
  844. //
  845. DERIVED_P5_COUNTER_DEF P5DerivedCounters[] = {
  846. {0x00, 0x03,
  847. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctDataReadBase),
  848. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctDataReadMiss)},
  849. {0x01, 0x04,
  850. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctDataWriteBase),
  851. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctDataWriteMiss)},
  852. {0x02, 0x28,
  853. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctDataTLBMiss),
  854. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctDataTLBBase)},
  855. {0x03, 0x00,
  856. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctDataReadMiss),
  857. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctDataReadBase)},
  858. {0x04, 0x01,
  859. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctDataWriteMiss),
  860. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctDataWriteBase)},
  861. {0x07, 0x08,
  862. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctDataSnoopBase),
  863. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctDataSnoopHits)},
  864. {0x08, 0x07,
  865. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctDataSnoopHits),
  866. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctDataSnoopBase)},
  867. {0x0c, 0x0d,
  868. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctCodeTLBBase),
  869. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctCodeTLBMiss)},
  870. {0x0c, 0x0e,
  871. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctCodeReadBase),
  872. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctCodeReadMiss)},
  873. {0x0d, 0x0c,
  874. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctCodeTLBMiss),
  875. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctCodeTLBBase)},
  876. {0x0e, 0x0c,
  877. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctCodeReadMiss),
  878. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctCodeReadBase)},
  879. {0x12, 0x13,
  880. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctBTBBase),
  881. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctBTBHits)},
  882. {0x12, 0x16,
  883. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctBranches),
  884. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctBranchesBase)},
  885. {0x13, 0x12,
  886. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctBTBHits),
  887. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctBTBBase)},
  888. {0x16, 0x12,
  889. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctBranchesBase),
  890. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctBranches)},
  891. {0x16, 0x17,
  892. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctVpipeBase),
  893. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctVpipeInst)},
  894. {0x17, 0x16,
  895. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctVpipeInst),
  896. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctVpipeBase)},
  897. {0x28, 0x02,
  898. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctDataTLBBase),
  899. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctDataTLBMiss)},
  900. {0x28, 0x29,
  901. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctDataRWBase),
  902. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctDataRWMiss)},
  903. {0x29, 0x28,
  904. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctDataRWMiss),
  905. (DWORD)((LPBYTE)&((PP5_COUNTER_DATA)0)->dwPctDataRWBase)}
  906. };
  907. //
  908. // define the number of derived counter entries
  909. //
  910. DWORD dwP5DerivedCountersCount = sizeof (P5DerivedCounters) /
  911. sizeof (P5DerivedCounters[0]);