1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513
|
/**
* D header file for perf_event_open system call.
*
* Converted from linux userspace header, comments included.
*
* Authors: Max Haughton
*/
module core.sys.linux.perf_event;
version (linux) : extern (C):
@nogc:
nothrow:
@system:
import core.sys.posix.sys.ioctl;
import core.sys.posix.unistd;
version (HPPA) version = HPPA_Any;
version (HPPA64) version = HPPA_Any;
version (PPC) version = PPC_Any;
version (PPC64) version = PPC_Any;
version (RISCV32) version = RISCV_Any;
version (RISCV64) version = RISCV_Any;
version (S390) version = IBMZ_Any;
version (SPARC) version = SPARC_Any;
version (SPARC64) version = SPARC_Any;
version (SystemZ) version = IBMZ_Any;
version (X86_64)
{
version (D_X32)
enum __NR_perf_event_open = 0x40000000 + 298;
else
enum __NR_perf_event_open = 298;
}
else version (X86)
{
enum __NR_perf_event_open = 336;
}
else version (ARM)
{
enum __NR_perf_event_open = 364;
}
else version (AArch64)
{
enum __NR_perf_event_open = 241;
}
else version (HPPA_Any)
{
enum __NR_perf_event_open = 318;
}
else version (IBMZ_Any)
{
enum __NR_perf_event_open = 331;
}
else version (MIPS32)
{
enum __NR_perf_event_open = 4333;
}
else version (MIPS64)
{
version (MIPS_N32)
enum __NR_perf_event_open = 6296;
else version (MIPS_N64)
enum __NR_perf_event_open = 5292;
else
static assert(0, "Architecture not supported");
}
else version (PPC_Any)
{
enum __NR_perf_event_open = 319;
}
else version (RISCV_Any)
{
enum __NR_perf_event_open = 241;
}
else version (SPARC_Any)
{
enum __NR_perf_event_open = 327;
}
else
{
static assert(0, "Architecture not supported");
}
extern (C) extern long syscall(long __sysno, ...);
static long perf_event_open(perf_event_attr* hw_event, pid_t pid, int cpu, int group_fd, ulong flags)
{
return syscall(__NR_perf_event_open, hw_event, pid, cpu, group_fd, flags);
}
/*
* User-space ABI bits:
*/
/**
* attr.type
*/
enum perf_type_id
{
PERF_TYPE_HARDWARE = 0,
PERF_TYPE_SOFTWARE = 1,
PERF_TYPE_TRACEPOINT = 2,
PERF_TYPE_HW_CACHE = 3,
PERF_TYPE_RAW = 4,
PERF_TYPE_BREAKPOINT = 5,
PERF_TYPE_MAX = 6 /* non-ABI */
}
/**
* Generalized performance event event_id types, used by the
* attr.event_id parameter of the sys_perf_event_open()
* syscall:
*/
enum perf_hw_id
{
///
PERF_COUNT_HW_CPU_CYCLES = 0,
///
PERF_COUNT_HW_INSTRUCTIONS = 1,
///
PERF_COUNT_HW_CACHE_REFERENCES = 2,
///
PERF_COUNT_HW_CACHE_MISSES = 3,
///
PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4,
///
PERF_COUNT_HW_BRANCH_MISSES = 5,
///
PERF_COUNT_HW_BUS_CYCLES = 6,
///
PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 7,
///
PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 8,
///
PERF_COUNT_HW_REF_CPU_CYCLES = 9,
///
PERF_COUNT_HW_MAX = 10 /* non-ABI */
}
/**
* Generalized hardware cache events:
*
* { L1-D, L1-I, LLC, ITLB, DTLB, BPU, NODE } x
* { read, write, prefetch } x
* { accesses, misses }
*/
enum perf_hw_cache_id
{
///
PERF_COUNT_HW_CACHE_L1D = 0,
///
PERF_COUNT_HW_CACHE_L1I = 1,
///
PERF_COUNT_HW_CACHE_LL = 2,
///
PERF_COUNT_HW_CACHE_DTLB = 3,
///
PERF_COUNT_HW_CACHE_ITLB = 4,
///
PERF_COUNT_HW_CACHE_BPU = 5,
///
PERF_COUNT_HW_CACHE_NODE = 6,
///
PERF_COUNT_HW_CACHE_MAX = 7 /* non-ABI */
}
///
enum perf_hw_cache_op_id
{
///
PERF_COUNT_HW_CACHE_OP_READ = 0,
///
PERF_COUNT_HW_CACHE_OP_WRITE = 1,
///
PERF_COUNT_HW_CACHE_OP_PREFETCH = 2,
///
PERF_COUNT_HW_CACHE_OP_MAX = 3 /* non-ABI */
}
///
enum perf_hw_cache_op_result_id
{
///
PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0,
///
PERF_COUNT_HW_CACHE_RESULT_MISS = 1,
///
PERF_COUNT_HW_CACHE_RESULT_MAX = 2 /* non-ABI */
}
/**
* Special "software" events provided by the kernel, even if the hardware
* does not support performance events. These events measure various
* physical and sw events of the kernel (and allow the profiling of them as
* well):
*/
enum perf_sw_ids
{
///
PERF_COUNT_SW_CPU_CLOCK = 0,
///
PERF_COUNT_SW_TASK_CLOCK = 1,
///
PERF_COUNT_SW_PAGE_FAULTS = 2,
///
PERF_COUNT_SW_CONTEXT_SWITCHES = 3,
///
PERF_COUNT_SW_CPU_MIGRATIONS = 4,
///
PERF_COUNT_SW_PAGE_FAULTS_MIN = 5,
///
PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6,
///
PERF_COUNT_SW_ALIGNMENT_FAULTS = 7,
///
PERF_COUNT_SW_EMULATION_FAULTS = 8,
///
PERF_COUNT_SW_DUMMY = 9,
///
PERF_COUNT_SW_BPF_OUTPUT = 10,
///
PERF_COUNT_SW_MAX = 11 /* non-ABI */
}
/**
* Bits that can be set in attr.sample_type to request information
* in the overflow packets.
*/
enum perf_event_sample_format
{
///
PERF_SAMPLE_IP = 1U << 0,
///
PERF_SAMPLE_TID = 1U << 1,
///
PERF_SAMPLE_TIME = 1U << 2,
///
PERF_SAMPLE_ADDR = 1U << 3,
///
PERF_SAMPLE_READ = 1U << 4,
///
PERF_SAMPLE_CALLCHAIN = 1U << 5,
///
PERF_SAMPLE_ID = 1U << 6,
///
PERF_SAMPLE_CPU = 1U << 7,
///
PERF_SAMPLE_PERIOD = 1U << 8,
///
PERF_SAMPLE_STREAM_ID = 1U << 9,
///
PERF_SAMPLE_RAW = 1U << 10,
///
PERF_SAMPLE_BRANCH_STACK = 1U << 11,
///
PERF_SAMPLE_REGS_USER = 1U << 12,
///
PERF_SAMPLE_STACK_USER = 1U << 13,
///
PERF_SAMPLE_WEIGHT = 1U << 14,
///
PERF_SAMPLE_DATA_SRC = 1U << 15,
///
PERF_SAMPLE_IDENTIFIER = 1U << 16,
///
PERF_SAMPLE_TRANSACTION = 1U << 17,
///
PERF_SAMPLE_REGS_INTR = 1U << 18,
///
PERF_SAMPLE_PHYS_ADDR = 1U << 19,
///
PERF_SAMPLE_MAX = 1U << 20 /* non-ABI */
}
/**
* values to program into branch_sample_type when PERF_SAMPLE_BRANCH is set
*
* If the user does not pass priv level information via branch_sample_type,
* the kernel uses the event's priv level. Branch and event priv levels do
* not have to match. Branch priv level is checked for permissions.
*
* The branch types can be combined, however BRANCH_ANY covers all types
* of branches and therefore it supersedes all the other types.
*/
enum perf_branch_sample_type_shift
{
PERF_SAMPLE_BRANCH_USER_SHIFT = 0, /** user branches */
PERF_SAMPLE_BRANCH_KERNEL_SHIFT = 1, /** kernel branches */
PERF_SAMPLE_BRANCH_HV_SHIFT = 2, /** hypervisor branches */
PERF_SAMPLE_BRANCH_ANY_SHIFT = 3, /** any branch types */
PERF_SAMPLE_BRANCH_ANY_CALL_SHIFT = 4, /** any call branch */
PERF_SAMPLE_BRANCH_ANY_RETURN_SHIFT = 5, /** any return branch */
PERF_SAMPLE_BRANCH_IND_CALL_SHIFT = 6, /** indirect calls */
PERF_SAMPLE_BRANCH_ABORT_TX_SHIFT = 7, /** transaction aborts */
PERF_SAMPLE_BRANCH_IN_TX_SHIFT = 8, /** in transaction */
PERF_SAMPLE_BRANCH_NO_TX_SHIFT = 9, /** not in transaction */
PERF_SAMPLE_BRANCH_COND_SHIFT = 10, /** conditional branches */
PERF_SAMPLE_BRANCH_CALL_STACK_SHIFT = 11, /** call/ret stack */
PERF_SAMPLE_BRANCH_IND_JUMP_SHIFT = 12, /** indirect jumps */
PERF_SAMPLE_BRANCH_CALL_SHIFT = 13, /** direct call */
PERF_SAMPLE_BRANCH_NO_FLAGS_SHIFT = 14, /** no flags */
PERF_SAMPLE_BRANCH_NO_CYCLES_SHIFT = 15, /** no cycles */
PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT = 16, /** save branch type */
PERF_SAMPLE_BRANCH_MAX_SHIFT = 17 /** non-ABI */
}
///
enum perf_branch_sample_type
{
PERF_SAMPLE_BRANCH_USER = 1U << perf_branch_sample_type_shift.PERF_SAMPLE_BRANCH_USER_SHIFT,
PERF_SAMPLE_BRANCH_KERNEL = 1U << perf_branch_sample_type_shift.PERF_SAMPLE_BRANCH_KERNEL_SHIFT,
PERF_SAMPLE_BRANCH_HV = 1U << perf_branch_sample_type_shift.PERF_SAMPLE_BRANCH_HV_SHIFT,
PERF_SAMPLE_BRANCH_ANY = 1U << perf_branch_sample_type_shift.PERF_SAMPLE_BRANCH_ANY_SHIFT,
PERF_SAMPLE_BRANCH_ANY_CALL = 1U << perf_branch_sample_type_shift.PERF_SAMPLE_BRANCH_ANY_CALL_SHIFT,
PERF_SAMPLE_BRANCH_ANY_RETURN = 1U << perf_branch_sample_type_shift.PERF_SAMPLE_BRANCH_ANY_RETURN_SHIFT,
PERF_SAMPLE_BRANCH_IND_CALL = 1U << perf_branch_sample_type_shift.PERF_SAMPLE_BRANCH_IND_CALL_SHIFT,
PERF_SAMPLE_BRANCH_ABORT_TX = 1U << perf_branch_sample_type_shift.PERF_SAMPLE_BRANCH_ABORT_TX_SHIFT,
PERF_SAMPLE_BRANCH_IN_TX = 1U << perf_branch_sample_type_shift.PERF_SAMPLE_BRANCH_IN_TX_SHIFT,
PERF_SAMPLE_BRANCH_NO_TX = 1U << perf_branch_sample_type_shift.PERF_SAMPLE_BRANCH_NO_TX_SHIFT,
PERF_SAMPLE_BRANCH_COND = 1U << perf_branch_sample_type_shift.PERF_SAMPLE_BRANCH_COND_SHIFT,
PERF_SAMPLE_BRANCH_CALL_STACK = 1U << perf_branch_sample_type_shift.PERF_SAMPLE_BRANCH_CALL_STACK_SHIFT,
PERF_SAMPLE_BRANCH_IND_JUMP = 1U << perf_branch_sample_type_shift.PERF_SAMPLE_BRANCH_IND_JUMP_SHIFT,
PERF_SAMPLE_BRANCH_CALL = 1U << perf_branch_sample_type_shift.PERF_SAMPLE_BRANCH_CALL_SHIFT,
PERF_SAMPLE_BRANCH_NO_FLAGS = 1U << perf_branch_sample_type_shift.PERF_SAMPLE_BRANCH_NO_FLAGS_SHIFT,
PERF_SAMPLE_BRANCH_NO_CYCLES = 1U << perf_branch_sample_type_shift.PERF_SAMPLE_BRANCH_NO_CYCLES_SHIFT,
PERF_SAMPLE_BRANCH_TYPE_SAVE = 1U << perf_branch_sample_type_shift.PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT,
PERF_SAMPLE_BRANCH_MAX = 1U << perf_branch_sample_type_shift.PERF_SAMPLE_BRANCH_MAX_SHIFT
}
/**
* Common flow change classification
*/
enum
{
PERF_BR_UNKNOWN = 0, /** unknown */
PERF_BR_COND = 1, /** conditional */
PERF_BR_UNCOND = 2, /** unconditional */
PERF_BR_IND = 3, /** indirect */
PERF_BR_CALL = 4, /** function call */
PERF_BR_IND_CALL = 5, /** indirect function call */
PERF_BR_RET = 6, /** function return */
PERF_BR_SYSCALL = 7, /** syscall */
PERF_BR_SYSRET = 8, /** syscall return */
PERF_BR_COND_CALL = 9, /** conditional function call */
PERF_BR_COND_RET = 10, /** conditional function return */
PERF_BR_MAX = 11
}
///
enum PERF_SAMPLE_BRANCH_PLM_ALL = perf_branch_sample_type.PERF_SAMPLE_BRANCH_USER
| perf_branch_sample_type.PERF_SAMPLE_BRANCH_KERNEL
| perf_branch_sample_type.PERF_SAMPLE_BRANCH_HV;
/**
* Values to determine ABI of the registers dump.
*/
enum perf_sample_regs_abi
{
///
PERF_SAMPLE_REGS_ABI_NONE = 0,
///
PERF_SAMPLE_REGS_ABI_32 = 1,
///
PERF_SAMPLE_REGS_ABI_64 = 2
}
/**
* Values for the memory transaction event qualifier, mostly for
* abort events. Multiple bits can be set.
*/
enum
{
PERF_TXN_ELISION = 1 << 0, /** From elision */
PERF_TXN_TRANSACTION = 1 << 1, /** From transaction */
PERF_TXN_SYNC = 1 << 2, /** Instruction is related */
PERF_TXN_ASYNC = 1 << 3, /** Instruction not related */
PERF_TXN_RETRY = 1 << 4, /** Retry possible */
PERF_TXN_CONFLICT = 1 << 5, /** Conflict abort */
PERF_TXN_CAPACITY_WRITE = 1 << 6, /** Capacity write abort */
PERF_TXN_CAPACITY_READ = 1 << 7, /** Capacity read abort */
PERF_TXN_MAX = 1 << 8, /** non-ABI */
/** bits 32..63 are reserved for the abort code */
///PERF_TXN_ABORT_MASK = 0xffffffff << 32,
PERF_TXN_ABORT_SHIFT = 32
}
/**
* The format of the data returned by read() on a perf event fd,
* as specified by attr.read_format:
* ---
* struct read_format {
* { u64 value;
* { u64 time_enabled; } && PERF_FORMAT_TOTAL_TIME_ENABLED
* { u64 time_running; } && PERF_FORMAT_TOTAL_TIME_RUNNING
* { u64 id; } && PERF_FORMAT_ID
* } && !PERF_FORMAT_GROUP
*
* { u64 nr;
* { u64 time_enabled; } && PERF_FORMAT_TOTAL_TIME_ENABLED
* { u64 time_running; } && PERF_FORMAT_TOTAL_TIME_RUNNING
* { u64 value;
* { u64 id; } && PERF_FORMAT_ID
* } cntr[nr];
* } && PERF_FORMAT_GROUP
* };
* ---
*/
enum perf_event_read_format
{
///
PERF_FORMAT_TOTAL_TIME_ENABLED = 1U << 0,
///
PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1,
///
PERF_FORMAT_ID = 1U << 2,
///
PERF_FORMAT_GROUP = 1U << 3,
PERF_FORMAT_MAX = 1U << 4 /** non-ABI */
}
enum PERF_ATTR_SIZE_VER0 = 64; /** sizeof first published struct */
enum PERF_ATTR_SIZE_VER1 = 72; /** add: config2 */
enum PERF_ATTR_SIZE_VER2 = 80; /** add: branch_sample_type */
enum PERF_ATTR_SIZE_VER3 = 96; /** add: sample_regs_user */
/* add: sample_stack_user */
enum PERF_ATTR_SIZE_VER4 = 104; /** add: sample_regs_intr */
enum PERF_ATTR_SIZE_VER5 = 112; /** add: aux_watermark */
/**
* Hardware event_id to monitor via a performance monitoring event:
*
* @sample_max_stack: Max number of frame pointers in a callchain,
* should be < /proc/sys/kernel/perf_event_max_stack
*/
struct perf_event_attr
{
/**
*Major type: hardware/software/tracepoint/etc.
*/
uint type;
/**
* Size of the attr structure, for fwd/bwd compat.
*/
uint size;
/**
* Type specific configuration information.
*/
ulong config;
///
union
{
///
ulong sample_period;
///
ulong sample_freq;
}
///
ulong sample_type;
///
ulong read_format;
// mixin(bitfields!(
// ulong, "disabled", 1,
// ulong, "inherit", 1,
// ulong, "pinned", 1,
// ulong, "exclusive", 1,
// ulong, "exclude_user", 1,
// ulong, "exclude_kernel", 1,
// ulong, "exclude_hv", 1,
// ulong, "exclude_idle", 1,
// ulong, "mmap", 1,
// ulong, "comm", 1,
// ulong, "freq", 1,
// ulong, "inherit_stat", 1,
// ulong, "enable_on_exec", 1,
// ulong, "task", 1,
// ulong, "watermark", 1,
// ulong, "precise_ip", 2,
// ulong, "mmap_data", 1,
// ulong, "sample_id_all", 1,
// ulong, "exclude_host", 1,
// ulong, "exclude_guest", 1,
// ulong, "exclude_callchain_kernel", 1,
// ulong, "exclude_callchain_user", 1,
// ulong, "mmap2", 1,
// ulong, "comm_exec", 1,
// ulong, "use_clockid", 1,
// ulong, "context_switch", 1,
// ulong, "write_backward", 1,
// ulong, "namespaces", 1,
// ulong, "__reserved_1", 35));
private ulong perf_event_attr_bitmanip;
///
@property ulong disabled() @safe pure nothrow @nogc const
{
auto result = (perf_event_attr_bitmanip & 1U) >> 0U;
return cast(ulong) result;
}
///
@property void disabled(ulong v) @safe pure nothrow @nogc
{
assert(v >= disabled_min,
"Value is smaller than the minimum value of bitfield 'disabled'");
assert(v <= disabled_max,
"Value is greater than the maximum value of bitfield 'disabled'");
perf_event_attr_bitmanip = cast(typeof(perf_event_attr_bitmanip))(
(perf_event_attr_bitmanip & (-1 - cast(typeof(perf_event_attr_bitmanip)) 1U)) | (
(cast(typeof(perf_event_attr_bitmanip)) v << 0U) & 1U));
}
enum ulong disabled_min = cast(ulong) 0U;
enum ulong disabled_max = cast(ulong) 1U;
///
@property ulong inherit() @safe pure nothrow @nogc const
{
auto result = (perf_event_attr_bitmanip & 2U) >> 1U;
return cast(ulong) result;
}
///
@property void inherit(ulong v) @safe pure nothrow @nogc
{
assert(v >= inherit_min,
"Value is smaller than the minimum value of bitfield 'inherit'");
assert(v <= inherit_max,
"Value is greater than the maximum value of bitfield 'inherit'");
perf_event_attr_bitmanip = cast(typeof(perf_event_attr_bitmanip))(
(perf_event_attr_bitmanip & (-1 - cast(typeof(perf_event_attr_bitmanip)) 2U)) | (
(cast(typeof(perf_event_attr_bitmanip)) v << 1U) & 2U));
}
enum ulong inherit_min = cast(ulong) 0U;
enum ulong inherit_max = cast(ulong) 1U;
///
@property ulong pinned() @safe pure nothrow @nogc const
{
auto result = (perf_event_attr_bitmanip & 4U) >> 2U;
return cast(ulong) result;
}
///
@property void pinned(ulong v) @safe pure nothrow @nogc
{
assert(v >= pinned_min,
"Value is smaller than the minimum value of bitfield 'pinned'");
assert(v <= pinned_max,
"Value is greater than the maximum value of bitfield 'pinned'");
perf_event_attr_bitmanip = cast(typeof(perf_event_attr_bitmanip))(
(perf_event_attr_bitmanip & (-1 - cast(typeof(perf_event_attr_bitmanip)) 4U)) | (
(cast(typeof(perf_event_attr_bitmanip)) v << 2U) & 4U));
}
enum ulong pinned_min = cast(ulong) 0U;
enum ulong pinned_max = cast(ulong) 1U;
///
@property ulong exclusive() @safe pure nothrow @nogc const
{
auto result = (perf_event_attr_bitmanip & 8U) >> 3U;
return cast(ulong) result;
}
///
@property void exclusive(ulong v) @safe pure nothrow @nogc
{
assert(v >= exclusive_min,
"Value is smaller than the minimum value of bitfield 'exclusive'");
assert(v <= exclusive_max,
"Value is greater than the maximum value of bitfield 'exclusive'");
perf_event_attr_bitmanip = cast(typeof(perf_event_attr_bitmanip))(
(perf_event_attr_bitmanip & (-1 - cast(typeof(perf_event_attr_bitmanip)) 8U)) | (
(cast(typeof(perf_event_attr_bitmanip)) v << 3U) & 8U));
}
enum ulong exclusive_min = cast(ulong) 0U;
enum ulong exclusive_max = cast(ulong) 1U;
///
@property ulong exclude_user() @safe pure nothrow @nogc const
{
auto result = (perf_event_attr_bitmanip & 16U) >> 4U;
return cast(ulong) result;
}
///
@property void exclude_user(ulong v) @safe pure nothrow @nogc
{
assert(v >= exclude_user_min,
"Value is smaller than the minimum value of bitfield 'exclude_user'");
assert(v <= exclude_user_max,
"Value is greater than the maximum value of bitfield 'exclude_user'");
perf_event_attr_bitmanip = cast(typeof(perf_event_attr_bitmanip))(
(perf_event_attr_bitmanip & (-1 - cast(typeof(perf_event_attr_bitmanip)) 16U)) | (
(cast(typeof(perf_event_attr_bitmanip)) v << 4U) & 16U));
}
enum ulong exclude_user_min = cast(ulong) 0U;
enum ulong exclude_user_max = cast(ulong) 1U;
///
@property ulong exclude_kernel() @safe pure nothrow @nogc const
{
auto result = (perf_event_attr_bitmanip & 32U) >> 5U;
return cast(ulong) result;
}
///
@property void exclude_kernel(ulong v) @safe pure nothrow @nogc
{
assert(v >= exclude_kernel_min,
"Value is smaller than the minimum value of bitfield 'exclude_kernel'");
assert(v <= exclude_kernel_max,
"Value is greater than the maximum value of bitfield 'exclude_kernel'");
perf_event_attr_bitmanip = cast(typeof(perf_event_attr_bitmanip))(
(perf_event_attr_bitmanip & (-1 - cast(typeof(perf_event_attr_bitmanip)) 32U)) | (
(cast(typeof(perf_event_attr_bitmanip)) v << 5U) & 32U));
}
enum ulong exclude_kernel_min = cast(ulong) 0U;
enum ulong exclude_kernel_max = cast(ulong) 1U;
///
@property ulong exclude_hv() @safe pure nothrow @nogc const
{
auto result = (perf_event_attr_bitmanip & 64U) >> 6U;
return cast(ulong) result;
}
///
@property void exclude_hv(ulong v) @safe pure nothrow @nogc
{
assert(v >= exclude_hv_min,
"Value is smaller than the minimum value of bitfield 'exclude_hv'");
assert(v <= exclude_hv_max,
"Value is greater than the maximum value of bitfield 'exclude_hv'");
perf_event_attr_bitmanip = cast(typeof(perf_event_attr_bitmanip))(
(perf_event_attr_bitmanip & (-1 - cast(typeof(perf_event_attr_bitmanip)) 64U)) | (
(cast(typeof(perf_event_attr_bitmanip)) v << 6U) & 64U));
}
enum ulong exclude_hv_min = cast(ulong) 0U;
enum ulong exclude_hv_max = cast(ulong) 1U;
///
@property ulong exclude_idle() @safe pure nothrow @nogc const
{
auto result = (perf_event_attr_bitmanip & 128U) >> 7U;
return cast(ulong) result;
}
///
@property void exclude_idle(ulong v) @safe pure nothrow @nogc
{
assert(v >= exclude_idle_min,
"Value is smaller than the minimum value of bitfield 'exclude_idle'");
assert(v <= exclude_idle_max,
"Value is greater than the maximum value of bitfield 'exclude_idle'");
perf_event_attr_bitmanip = cast(typeof(perf_event_attr_bitmanip))(
(perf_event_attr_bitmanip & (-1 - cast(typeof(perf_event_attr_bitmanip)) 128U)) | (
(cast(typeof(perf_event_attr_bitmanip)) v << 7U) & 128U));
}
enum ulong exclude_idle_min = cast(ulong) 0U;
enum ulong exclude_idle_max = cast(ulong) 1U;
///
@property ulong mmap() @safe pure nothrow @nogc const
{
auto result = (perf_event_attr_bitmanip & 256U) >> 8U;
return cast(ulong) result;
}
///
@property void mmap(ulong v) @safe pure nothrow @nogc
{
assert(v >= mmap_min, "Value is smaller than the minimum value of bitfield 'mmap'");
assert(v <= mmap_max, "Value is greater than the maximum value of bitfield 'mmap'");
perf_event_attr_bitmanip = cast(typeof(perf_event_attr_bitmanip))(
(perf_event_attr_bitmanip & (-1 - cast(typeof(perf_event_attr_bitmanip)) 256U)) | (
(cast(typeof(perf_event_attr_bitmanip)) v << 8U) & 256U));
}
enum ulong mmap_min = cast(ulong) 0U;
enum ulong mmap_max = cast(ulong) 1U;
///
@property ulong comm() @safe pure nothrow @nogc const
{
auto result = (perf_event_attr_bitmanip & 512U) >> 9U;
return cast(ulong) result;
}
///
@property void comm(ulong v) @safe pure nothrow @nogc
{
assert(v >= comm_min, "Value is smaller than the minimum value of bitfield 'comm'");
assert(v <= comm_max, "Value is greater than the maximum value of bitfield 'comm'");
perf_event_attr_bitmanip = cast(typeof(perf_event_attr_bitmanip))(
(perf_event_attr_bitmanip & (-1 - cast(typeof(perf_event_attr_bitmanip)) 512U)) | (
(cast(typeof(perf_event_attr_bitmanip)) v << 9U) & 512U));
}
enum ulong comm_min = cast(ulong) 0U;
enum ulong comm_max = cast(ulong) 1U;
///
@property ulong freq() @safe pure nothrow @nogc const
{
auto result = (perf_event_attr_bitmanip & 1024U) >> 10U;
return cast(ulong) result;
}
///
@property void freq(ulong v) @safe pure nothrow @nogc
{
assert(v >= freq_min, "Value is smaller than the minimum value of bitfield 'freq'");
assert(v <= freq_max, "Value is greater than the maximum value of bitfield 'freq'");
perf_event_attr_bitmanip = cast(typeof(perf_event_attr_bitmanip))(
(perf_event_attr_bitmanip & (-1 - cast(typeof(perf_event_attr_bitmanip)) 1024U)) | (
(cast(typeof(perf_event_attr_bitmanip)) v << 10U) & 1024U));
}
enum ulong freq_min = cast(ulong) 0U;
enum ulong freq_max = cast(ulong) 1U;
///
@property ulong inherit_stat() @safe pure nothrow @nogc const
{
auto result = (perf_event_attr_bitmanip & 2048U) >> 11U;
return cast(ulong) result;
}
///
@property void inherit_stat(ulong v) @safe pure nothrow @nogc
{
assert(v >= inherit_stat_min,
"Value is smaller than the minimum value of bitfield 'inherit_stat'");
assert(v <= inherit_stat_max,
"Value is greater than the maximum value of bitfield 'inherit_stat'");
perf_event_attr_bitmanip = cast(typeof(perf_event_attr_bitmanip))(
(perf_event_attr_bitmanip & (-1 - cast(typeof(perf_event_attr_bitmanip)) 2048U)) | (
(cast(typeof(perf_event_attr_bitmanip)) v << 11U) & 2048U));
}
enum ulong inherit_stat_min = cast(ulong) 0U;
enum ulong inherit_stat_max = cast(ulong) 1U;
///
@property ulong enable_on_exec() @safe pure nothrow @nogc const
{
auto result = (perf_event_attr_bitmanip & 4096U) >> 12U;
return cast(ulong) result;
}
///
@property void enable_on_exec(ulong v) @safe pure nothrow @nogc
{
assert(v >= enable_on_exec_min,
"Value is smaller than the minimum value of bitfield 'enable_on_exec'");
assert(v <= enable_on_exec_max,
"Value is greater than the maximum value of bitfield 'enable_on_exec'");
perf_event_attr_bitmanip = cast(typeof(perf_event_attr_bitmanip))(
(perf_event_attr_bitmanip & (-1 - cast(typeof(perf_event_attr_bitmanip)) 4096U)) | (
(cast(typeof(perf_event_attr_bitmanip)) v << 12U) & 4096U));
}
enum ulong enable_on_exec_min = cast(ulong) 0U;
enum ulong enable_on_exec_max = cast(ulong) 1U;
///
@property ulong task() @safe pure nothrow @nogc const
{
auto result = (perf_event_attr_bitmanip & 8192U) >> 13U;
return cast(ulong) result;
}
///
@property void task(ulong v) @safe pure nothrow @nogc
{
assert(v >= task_min, "Value is smaller than the minimum value of bitfield 'task'");
assert(v <= task_max, "Value is greater than the maximum value of bitfield 'task'");
perf_event_attr_bitmanip = cast(typeof(perf_event_attr_bitmanip))(
(perf_event_attr_bitmanip & (-1 - cast(typeof(perf_event_attr_bitmanip)) 8192U)) | (
(cast(typeof(perf_event_attr_bitmanip)) v << 13U) & 8192U));
}
enum ulong task_min = cast(ulong) 0U;
enum ulong task_max = cast(ulong) 1U;
///
@property ulong watermark() @safe pure nothrow @nogc const
{
auto result = (perf_event_attr_bitmanip & 16384U) >> 14U;
return cast(ulong) result;
}
///
@property void watermark(ulong v) @safe pure nothrow @nogc
{
assert(v >= watermark_min,
"Value is smaller than the minimum value of bitfield 'watermark'");
assert(v <= watermark_max,
"Value is greater than the maximum value of bitfield 'watermark'");
perf_event_attr_bitmanip = cast(typeof(perf_event_attr_bitmanip))(
(perf_event_attr_bitmanip & (-1 - cast(typeof(perf_event_attr_bitmanip)) 16384U)) | (
(cast(typeof(perf_event_attr_bitmanip)) v << 14U) & 16384U));
}
enum ulong watermark_min = cast(ulong) 0U;
enum ulong watermark_max = cast(ulong) 1U;
///
@property ulong precise_ip() @safe pure nothrow @nogc const
{
auto result = (perf_event_attr_bitmanip & 98304U) >> 15U;
return cast(ulong) result;
}
///
@property void precise_ip(ulong v) @safe pure nothrow @nogc
{
assert(v >= precise_ip_min,
"Value is smaller than the minimum value of bitfield 'precise_ip'");
assert(v <= precise_ip_max,
"Value is greater than the maximum value of bitfield 'precise_ip'");
perf_event_attr_bitmanip = cast(typeof(perf_event_attr_bitmanip))(
(perf_event_attr_bitmanip & (-1 - cast(typeof(perf_event_attr_bitmanip)) 98304U)) | (
(cast(typeof(perf_event_attr_bitmanip)) v << 15U) & 98304U));
}
enum ulong precise_ip_min = cast(ulong) 0U;
enum ulong precise_ip_max = cast(ulong) 3U;
///
@property ulong mmap_data() @safe pure nothrow @nogc const
{
auto result = (perf_event_attr_bitmanip & 131072U) >> 17U;
return cast(ulong) result;
}
///
@property void mmap_data(ulong v) @safe pure nothrow @nogc
{
assert(v >= mmap_data_min,
"Value is smaller than the minimum value of bitfield 'mmap_data'");
assert(v <= mmap_data_max,
"Value is greater than the maximum value of bitfield 'mmap_data'");
perf_event_attr_bitmanip = cast(typeof(perf_event_attr_bitmanip))(
(perf_event_attr_bitmanip & (-1 - cast(typeof(perf_event_attr_bitmanip)) 131072U)) | (
(cast(typeof(perf_event_attr_bitmanip)) v << 17U) & 131072U));
}
enum ulong mmap_data_min = cast(ulong) 0U;
enum ulong mmap_data_max = cast(ulong) 1U;
///
@property ulong sample_id_all() @safe pure nothrow @nogc const
{
auto result = (perf_event_attr_bitmanip & 262144U) >> 18U;
return cast(ulong) result;
}
///
@property void sample_id_all(ulong v) @safe pure nothrow @nogc
{
assert(v >= sample_id_all_min,
"Value is smaller than the minimum value of bitfield 'sample_id_all'");
assert(v <= sample_id_all_max,
"Value is greater than the maximum value of bitfield 'sample_id_all'");
perf_event_attr_bitmanip = cast(typeof(perf_event_attr_bitmanip))(
(perf_event_attr_bitmanip & (-1 - cast(typeof(perf_event_attr_bitmanip)) 262144U)) | (
(cast(typeof(perf_event_attr_bitmanip)) v << 18U) & 262144U));
}
enum ulong sample_id_all_min = cast(ulong) 0U;
enum ulong sample_id_all_max = cast(ulong) 1U;
///
@property ulong exclude_host() @safe pure nothrow @nogc const
{
auto result = (perf_event_attr_bitmanip & 524288U) >> 19U;
return cast(ulong) result;
}
///
@property void exclude_host(ulong v) @safe pure nothrow @nogc
{
assert(v >= exclude_host_min,
"Value is smaller than the minimum value of bitfield 'exclude_host'");
assert(v <= exclude_host_max,
"Value is greater than the maximum value of bitfield 'exclude_host'");
perf_event_attr_bitmanip = cast(typeof(perf_event_attr_bitmanip))(
(perf_event_attr_bitmanip & (-1 - cast(typeof(perf_event_attr_bitmanip)) 524288U)) | (
(cast(typeof(perf_event_attr_bitmanip)) v << 19U) & 524288U));
}
enum ulong exclude_host_min = cast(ulong) 0U;
enum ulong exclude_host_max = cast(ulong) 1U;
///
@property ulong exclude_guest() @safe pure nothrow @nogc const
{
auto result = (perf_event_attr_bitmanip & 1048576U) >> 20U;
return cast(ulong) result;
}
///
@property void exclude_guest(ulong v) @safe pure nothrow @nogc
{
assert(v >= exclude_guest_min,
"Value is smaller than the minimum value of bitfield 'exclude_guest'");
assert(v <= exclude_guest_max,
"Value is greater than the maximum value of bitfield 'exclude_guest'");
perf_event_attr_bitmanip = cast(typeof(perf_event_attr_bitmanip))(
(perf_event_attr_bitmanip & (-1 - cast(typeof(perf_event_attr_bitmanip)) 1048576U)) | (
(cast(typeof(perf_event_attr_bitmanip)) v << 20U) & 1048576U));
}
enum ulong exclude_guest_min = cast(ulong) 0U;
enum ulong exclude_guest_max = cast(ulong) 1U;
///
@property ulong exclude_callchain_kernel() @safe pure nothrow @nogc const
{
auto result = (perf_event_attr_bitmanip & 2097152U) >> 21U;
return cast(ulong) result;
}
///
@property void exclude_callchain_kernel(ulong v) @safe pure nothrow @nogc
{
assert(v >= exclude_callchain_kernel_min,
"Value is smaller than the minimum value of bitfield 'exclude_callchain_kernel'");
assert(v <= exclude_callchain_kernel_max,
"Value is greater than the maximum value of bitfield 'exclude_callchain_kernel'");
perf_event_attr_bitmanip = cast(typeof(perf_event_attr_bitmanip))(
(perf_event_attr_bitmanip & (-1 - cast(typeof(perf_event_attr_bitmanip)) 2097152U)) | (
(cast(typeof(perf_event_attr_bitmanip)) v << 21U) & 2097152U));
}
enum ulong exclude_callchain_kernel_min = cast(ulong) 0U;
enum ulong exclude_callchain_kernel_max = cast(ulong) 1U;
///
@property ulong exclude_callchain_user() @safe pure nothrow @nogc const
{
auto result = (perf_event_attr_bitmanip & 4194304U) >> 22U;
return cast(ulong) result;
}
///
@property void exclude_callchain_user(ulong v) @safe pure nothrow @nogc
{
assert(v >= exclude_callchain_user_min,
"Value is smaller than the minimum value of bitfield 'exclude_callchain_user'");
assert(v <= exclude_callchain_user_max,
"Value is greater than the maximum value of bitfield 'exclude_callchain_user'");
perf_event_attr_bitmanip = cast(typeof(perf_event_attr_bitmanip))(
(perf_event_attr_bitmanip & (-1 - cast(typeof(perf_event_attr_bitmanip)) 4194304U)) | (
(cast(typeof(perf_event_attr_bitmanip)) v << 22U) & 4194304U));
}
enum ulong exclude_callchain_user_min = cast(ulong) 0U;
enum ulong exclude_callchain_user_max = cast(ulong) 1U;
///
@property ulong mmap2() @safe pure nothrow @nogc const
{
auto result = (perf_event_attr_bitmanip & 8388608U) >> 23U;
return cast(ulong) result;
}
///
@property void mmap2(ulong v) @safe pure nothrow @nogc
{
assert(v >= mmap2_min,
"Value is smaller than the minimum value of bitfield 'mmap2'");
assert(v <= mmap2_max,
"Value is greater than the maximum value of bitfield 'mmap2'");
perf_event_attr_bitmanip = cast(typeof(perf_event_attr_bitmanip))(
(perf_event_attr_bitmanip & (-1 - cast(typeof(perf_event_attr_bitmanip)) 8388608U)) | (
(cast(typeof(perf_event_attr_bitmanip)) v << 23U) & 8388608U));
}
enum ulong mmap2_min = cast(ulong) 0U;
enum ulong mmap2_max = cast(ulong) 1U;
///
@property ulong comm_exec() @safe pure nothrow @nogc const
{
auto result = (perf_event_attr_bitmanip & 16777216U) >> 24U;
return cast(ulong) result;
}
///
@property void comm_exec(ulong v) @safe pure nothrow @nogc
{
assert(v >= comm_exec_min,
"Value is smaller than the minimum value of bitfield 'comm_exec'");
assert(v <= comm_exec_max,
"Value is greater than the maximum value of bitfield 'comm_exec'");
perf_event_attr_bitmanip = cast(typeof(perf_event_attr_bitmanip))(
(perf_event_attr_bitmanip & (-1 - cast(typeof(perf_event_attr_bitmanip)) 16777216U)) | (
(cast(typeof(perf_event_attr_bitmanip)) v << 24U) & 16777216U));
}
enum ulong comm_exec_min = cast(ulong) 0U;
enum ulong comm_exec_max = cast(ulong) 1U;
///
@property ulong use_clockid() @safe pure nothrow @nogc const
{
auto result = (perf_event_attr_bitmanip & 33554432U) >> 25U;
return cast(ulong) result;
}
///
@property void use_clockid(ulong v) @safe pure nothrow @nogc
{
assert(v >= use_clockid_min,
"Value is smaller than the minimum value of bitfield 'use_clockid'");
assert(v <= use_clockid_max,
"Value is greater than the maximum value of bitfield 'use_clockid'");
perf_event_attr_bitmanip = cast(typeof(perf_event_attr_bitmanip))(
(perf_event_attr_bitmanip & (-1 - cast(typeof(perf_event_attr_bitmanip)) 33554432U)) | (
(cast(typeof(perf_event_attr_bitmanip)) v << 25U) & 33554432U));
}
enum ulong use_clockid_min = cast(ulong) 0U;
enum ulong use_clockid_max = cast(ulong) 1U;
///
@property ulong context_switch() @safe pure nothrow @nogc const
{
auto result = (perf_event_attr_bitmanip & 67108864U) >> 26U;
return cast(ulong) result;
}
///
@property void context_switch(ulong v) @safe pure nothrow @nogc
{
assert(v >= context_switch_min,
"Value is smaller than the minimum value of bitfield 'context_switch'");
assert(v <= context_switch_max,
"Value is greater than the maximum value of bitfield 'context_switch'");
perf_event_attr_bitmanip = cast(typeof(perf_event_attr_bitmanip))(
(perf_event_attr_bitmanip & (-1 - cast(typeof(perf_event_attr_bitmanip)) 67108864U)) | (
(cast(typeof(perf_event_attr_bitmanip)) v << 26U) & 67108864U));
}
enum ulong context_switch_min = cast(ulong) 0U;
enum ulong context_switch_max = cast(ulong) 1U;
///
@property ulong write_backward() @safe pure nothrow @nogc const
{
auto result = (perf_event_attr_bitmanip & 134217728U) >> 27U;
return cast(ulong) result;
}
///
@property void write_backward(ulong v) @safe pure nothrow @nogc
{
assert(v >= write_backward_min,
"Value is smaller than the minimum value of bitfield 'write_backward'");
assert(v <= write_backward_max,
"Value is greater than the maximum value of bitfield 'write_backward'");
perf_event_attr_bitmanip = cast(typeof(perf_event_attr_bitmanip))(
(perf_event_attr_bitmanip & (-1 - cast(typeof(perf_event_attr_bitmanip)) 134217728U)) | (
(cast(typeof(perf_event_attr_bitmanip)) v << 27U) & 134217728U));
}
enum ulong write_backward_min = cast(ulong) 0U;
enum ulong write_backward_max = cast(ulong) 1U;
///
@property ulong namespaces() @safe pure nothrow @nogc const
{
auto result = (perf_event_attr_bitmanip & 268435456U) >> 28U;
return cast(ulong) result;
}
///
@property void namespaces(ulong v) @safe pure nothrow @nogc
{
assert(v >= namespaces_min,
"Value is smaller than the minimum value of bitfield 'namespaces'");
assert(v <= namespaces_max,
"Value is greater than the maximum value of bitfield 'namespaces'");
perf_event_attr_bitmanip = cast(typeof(perf_event_attr_bitmanip))(
(perf_event_attr_bitmanip & (-1 - cast(typeof(perf_event_attr_bitmanip)) 268435456U)) | (
(cast(typeof(perf_event_attr_bitmanip)) v << 28U) & 268435456U));
}
enum ulong namespaces_min = cast(ulong) 0U;
enum ulong namespaces_max = cast(ulong) 1U;
///
@property ulong __reserved_1() @safe pure nothrow @nogc const
{
auto result = (perf_event_attr_bitmanip & 18446744073172680704UL) >> 29U;
return cast(ulong) result;
}
///
@property void __reserved_1(ulong v) @safe pure nothrow @nogc
{
assert(v >= __reserved_1_min,
"Value is smaller than the minimum value of bitfield '__reserved_1'");
assert(v <= __reserved_1_max,
"Value is greater than the maximum value of bitfield '__reserved_1'");
perf_event_attr_bitmanip = cast(typeof(perf_event_attr_bitmanip))(
(perf_event_attr_bitmanip & (-1 - cast(
typeof(perf_event_attr_bitmanip)) 18446744073172680704UL)) | (
(cast(typeof(perf_event_attr_bitmanip)) v << 29U) & 18446744073172680704UL));
}
enum ulong __reserved_1_min = cast(ulong) 0U;
enum ulong __reserved_1_max = cast(ulong) 34359738367UL;
///
union
{
uint wakeup_events; /** wakeup every n events */
uint wakeup_watermark; /** bytes before wakeup */
}
///
uint bp_type;
union
{
///
ulong bp_addr;
ulong config1; /** extension of config */
}
union
{
///
ulong bp_len;
ulong config2; /** extension of config1 */
}
ulong branch_sample_type; /** enum perf_branch_sample_type */
/**
* Defines set of user regs to dump on samples.
* See asm/perf_regs.h for details.
*/
ulong sample_regs_user;
/**
* Defines size of the user stack to dump on samples.
*/
uint sample_stack_user;
///
int clockid;
/**
* Defines set of regs to dump for each sample
* state captured on:
* - precise = 0: PMU interrupt
* - precise > 0: sampled instruction
*
* See asm/perf_regs.h for details.
*/
ulong sample_regs_intr;
/**
* Wakeup watermark for AUX area
*/
uint aux_watermark;
///
ushort sample_max_stack;
/** align to __u64 */
ushort __reserved_2;
}
///
extern (D) auto perf_flags(T)(auto ref T attr)
{
return *(&attr.read_format + 1);
}
/**
* Ioctls that can be done on a perf event fd:
*/
enum PERF_EVENT_IOC_ENABLE = _IO('$', 0);
///
enum PERF_EVENT_IOC_DISABLE = _IO('$', 1);
///
enum PERF_EVENT_IOC_REFRESH = _IO('$', 2);
///
enum PERF_EVENT_IOC_RESET = _IO('$', 3);
///
enum PERF_EVENT_IOC_PERIOD = _IOW!ulong('$', 4);
///
enum PERF_EVENT_IOC_SET_OUTPUT = _IO('$', 5);
///
enum PERF_EVENT_IOC_SET_FILTER = _IOW!(char*)('$', 6);
///
enum PERF_EVENT_IOC_ID = _IOR!(ulong*)('$', 7);
///
enum PERF_EVENT_IOC_SET_BPF = _IOW!uint('$', 8);
///
enum PERF_EVENT_IOC_PAUSE_OUTPUT = _IOW!uint('$', 9);
///
enum perf_event_ioc_flags
{
PERF_IOC_FLAG_GROUP = 1U << 0
}
/**
* Structure of the page that can be mapped via mmap
*/
struct perf_event_mmap_page
{
uint version_; /** version number of this structure */
uint compat_version; /** lowest version this is compat with */
/**
* Bits needed to read the hw events in user-space.
* ---
* u32 seq, time_mult, time_shift, index, width;
* u64 count, enabled, running;
* u64 cyc, time_offset;
* s64 pmc = 0;
*
* do {
* seq = pc->lock;
* barrier()
*
* enabled = pc->time_enabled;
* running = pc->time_running;
*
* if (pc->cap_usr_time && enabled != running) {
* cyc = rdtsc();
* time_offset = pc->time_offset;
* time_mult = pc->time_mult;
* time_shift = pc->time_shift;
* }
*
* index = pc->index;
* count = pc->offset;
* if (pc->cap_user_rdpmc && index) {
* width = pc->pmc_width;
* pmc = rdpmc(index - 1);
* }
*
* barrier();
* } while (pc->lock != seq);
* ---
* NOTE: for obvious reason this only works on self-monitoring
* processes.
*/
uint lock; /** seqlock for synchronization */
uint index; /** hardware event identifier */
long offset; /** add to hardware event value */
ulong time_enabled; /** time event active */
ulong time_running; /** time event on cpu */
///
union
{
///
ulong capabilities;
struct
{
/* mixin(bitfields!(ulong, "cap_bit0", 1, ulong, "cap_bit0_is_deprecated", 1, ulong,
"cap_user_rdpmc", 1, ulong, "cap_user_time", 1, ulong,
"cap_user_time_zero", 1, ulong, "cap_____res", 59)); */
private ulong mmap_page_bitmanip;
///
@property ulong cap_bit0() @safe pure nothrow @nogc const
{
auto result = (mmap_page_bitmanip & 1U) >> 0U;
return cast(ulong) result;
}
///
@property void cap_bit0(ulong v) @safe pure nothrow @nogc
{
assert(v >= cap_bit0_min,
"Value is smaller than the minimum value of bitfield 'cap_bit0'");
assert(v <= cap_bit0_max,
"Value is greater than the maximum value of bitfield 'cap_bit0'");
mmap_page_bitmanip = cast(typeof(mmap_page_bitmanip))(
(mmap_page_bitmanip & (-1 - cast(typeof(mmap_page_bitmanip)) 1U)) | (
(cast(typeof(mmap_page_bitmanip)) v << 0U) & 1U));
}
enum ulong cap_bit0_min = cast(ulong) 0U;
enum ulong cap_bit0_max = cast(ulong) 1U;
///
@property ulong cap_bit0_is_deprecated() @safe pure nothrow @nogc const
{
auto result = (mmap_page_bitmanip & 2U) >> 1U;
return cast(ulong) result;
}
///
@property void cap_bit0_is_deprecated(ulong v) @safe pure nothrow @nogc
{
assert(v >= cap_bit0_is_deprecated_min,
"Value is smaller than the minimum value of bitfield 'cap_bit0_is_deprecated'");
assert(v <= cap_bit0_is_deprecated_max,
"Value is greater than the maximum value of bitfield 'cap_bit0_is_deprecated'");
mmap_page_bitmanip = cast(typeof(mmap_page_bitmanip))(
(mmap_page_bitmanip & (-1 - cast(typeof(mmap_page_bitmanip)) 2U)) | (
(cast(typeof(mmap_page_bitmanip)) v << 1U) & 2U));
}
enum ulong cap_bit0_is_deprecated_min = cast(ulong) 0U;
enum ulong cap_bit0_is_deprecated_max = cast(ulong) 1U;
///
@property ulong cap_user_rdpmc() @safe pure nothrow @nogc const
{
auto result = (mmap_page_bitmanip & 4U) >> 2U;
return cast(ulong) result;
}
///
@property void cap_user_rdpmc(ulong v) @safe pure nothrow @nogc
{
assert(v >= cap_user_rdpmc_min,
"Value is smaller than the minimum value of bitfield 'cap_user_rdpmc'");
assert(v <= cap_user_rdpmc_max,
"Value is greater than the maximum value of bitfield 'cap_user_rdpmc'");
mmap_page_bitmanip = cast(typeof(mmap_page_bitmanip))(
(mmap_page_bitmanip & (-1 - cast(typeof(mmap_page_bitmanip)) 4U)) | (
(cast(typeof(mmap_page_bitmanip)) v << 2U) & 4U));
}
enum ulong cap_user_rdpmc_min = cast(ulong) 0U;
enum ulong cap_user_rdpmc_max = cast(ulong) 1U;
///
@property ulong cap_user_time() @safe pure nothrow @nogc const
{
auto result = (mmap_page_bitmanip & 8U) >> 3U;
return cast(ulong) result;
}
///
@property void cap_user_time(ulong v) @safe pure nothrow @nogc
{
assert(v >= cap_user_time_min,
"Value is smaller than the minimum value of bitfield 'cap_user_time'");
assert(v <= cap_user_time_max,
"Value is greater than the maximum value of bitfield 'cap_user_time'");
mmap_page_bitmanip = cast(typeof(mmap_page_bitmanip))(
(mmap_page_bitmanip & (-1 - cast(typeof(mmap_page_bitmanip)) 8U)) | (
(cast(typeof(mmap_page_bitmanip)) v << 3U) & 8U));
}
enum ulong cap_user_time_min = cast(ulong) 0U;
enum ulong cap_user_time_max = cast(ulong) 1U;
///
@property ulong cap_user_time_zero() @safe pure nothrow @nogc const
{
auto result = (mmap_page_bitmanip & 16U) >> 4U;
return cast(ulong) result;
}
///
@property void cap_user_time_zero(ulong v) @safe pure nothrow @nogc
{
assert(v >= cap_user_time_zero_min,
"Value is smaller than the minimum value of bitfield 'cap_user_time_zero'");
assert(v <= cap_user_time_zero_max,
"Value is greater than the maximum value of bitfield 'cap_user_time_zero'");
mmap_page_bitmanip = cast(typeof(mmap_page_bitmanip))(
(mmap_page_bitmanip & (-1 - cast(typeof(mmap_page_bitmanip)) 16U)) | (
(cast(typeof(mmap_page_bitmanip)) v << 4U) & 16U));
}
enum ulong cap_user_time_zero_min = cast(ulong) 0U;
enum ulong cap_user_time_zero_max = cast(ulong) 1U;
///
@property ulong cap_____res() @safe pure nothrow @nogc const
{
auto result = (mmap_page_bitmanip & 18446744073709551584UL) >> 5U;
return cast(ulong) result;
}
///
@property void cap_____res(ulong v) @safe pure nothrow @nogc
{
assert(v >= cap_____res_min,
"Value is smaller than the minimum value of bitfield 'cap_____res'");
assert(v <= cap_____res_max,
"Value is greater than the maximum value of bitfield 'cap_____res'");
mmap_page_bitmanip = cast(typeof(mmap_page_bitmanip))((mmap_page_bitmanip & (
-1 - cast(typeof(mmap_page_bitmanip)) 18446744073709551584UL)) | (
(cast(typeof(mmap_page_bitmanip)) v << 5U) & 18446744073709551584UL));
}
enum ulong cap_____res_min = cast(ulong) 0U;
enum ulong cap_____res_max = cast(ulong) 576460752303423487UL;
}
}
/**
* If cap_user_rdpmc this field provides the bit-width of the value
* read using the rdpmc() or equivalent instruction. This can be used
* to sign extend the result like:
*
* pmc <<= 64 - width;
* pmc >>= 64 - width; // signed shift right
* count += pmc;
*/
ushort pmc_width;
/**
* If cap_usr_time the below fields can be used to compute the time
* delta since time_enabled (in ns) using rdtsc or similar.
*
* u64 quot, rem;
* u64 delta;
*
* quot = (cyc >> time_shift);
* rem = cyc & (((u64)1 << time_shift) - 1);
* delta = time_offset + quot * time_mult +
* ((rem * time_mult) >> time_shift);
*
* Where time_offset,time_mult,time_shift and cyc are read in the
* seqcount loop described above. This delta can then be added to
* enabled and possible running (if index), improving the scaling:
*
* enabled += delta;
* if (index)
* running += delta;
*
* quot = count / running;
* rem = count % running;
* count = quot * enabled + (rem * enabled) / running;
*/
ushort time_shift;
///
uint time_mult;
///
ulong time_offset;
/**
* If cap_usr_time_zero, the hardware clock (e.g. TSC) can be calculated
* from sample timestamps.
*
* time = timestamp - time_zero;
* quot = time / time_mult;
* rem = time % time_mult;
* cyc = (quot << time_shift) + (rem << time_shift) / time_mult;
*
* And vice versa:
*
* quot = cyc >> time_shift;
* rem = cyc & (((u64)1 << time_shift) - 1);
* timestamp = time_zero + quot * time_mult +
* ((rem * time_mult) >> time_shift);
*/
ulong time_zero;
uint size; /** Header size up to __reserved[] fields. */
/**
* Hole for extension of the self monitor capabilities
*/
ubyte[948] __reserved; /** align to 1k. */
/**
* Control data for the mmap() data buffer.
*
* User-space reading the @data_head value should issue an smp_rmb(),
* after reading this value.
*
* When the mapping is PROT_WRITE the @data_tail value should be
* written by userspace to reflect the last read data, after issueing
* an smp_mb() to separate the data read from the ->data_tail store.
* In this case the kernel will not over-write unread data.
*
* See perf_output_put_handle() for the data ordering.
*
* data_{offset,size} indicate the location and size of the perf record
* buffer within the mmapped area.
*/
ulong data_head; /** head in the data section */
ulong data_tail; /** user-space written tail */
ulong data_offset; /** where the buffer starts */
ulong data_size; /** data buffer size */
/**
* AUX area is defined by aux_{offset,size} fields that should be set
* by the userspace, so that
* ---
* aux_offset >= data_offset + data_size
* ---
* prior to mmap()ing it. Size of the mmap()ed area should be aux_size.
*
* Ring buffer pointers aux_{head,tail} have the same semantics as
* data_{head,tail} and same ordering rules apply.
*/
ulong aux_head;
///
ulong aux_tail;
///
ulong aux_offset;
///
ulong aux_size;
}
///
enum PERF_RECORD_MISC_CPUMODE_MASK = 7 << 0;
///
enum PERF_RECORD_MISC_CPUMODE_UNKNOWN = 0 << 0;
///
enum PERF_RECORD_MISC_KERNEL = 1 << 0;
///
enum PERF_RECORD_MISC_USER = 2 << 0;
///
enum PERF_RECORD_MISC_HYPERVISOR = 3 << 0;
///
enum PERF_RECORD_MISC_GUEST_KERNEL = 4 << 0;
///
enum PERF_RECORD_MISC_GUEST_USER = 5 << 0;
/**
* Indicates that /proc/PID/maps parsing are truncated by time out.
*/
enum PERF_RECORD_MISC_PROC_MAP_PARSE_TIMEOUT = 1 << 12;
/**
* PERF_RECORD_MISC_MMAP_DATA and PERF_RECORD_MISC_COMM_EXEC are used on
* different events so can reuse the same bit position.
* Ditto PERF_RECORD_MISC_SWITCH_OUT.
*/
enum PERF_RECORD_MISC_MMAP_DATA = 1 << 13;
///
enum PERF_RECORD_MISC_COMM_EXEC = 1 << 13;
///
enum PERF_RECORD_MISC_SWITCH_OUT = 1 << 13;
/**
* Indicates that the content of PERF_SAMPLE_IP points to
* the actual instruction that triggered the event. See also
* perf_event_attr::precise_ip.
*/
enum PERF_RECORD_MISC_EXACT_IP = 1 << 14;
/**
* Reserve the last bit to indicate some extended misc field
*/
enum PERF_RECORD_MISC_EXT_RESERVED = 1 << 15;
///
struct perf_event_header
{
///
uint type;
///
ushort misc;
///
ushort size;
}
///
struct perf_ns_link_info
{
///
ulong dev;
///
ulong ino;
}
enum
{
///
NET_NS_INDEX = 0,
///
UTS_NS_INDEX = 1,
///
IPC_NS_INDEX = 2,
///
PID_NS_INDEX = 3,
///
USER_NS_INDEX = 4,
///
MNT_NS_INDEX = 5,
///
CGROUP_NS_INDEX = 6,
NR_NAMESPACES = 7 /** number of available namespaces */
}
///
enum perf_event_type
{
/**
* If perf_event_attr.sample_id_all is set then all event types will
* have the sample_type selected fields related to where/when
* (identity) an event took place (TID, TIME, ID, STREAM_ID, CPU,
* IDENTIFIER) described in PERF_RECORD_SAMPLE below, it will be stashed
* just after the perf_event_header and the fields already present for
* the existing fields, i.e. at the end of the payload. That way a newer
* perf.data file will be supported by older perf tools, with these new
* optional fields being ignored.
* ---
* struct sample_id {
* { u32 pid, tid; } && PERF_SAMPLE_TID
* { u64 time; } && PERF_SAMPLE_TIME
* { u64 id; } && PERF_SAMPLE_ID
* { u64 stream_id;} && PERF_SAMPLE_STREAM_ID
* { u32 cpu, res; } && PERF_SAMPLE_CPU
* { u64 id; } && PERF_SAMPLE_IDENTIFIER
* } && perf_event_attr::sample_id_all
* ---
* Note that PERF_SAMPLE_IDENTIFIER duplicates PERF_SAMPLE_ID. The
* advantage of PERF_SAMPLE_IDENTIFIER is that its position is fixed
* relative to header.size.
*/
/*
* The MMAP events record the PROT_EXEC mappings so that we can
* correlate userspace IPs to code. They have the following structure:
* ---
* struct {
* struct perf_event_header header;
*
* u32 pid, tid;
* u64 addr;
* u64 len;
* u64 pgoff;
* char filename[];
* struct sample_id sample_id;
* };
* ---
*/
PERF_RECORD_MMAP = 1,
/**
* ---
* struct {
* struct perf_event_header header;
* u64 id;
* u64 lost;
* struct sample_id sample_id;
* };
* ---
*/
PERF_RECORD_LOST = 2,
/**
* ---
* struct {
* struct perf_event_header header;
*
* u32 pid, tid;
* char comm[];
* struct sample_id sample_id;
* };
* ---
*/
PERF_RECORD_COMM = 3,
/**
* ---
* struct {
* struct perf_event_header header;
* u32 pid, ppid;
* u32 tid, ptid;
* u64 time;
* struct sample_id sample_id;
* };
* ---
*/
PERF_RECORD_EXIT = 4,
/**
* ---
* struct {
* struct perf_event_header header;
* u64 time;
* u64 id;
* u64 stream_id;
* struct sample_id sample_id;
* };
* ---
*/
PERF_RECORD_THROTTLE = 5,
PERF_RECORD_UNTHROTTLE = 6,
/**
* ---
* struct {
* struct perf_event_header header;
* u32 pid, ppid;
* u32 tid, ptid;
* u64 time;
* struct sample_id sample_id;
* };
* ---
*/
PERF_RECORD_FORK = 7,
/**
* ---
* struct {
* struct perf_event_header header;
* u32 pid, tid;
*
* struct read_format values;
* struct sample_id sample_id;
* };
* ---
*/
PERF_RECORD_READ = 8,
/**
* ---
* struct {
* struct perf_event_header header;
*
* #
* # Note that PERF_SAMPLE_IDENTIFIER duplicates PERF_SAMPLE_ID.
* # The advantage of PERF_SAMPLE_IDENTIFIER is that its position
* # is fixed relative to header.
* #
*
* { u64 id; } && PERF_SAMPLE_IDENTIFIER
* { u64 ip; } && PERF_SAMPLE_IP
* { u32 pid, tid; } && PERF_SAMPLE_TID
* { u64 time; } && PERF_SAMPLE_TIME
* { u64 addr; } && PERF_SAMPLE_ADDR
* { u64 id; } && PERF_SAMPLE_ID
* { u64 stream_id;} && PERF_SAMPLE_STREAM_ID
* { u32 cpu, res; } && PERF_SAMPLE_CPU
* { u64 period; } && PERF_SAMPLE_PERIOD
*
* { struct read_format values; } && PERF_SAMPLE_READ
*
* { u64 nr,
* u64 ips[nr]; } && PERF_SAMPLE_CALLCHAIN
*
* #
* # The RAW record below is opaque data wrt the ABI
* #
* # That is, the ABI doesn't make any promises wrt to
* # the stability of its content, it may vary depending
* # on event, hardware, kernel version and phase of
* # the moon.
* #
* # In other words, PERF_SAMPLE_RAW contents are not an ABI.
* #
*
* { u32 size;
* char data[size];}&& PERF_SAMPLE_RAW
*
* { u64 nr;
* { u64 from, to, flags } lbr[nr];} && PERF_SAMPLE_BRANCH_STACK
*
* { u64 abi; # enum perf_sample_regs_abi
* u64 regs[weight(mask)]; } && PERF_SAMPLE_REGS_USER
*
* { u64 size;
* char data[size];
* u64 dyn_size; } && PERF_SAMPLE_STACK_USER
*
* { u64 weight; } && PERF_SAMPLE_WEIGHT
* { u64 data_src; } && PERF_SAMPLE_DATA_SRC
* { u64 transaction; } && PERF_SAMPLE_TRANSACTION
* { u64 abi; # enum perf_sample_regs_abi
* u64 regs[weight(mask)]; } && PERF_SAMPLE_REGS_INTR
* { u64 phys_addr;} && PERF_SAMPLE_PHYS_ADDR
* };
* ---
*/
PERF_RECORD_SAMPLE = 9,
/**
* ---
* The MMAP2 records are an augmented version of MMAP, they add
* maj, min, ino numbers to be used to uniquely identify each mapping
*
* struct {
* struct perf_event_header header;
*
* u32 pid, tid;
* u64 addr;
* u64 len;
* u64 pgoff;
* u32 maj;
* u32 min;
* u64 ino;
* u64 ino_generation;
* u32 prot, flags;
* char filename[];
* struct sample_id sample_id;
* };
* ---
*/
PERF_RECORD_MMAP2 = 10,
/**
* Records that new data landed in the AUX buffer part.
* ---
* struct {
* struct perf_event_header header;
*
* u64 aux_offset;
* u64 aux_size;
* u64 flags;
* struct sample_id sample_id;
* };
* ---
*/
PERF_RECORD_AUX = 11,
/**
* ---
* Indicates that instruction trace has started
*
* struct {
* struct perf_event_header header;
* u32 pid;
* u32 tid;
* };
* ---
*/
PERF_RECORD_ITRACE_START = 12,
/**
* Records the dropped/lost sample number.
* ---
* struct {
* struct perf_event_header header;
*
* u64 lost;
* struct sample_id sample_id;
* };
* ---
*/
PERF_RECORD_LOST_SAMPLES = 13,
/**
*
* Records a context switch in or out (flagged by
* PERF_RECORD_MISC_SWITCH_OUT). See also
* PERF_RECORD_SWITCH_CPU_WIDE.
* ---
* struct {
* struct perf_event_header header;
* struct sample_id sample_id;
* };
* ---
*/
PERF_RECORD_SWITCH = 14,
/**
* CPU-wide version of PERF_RECORD_SWITCH with next_prev_pid and
* next_prev_tid that are the next (switching out) or previous
* (switching in) pid/tid.
* ---
* struct {
* struct perf_event_header header;
* u32 next_prev_pid;
* u32 next_prev_tid;
* struct sample_id sample_id;
* };
* ---
*/
PERF_RECORD_SWITCH_CPU_WIDE = 15,
/**
* ---
* struct {
* struct perf_event_header header;
* u32 pid;
* u32 tid;
* u64 nr_namespaces;
* { u64 dev, inode; } [nr_namespaces];
* struct sample_id sample_id;
* };
* ---
*/
PERF_RECORD_NAMESPACES = 16,
PERF_RECORD_MAX = 17 /* non-ABI */
}
///
enum PERF_MAX_STACK_DEPTH = 127;
///
enum PERF_MAX_CONTEXTS_PER_STACK = 8;
///
enum perf_callchain_context
{
///
PERF_CONTEXT_HV = cast(ulong)-32,
///
PERF_CONTEXT_KERNEL = cast(ulong)-128,
///
PERF_CONTEXT_USER = cast(ulong)-512,
///
PERF_CONTEXT_GUEST = cast(ulong)-2048,
///
PERF_CONTEXT_GUEST_KERNEL = cast(ulong)-2176,
///
PERF_CONTEXT_GUEST_USER = cast(ulong)-2560,
///
PERF_CONTEXT_MAX = cast(ulong)-4095
}
/**
* PERF_RECORD_AUX::flags bits
*/
enum PERF_AUX_FLAG_TRUNCATED = 0x01; /** record was truncated to fit */
enum PERF_AUX_FLAG_OVERWRITE = 0x02; /** snapshot from overwrite mode */
enum PERF_AUX_FLAG_PARTIAL = 0x04; /** record contains gaps */
enum PERF_AUX_FLAG_COLLISION = 0x08; /** sample collided with another */
///
enum PERF_FLAG_FD_NO_GROUP = 1UL << 0;
///
enum PERF_FLAG_FD_OUTPUT = 1UL << 1;
enum PERF_FLAG_PID_CGROUP = 1UL << 2; /** pid=cgroup id, per-cpu mode only */
enum PERF_FLAG_FD_CLOEXEC = 1UL << 3; /** O_CLOEXEC */
///perm_mem_data_src is endian specific.
version (LittleEndian)
{
///
union perf_mem_data_src
{
///
ulong val;
struct
{
/* mixin(bitfields!(ulong, "mem_op", 5, ulong, "mem_lvl", 14, ulong,
"mem_snoop", 5, ulong, "mem_lock", 2, ulong, "mem_dtlb", 7, ulong,
"mem_lvl_num", 4, ulong, "mem_remote", 1, ulong,
"mem_snoopx", 2, ulong, "mem_rsvd", 24)); */
private ulong perf_mem_data_src_bitmanip;
///
@property ulong mem_op() @safe pure nothrow @nogc const
{
auto result = (perf_mem_data_src_bitmanip & 31U) >> 0U;
return cast(ulong) result;
}
///
@property void mem_op(ulong v) @safe pure nothrow @nogc
{
assert(v >= mem_op_min,
"Value is smaller than the minimum value of bitfield 'mem_op'");
assert(v <= mem_op_max,
"Value is greater than the maximum value of bitfield 'mem_op'");
perf_mem_data_src_bitmanip = cast(
typeof(perf_mem_data_src_bitmanip))((perf_mem_data_src_bitmanip & (
-1 - cast(typeof(perf_mem_data_src_bitmanip)) 31U)) | (
(cast(typeof(perf_mem_data_src_bitmanip)) v << 0U) & 31U));
}
enum ulong mem_op_min = cast(ulong) 0U;
enum ulong mem_op_max = cast(ulong) 31U;
///
@property ulong mem_lvl() @safe pure nothrow @nogc const
{
auto result = (perf_mem_data_src_bitmanip & 524256U) >> 5U;
return cast(ulong) result;
}
///
@property void mem_lvl(ulong v) @safe pure nothrow @nogc
{
assert(v >= mem_lvl_min,
"Value is smaller than the minimum value of bitfield 'mem_lvl'");
assert(v <= mem_lvl_max,
"Value is greater than the maximum value of bitfield 'mem_lvl'");
perf_mem_data_src_bitmanip = cast(
typeof(perf_mem_data_src_bitmanip))((perf_mem_data_src_bitmanip & (
-1 - cast(typeof(perf_mem_data_src_bitmanip)) 524256U)) | (
(cast(typeof(perf_mem_data_src_bitmanip)) v << 5U) & 524256U));
}
enum ulong mem_lvl_min = cast(ulong) 0U;
enum ulong mem_lvl_max = cast(ulong) 16383U;
///
@property ulong mem_snoop() @safe pure nothrow @nogc const
{
auto result = (perf_mem_data_src_bitmanip & 16252928U) >> 19U;
return cast(ulong) result;
}
///
@property void mem_snoop(ulong v) @safe pure nothrow @nogc
{
assert(v >= mem_snoop_min,
"Value is smaller than the minimum value of bitfield 'mem_snoop'");
assert(v <= mem_snoop_max,
"Value is greater than the maximum value of bitfield 'mem_snoop'");
perf_mem_data_src_bitmanip = cast(
typeof(perf_mem_data_src_bitmanip))((perf_mem_data_src_bitmanip & (
-1 - cast(typeof(perf_mem_data_src_bitmanip)) 16252928U)) | (
(cast(typeof(perf_mem_data_src_bitmanip)) v << 19U) & 16252928U));
}
enum ulong mem_snoop_min = cast(ulong) 0U;
enum ulong mem_snoop_max = cast(ulong) 31U;
///
@property ulong mem_lock() @safe pure nothrow @nogc const
{
auto result = (perf_mem_data_src_bitmanip & 50331648U) >> 24U;
return cast(ulong) result;
}
///
@property void mem_lock(ulong v) @safe pure nothrow @nogc
{
assert(v >= mem_lock_min,
"Value is smaller than the minimum value of bitfield 'mem_lock'");
assert(v <= mem_lock_max,
"Value is greater than the maximum value of bitfield 'mem_lock'");
perf_mem_data_src_bitmanip = cast(
typeof(perf_mem_data_src_bitmanip))((perf_mem_data_src_bitmanip & (
-1 - cast(typeof(perf_mem_data_src_bitmanip)) 50331648U)) | (
(cast(typeof(perf_mem_data_src_bitmanip)) v << 24U) & 50331648U));
}
enum ulong mem_lock_min = cast(ulong) 0U;
enum ulong mem_lock_max = cast(ulong) 3U;
///
@property ulong mem_dtlb() @safe pure nothrow @nogc const
{
auto result = (perf_mem_data_src_bitmanip & 8522825728UL) >> 26U;
return cast(ulong) result;
}
///
@property void mem_dtlb(ulong v) @safe pure nothrow @nogc
{
assert(v >= mem_dtlb_min,
"Value is smaller than the minimum value of bitfield 'mem_dtlb'");
assert(v <= mem_dtlb_max,
"Value is greater than the maximum value of bitfield 'mem_dtlb'");
perf_mem_data_src_bitmanip = cast(
typeof(perf_mem_data_src_bitmanip))((perf_mem_data_src_bitmanip & (
-1 - cast(typeof(perf_mem_data_src_bitmanip)) 8522825728UL)) | (
(cast(typeof(perf_mem_data_src_bitmanip)) v << 26U) & 8522825728UL));
}
enum ulong mem_dtlb_min = cast(ulong) 0U;
enum ulong mem_dtlb_max = cast(ulong) 127U;
///
@property ulong mem_lvl_num() @safe pure nothrow @nogc const
{
auto result = (perf_mem_data_src_bitmanip & 128849018880UL) >> 33U;
return cast(ulong) result;
}
///
@property void mem_lvl_num(ulong v) @safe pure nothrow @nogc
{
assert(v >= mem_lvl_num_min,
"Value is smaller than the minimum value of bitfield 'mem_lvl_num'");
assert(v <= mem_lvl_num_max,
"Value is greater than the maximum value of bitfield 'mem_lvl_num'");
perf_mem_data_src_bitmanip = cast(
typeof(perf_mem_data_src_bitmanip))((perf_mem_data_src_bitmanip & (
-1 - cast(typeof(perf_mem_data_src_bitmanip)) 128849018880UL)) | (
(cast(typeof(perf_mem_data_src_bitmanip)) v << 33U) & 128849018880UL));
}
enum ulong mem_lvl_num_min = cast(ulong) 0U;
enum ulong mem_lvl_num_max = cast(ulong) 15U;
///
@property ulong mem_remote() @safe pure nothrow @nogc const
{
auto result = (perf_mem_data_src_bitmanip & 137438953472UL) >> 37U;
return cast(ulong) result;
}
///
@property void mem_remote(ulong v) @safe pure nothrow @nogc
{
assert(v >= mem_remote_min,
"Value is smaller than the minimum value of bitfield 'mem_remote'");
assert(v <= mem_remote_max,
"Value is greater than the maximum value of bitfield 'mem_remote'");
perf_mem_data_src_bitmanip = cast(
typeof(perf_mem_data_src_bitmanip))((perf_mem_data_src_bitmanip & (
-1 - cast(typeof(perf_mem_data_src_bitmanip)) 137438953472UL)) | (
(cast(typeof(perf_mem_data_src_bitmanip)) v << 37U) & 137438953472UL));
}
enum ulong mem_remote_min = cast(ulong) 0U;
enum ulong mem_remote_max = cast(ulong) 1U;
///
@property ulong mem_snoopx() @safe pure nothrow @nogc const
{
auto result = (perf_mem_data_src_bitmanip & 824633720832UL) >> 38U;
return cast(ulong) result;
}
///
@property void mem_snoopx(ulong v) @safe pure nothrow @nogc
{
assert(v >= mem_snoopx_min,
"Value is smaller than the minimum value of bitfield 'mem_snoopx'");
assert(v <= mem_snoopx_max,
"Value is greater than the maximum value of bitfield 'mem_snoopx'");
perf_mem_data_src_bitmanip = cast(
typeof(perf_mem_data_src_bitmanip))((perf_mem_data_src_bitmanip & (
-1 - cast(typeof(perf_mem_data_src_bitmanip)) 824633720832UL)) | (
(cast(typeof(perf_mem_data_src_bitmanip)) v << 38U) & 824633720832UL));
}
enum ulong mem_snoopx_min = cast(ulong) 0U;
enum ulong mem_snoopx_max = cast(ulong) 3U;
///
@property ulong mem_rsvd() @safe pure nothrow @nogc const
{
auto result = (perf_mem_data_src_bitmanip & 18446742974197923840UL) >> 40U;
return cast(ulong) result;
}
///
@property void mem_rsvd(ulong v) @safe pure nothrow @nogc
{
assert(v >= mem_rsvd_min,
"Value is smaller than the minimum value of bitfield 'mem_rsvd'");
assert(v <= mem_rsvd_max,
"Value is greater than the maximum value of bitfield 'mem_rsvd'");
perf_mem_data_src_bitmanip = cast(
typeof(perf_mem_data_src_bitmanip))(
(perf_mem_data_src_bitmanip & (-1 - cast(
typeof(perf_mem_data_src_bitmanip)) 18446742974197923840UL)) | (
(cast(typeof(perf_mem_data_src_bitmanip)) v << 40U) & 18446742974197923840UL));
}
enum ulong mem_rsvd_min = cast(ulong) 0U;
enum ulong mem_rsvd_max = cast(ulong) 16777215U;
}
}
}
else
{
///
union perf_mem_data_src
{
///
ulong val;
struct
{
/* mixin(bitfields!(ulong, "mem_rsvd", 24, ulong, "mem_snoopx", 2, ulong,
"mem_remote", 1, ulong, "mem_lvl_num", 4, ulong, "mem_dtlb", 7, ulong,
"mem_lock", 2, ulong, "mem_snoop", 5, ulong, "mem_lvl",
14, ulong, "mem_op", 5)); */
private ulong perf_mem_data_src;
///
@property ulong mem_rsvd() @safe pure nothrow @nogc const
{
auto result = (perf_mem_data_src & 16777215U) >> 0U;
return cast(ulong) result;
}
///
@property void mem_rsvd(ulong v) @safe pure nothrow @nogc
{
assert(v >= mem_rsvd_min,
"Value is smaller than the minimum value of bitfield 'mem_rsvd'");
assert(v <= mem_rsvd_max,
"Value is greater than the maximum value of bitfield 'mem_rsvd'");
perf_mem_data_src = cast(typeof(perf_mem_data_src))(
(perf_mem_data_src & (-1 - cast(typeof(perf_mem_data_src)) 16777215U)) | (
(cast(typeof(perf_mem_data_src)) v << 0U) & 16777215U));
}
enum ulong mem_rsvd_min = cast(ulong) 0U;
enum ulong mem_rsvd_max = cast(ulong) 16777215U;
///
@property ulong mem_snoopx() @safe pure nothrow @nogc const
{
auto result = (perf_mem_data_src & 50331648U) >> 24U;
return cast(ulong) result;
}
///
@property void mem_snoopx(ulong v) @safe pure nothrow @nogc
{
assert(v >= mem_snoopx_min,
"Value is smaller than the minimum value of bitfield 'mem_snoopx'");
assert(v <= mem_snoopx_max,
"Value is greater than the maximum value of bitfield 'mem_snoopx'");
perf_mem_data_src = cast(typeof(perf_mem_data_src))(
(perf_mem_data_src & (-1 - cast(typeof(perf_mem_data_src)) 50331648U)) | (
(cast(typeof(perf_mem_data_src)) v << 24U) & 50331648U));
}
enum ulong mem_snoopx_min = cast(ulong) 0U;
enum ulong mem_snoopx_max = cast(ulong) 3U;
///
@property ulong mem_remote() @safe pure nothrow @nogc const
{
auto result = (perf_mem_data_src & 67108864U) >> 26U;
return cast(ulong) result;
}
///
@property void mem_remote(ulong v) @safe pure nothrow @nogc
{
assert(v >= mem_remote_min,
"Value is smaller than the minimum value of bitfield 'mem_remote'");
assert(v <= mem_remote_max,
"Value is greater than the maximum value of bitfield 'mem_remote'");
perf_mem_data_src = cast(typeof(perf_mem_data_src))(
(perf_mem_data_src & (-1 - cast(typeof(perf_mem_data_src)) 67108864U)) | (
(cast(typeof(perf_mem_data_src)) v << 26U) & 67108864U));
}
enum ulong mem_remote_min = cast(ulong) 0U;
enum ulong mem_remote_max = cast(ulong) 1U;
///
@property ulong mem_lvl_num() @safe pure nothrow @nogc const
{
auto result = (perf_mem_data_src & 2013265920U) >> 27U;
return cast(ulong) result;
}
///
@property void mem_lvl_num(ulong v) @safe pure nothrow @nogc
{
assert(v >= mem_lvl_num_min,
"Value is smaller than the minimum value of bitfield 'mem_lvl_num'");
assert(v <= mem_lvl_num_max,
"Value is greater than the maximum value of bitfield 'mem_lvl_num'");
perf_mem_data_src = cast(typeof(perf_mem_data_src))(
(perf_mem_data_src & (-1 - cast(typeof(perf_mem_data_src)) 2013265920U)) | (
(cast(typeof(perf_mem_data_src)) v << 27U) & 2013265920U));
}
enum ulong mem_lvl_num_min = cast(ulong) 0U;
enum ulong mem_lvl_num_max = cast(ulong) 15U;
///
@property ulong mem_dtlb() @safe pure nothrow @nogc const
{
auto result = (perf_mem_data_src & 272730423296UL) >> 31U;
return cast(ulong) result;
}
///
@property void mem_dtlb(ulong v) @safe pure nothrow @nogc
{
assert(v >= mem_dtlb_min,
"Value is smaller than the minimum value of bitfield 'mem_dtlb'");
assert(v <= mem_dtlb_max,
"Value is greater than the maximum value of bitfield 'mem_dtlb'");
perf_mem_data_src = cast(typeof(perf_mem_data_src))(
(perf_mem_data_src & (-1 - cast(typeof(perf_mem_data_src)) 272730423296UL)) | (
(cast(typeof(perf_mem_data_src)) v << 31U) & 272730423296UL));
}
enum ulong mem_dtlb_min = cast(ulong) 0U;
enum ulong mem_dtlb_max = cast(ulong) 127U;
///
@property ulong mem_lock() @safe pure nothrow @nogc const
{
auto result = (perf_mem_data_src & 824633720832UL) >> 38U;
return cast(ulong) result;
}
///
@property void mem_lock(ulong v) @safe pure nothrow @nogc
{
assert(v >= mem_lock_min,
"Value is smaller than the minimum value of bitfield 'mem_lock'");
assert(v <= mem_lock_max,
"Value is greater than the maximum value of bitfield 'mem_lock'");
perf_mem_data_src = cast(typeof(perf_mem_data_src))(
(perf_mem_data_src & (-1 - cast(typeof(perf_mem_data_src)) 824633720832UL)) | (
(cast(typeof(perf_mem_data_src)) v << 38U) & 824633720832UL));
}
enum ulong mem_lock_min = cast(ulong) 0U;
enum ulong mem_lock_max = cast(ulong) 3U;
///
@property ulong mem_snoop() @safe pure nothrow @nogc const
{
auto result = (perf_mem_data_src & 34084860461056UL) >> 40U;
return cast(ulong) result;
}
///
@property void mem_snoop(ulong v) @safe pure nothrow @nogc
{
assert(v >= mem_snoop_min,
"Value is smaller than the minimum value of bitfield 'mem_snoop'");
assert(v <= mem_snoop_max,
"Value is greater than the maximum value of bitfield 'mem_snoop'");
perf_mem_data_src = cast(typeof(perf_mem_data_src))(
(perf_mem_data_src & (-1 - cast(typeof(perf_mem_data_src)) 34084860461056UL)) | (
(cast(typeof(perf_mem_data_src)) v << 40U) & 34084860461056UL));
}
enum ulong mem_snoop_min = cast(ulong) 0U;
enum ulong mem_snoop_max = cast(ulong) 31U;
///
@property ulong mem_lvl() @safe pure nothrow @nogc const
{
auto result = (perf_mem_data_src & 576425567931334656UL) >> 45U;
return cast(ulong) result;
}
///
@property void mem_lvl(ulong v) @safe pure nothrow @nogc
{
assert(v >= mem_lvl_min,
"Value is smaller than the minimum value of bitfield 'mem_lvl'");
assert(v <= mem_lvl_max,
"Value is greater than the maximum value of bitfield 'mem_lvl'");
perf_mem_data_src = cast(typeof(perf_mem_data_src))((perf_mem_data_src & (
-1 - cast(typeof(perf_mem_data_src)) 576425567931334656UL)) | (
(cast(typeof(perf_mem_data_src)) v << 45U) & 576425567931334656UL));
}
enum ulong mem_lvl_min = cast(ulong) 0U;
enum ulong mem_lvl_max = cast(ulong) 16383U;
///
@property ulong mem_op() @safe pure nothrow @nogc const
{
auto result = (perf_mem_data_src & 17870283321406128128UL) >> 59U;
return cast(ulong) result;
}
///
@property void mem_op(ulong v) @safe pure nothrow @nogc
{
assert(v >= mem_op_min,
"Value is smaller than the minimum value of bitfield 'mem_op'");
assert(v <= mem_op_max,
"Value is greater than the maximum value of bitfield 'mem_op'");
perf_mem_data_src = cast(typeof(perf_mem_data_src))((perf_mem_data_src & (
-1 - cast(typeof(perf_mem_data_src)) 17870283321406128128UL)) | (
(cast(typeof(perf_mem_data_src)) v << 59U) & 17870283321406128128UL));
}
enum ulong mem_op_min = cast(ulong) 0U;
enum ulong mem_op_max = cast(ulong) 31U;
}
}
}
/* snoop mode, ext */
/* remote */
/* memory hierarchy level number */
/* tlb access */
/* lock instr */
/* snoop mode */
/* memory hierarchy level */
/* type of opcode */
/** type of opcode (load/store/prefetch,code) */
enum PERF_MEM_OP_NA = 0x01; /** not available */
enum PERF_MEM_OP_LOAD = 0x02; /** load instruction */
enum PERF_MEM_OP_STORE = 0x04; /** store instruction */
enum PERF_MEM_OP_PFETCH = 0x08; /** prefetch */
enum PERF_MEM_OP_EXEC = 0x10; /** code (execution) */
enum PERF_MEM_OP_SHIFT = 0;
/* memory hierarchy (memory level, hit or miss) */
enum PERF_MEM_LVL_NA = 0x01; /** not available */
enum PERF_MEM_LVL_HIT = 0x02; /** hit level */
enum PERF_MEM_LVL_MISS = 0x04; /** miss level */
enum PERF_MEM_LVL_L1 = 0x08; /** L1 */
enum PERF_MEM_LVL_LFB = 0x10; /** Line Fill Buffer */
enum PERF_MEM_LVL_L2 = 0x20; /** L2 */
enum PERF_MEM_LVL_L3 = 0x40; /** L3 */
enum PERF_MEM_LVL_LOC_RAM = 0x80; /** Local DRAM */
enum PERF_MEM_LVL_REM_RAM1 = 0x100; /** Remote DRAM (1 hop) */
enum PERF_MEM_LVL_REM_RAM2 = 0x200; /** Remote DRAM (2 hops) */
enum PERF_MEM_LVL_REM_CCE1 = 0x400; /** Remote Cache (1 hop) */
enum PERF_MEM_LVL_REM_CCE2 = 0x800; /** Remote Cache (2 hops) */
enum PERF_MEM_LVL_IO = 0x1000; /** I/O memory */
enum PERF_MEM_LVL_UNC = 0x2000; /** Uncached memory */
///
enum PERF_MEM_LVL_SHIFT = 5;
enum PERF_MEM_REMOTE_REMOTE = 0x01; /** Remote */
///
enum PERF_MEM_REMOTE_SHIFT = 37;
enum PERF_MEM_LVLNUM_L1 = 0x01; /** L1 */
enum PERF_MEM_LVLNUM_L2 = 0x02; /** L2 */
enum PERF_MEM_LVLNUM_L3 = 0x03; /** L3 */
enum PERF_MEM_LVLNUM_L4 = 0x04; /** L4 */
/* 5-0xa available */
enum PERF_MEM_LVLNUM_ANY_CACHE = 0x0b; /** Any cache */
enum PERF_MEM_LVLNUM_LFB = 0x0c; /** LFB */
enum PERF_MEM_LVLNUM_RAM = 0x0d; /** RAM */
enum PERF_MEM_LVLNUM_PMEM = 0x0e; /** PMEM */
enum PERF_MEM_LVLNUM_NA = 0x0f; /** N/A */
///
enum PERF_MEM_LVLNUM_SHIFT = 33;
/* snoop mode */
enum PERF_MEM_SNOOP_NA = 0x01; /** not available */
enum PERF_MEM_SNOOP_NONE = 0x02; /** no snoop */
enum PERF_MEM_SNOOP_HIT = 0x04; /** snoop hit */
enum PERF_MEM_SNOOP_MISS = 0x08; /** snoop miss */
enum PERF_MEM_SNOOP_HITM = 0x10; /** snoop hit modified */
///
enum PERF_MEM_SNOOP_SHIFT = 19;
enum PERF_MEM_SNOOPX_FWD = 0x01; /** forward */
/** 1 free */
enum PERF_MEM_SNOOPX_SHIFT = 37;
/** locked instruction */
enum PERF_MEM_LOCK_NA = 0x01; /** not available */
enum PERF_MEM_LOCK_LOCKED = 0x02; /** locked transaction */
///
enum PERF_MEM_LOCK_SHIFT = 24;
/* TLB access */
enum PERF_MEM_TLB_NA = 0x01; /** not available */
enum PERF_MEM_TLB_HIT = 0x02; /** hit level */
enum PERF_MEM_TLB_MISS = 0x04; /** miss level */
enum PERF_MEM_TLB_L1 = 0x08; /** L1 */
enum PERF_MEM_TLB_L2 = 0x10; /** L2 */
enum PERF_MEM_TLB_WK = 0x20; /** Hardware Walker*/
enum PERF_MEM_TLB_OS = 0x40; /** OS fault handler */
///
enum PERF_MEM_TLB_SHIFT = 26;
/**
* single taken branch record layout:
*
* from: source instruction (may not always be a branch insn)
* to: branch target
* mispred: branch target was mispredicted
* predicted: branch target was predicted
*
* support for mispred, predicted is optional. In case it
* is not supported mispred = predicted = 0.
*
* in_tx: running in a hardware transaction
* abort: aborting a hardware transaction
* cycles: cycles from last branch (or 0 if not supported)
* type: branch type
*/
struct perf_branch_entry
{
///
ulong from;
///
ulong to;
/* mixin(bitfields!(ulong, "mispred", 1, ulong, "predicted", 1, ulong,
"in_tx", 1, ulong, "abort", 1, ulong, "cycles", 16, ulong, "type",
4, ulong, "reserved", 40)); */
private ulong perf_branch_entry_bitmanip;
///
@property ulong mispred() @safe pure nothrow @nogc const
{
auto result = (perf_branch_entry_bitmanip & 1U) >> 0U;
return cast(ulong) result;
}
///
@property void mispred(ulong v) @safe pure nothrow @nogc
{
assert(v >= mispred_min,
"Value is smaller than the minimum value of bitfield 'mispred'");
assert(v <= mispred_max,
"Value is greater than the maximum value of bitfield 'mispred'");
perf_branch_entry_bitmanip = cast(typeof(perf_branch_entry_bitmanip))(
(perf_branch_entry_bitmanip & (-1 - cast(typeof(perf_branch_entry_bitmanip)) 1U)) | (
(cast(typeof(perf_branch_entry_bitmanip)) v << 0U) & 1U));
}
enum ulong mispred_min = cast(ulong) 0U;
enum ulong mispred_max = cast(ulong) 1U;
///
@property ulong predicted() @safe pure nothrow @nogc const
{
auto result = (perf_branch_entry_bitmanip & 2U) >> 1U;
return cast(ulong) result;
}
///
@property void predicted(ulong v) @safe pure nothrow @nogc
{
assert(v >= predicted_min,
"Value is smaller than the minimum value of bitfield 'predicted'");
assert(v <= predicted_max,
"Value is greater than the maximum value of bitfield 'predicted'");
perf_branch_entry_bitmanip = cast(typeof(perf_branch_entry_bitmanip))(
(perf_branch_entry_bitmanip & (-1 - cast(typeof(perf_branch_entry_bitmanip)) 2U)) | (
(cast(typeof(perf_branch_entry_bitmanip)) v << 1U) & 2U));
}
enum ulong predicted_min = cast(ulong) 0U;
enum ulong predicted_max = cast(ulong) 1U;
///
@property ulong in_tx() @safe pure nothrow @nogc const
{
auto result = (perf_branch_entry_bitmanip & 4U) >> 2U;
return cast(ulong) result;
}
///
@property void in_tx(ulong v) @safe pure nothrow @nogc
{
assert(v >= in_tx_min,
"Value is smaller than the minimum value of bitfield 'in_tx'");
assert(v <= in_tx_max,
"Value is greater than the maximum value of bitfield 'in_tx'");
perf_branch_entry_bitmanip = cast(typeof(perf_branch_entry_bitmanip))(
(perf_branch_entry_bitmanip & (-1 - cast(typeof(perf_branch_entry_bitmanip)) 4U)) | (
(cast(typeof(perf_branch_entry_bitmanip)) v << 2U) & 4U));
}
enum ulong in_tx_min = cast(ulong) 0U;
enum ulong in_tx_max = cast(ulong) 1U;
///
@property ulong abort() @safe pure nothrow @nogc const
{
auto result = (perf_branch_entry_bitmanip & 8U) >> 3U;
return cast(ulong) result;
}
///
@property void abort(ulong v) @safe pure nothrow @nogc
{
assert(v >= abort_min,
"Value is smaller than the minimum value of bitfield 'abort'");
assert(v <= abort_max,
"Value is greater than the maximum value of bitfield 'abort'");
perf_branch_entry_bitmanip = cast(typeof(perf_branch_entry_bitmanip))(
(perf_branch_entry_bitmanip & (-1 - cast(typeof(perf_branch_entry_bitmanip)) 8U)) | (
(cast(typeof(perf_branch_entry_bitmanip)) v << 3U) & 8U));
}
enum ulong abort_min = cast(ulong) 0U;
enum ulong abort_max = cast(ulong) 1U;
///
@property ulong cycles() @safe pure nothrow @nogc const
{
auto result = (perf_branch_entry_bitmanip & 1048560U) >> 4U;
return cast(ulong) result;
}
///
@property void cycles(ulong v) @safe pure nothrow @nogc
{
assert(v >= cycles_min,
"Value is smaller than the minimum value of bitfield 'cycles'");
assert(v <= cycles_max,
"Value is greater than the maximum value of bitfield 'cycles'");
perf_branch_entry_bitmanip = cast(typeof(perf_branch_entry_bitmanip))(
(perf_branch_entry_bitmanip & (-1 - cast(typeof(perf_branch_entry_bitmanip)) 1048560U)) | (
(cast(typeof(perf_branch_entry_bitmanip)) v << 4U) & 1048560U));
}
enum ulong cycles_min = cast(ulong) 0U;
enum ulong cycles_max = cast(ulong) 65535U;
///
@property ulong type() @safe pure nothrow @nogc const
{
auto result = (perf_branch_entry_bitmanip & 15728640U) >> 20U;
return cast(ulong) result;
}
///
@property void type(ulong v) @safe pure nothrow @nogc
{
assert(v >= type_min, "Value is smaller than the minimum value of bitfield 'type'");
assert(v <= type_max, "Value is greater than the maximum value of bitfield 'type'");
perf_branch_entry_bitmanip = cast(typeof(perf_branch_entry_bitmanip))(
(perf_branch_entry_bitmanip & (-1 - cast(typeof(perf_branch_entry_bitmanip)) 15728640U)) | (
(cast(typeof(perf_branch_entry_bitmanip)) v << 20U) & 15728640U));
}
enum ulong type_min = cast(ulong) 0U;
enum ulong type_max = cast(ulong) 15U;
///
@property ulong reserved() @safe pure nothrow @nogc const
{
auto result = (perf_branch_entry_bitmanip & 18446744073692774400UL) >> 24U;
return cast(ulong) result;
}
///
@property void reserved(ulong v) @safe pure nothrow @nogc
{
assert(v >= reserved_min,
"Value is smaller than the minimum value of bitfield 'reserved'");
assert(v <= reserved_max,
"Value is greater than the maximum value of bitfield 'reserved'");
perf_branch_entry_bitmanip = cast(typeof(perf_branch_entry_bitmanip))(
(perf_branch_entry_bitmanip & (-1 - cast(
typeof(perf_branch_entry_bitmanip)) 18446744073692774400UL)) | (
(cast(typeof(perf_branch_entry_bitmanip)) v << 24U) & 18446744073692774400UL));
}
enum ulong reserved_min = cast(ulong) 0U;
enum ulong reserved_max = cast(ulong) 1099511627775UL;
}
|