### Run pcm-sensor-server on Windows Source: https://github.com/intel/pcm/blob/master/doc/PCM-EXPORTER.md Example of starting the pcm-sensor-server on Windows. Requires Administrator privileges and runs in the foreground. ```powershell # Run as Administrator pcm-sensor-server.exe -p 9738 ``` -------------------------------- ### Build and Run NUMA Node Example Source: https://github.com/intel/pcm/blob/master/doc/NUMA_NODE_API.md Compiles and runs the NUMA node example C++ code. Ensure you have the PCM library and its dependencies installed. ```bash cd examples g++ -std=c++11 -I../src numa_node_example.cpp -o numa_node_example -L../build/lib -lpcm -lpthread LD_LIBRARY_PATH=../build/lib ./numa_node_example ``` -------------------------------- ### Automatic Installation of PCM Source: https://github.com/intel/pcm/blob/master/doc/MAC_HOWTO.txt Installs PCM, loads the driver, and places libraries and headers in standard system locations. This is the recommended installation method. ```bash cd build sudo make install ``` -------------------------------- ### Install Linux Documentation Files Source: https://github.com/intel/pcm/blob/master/src/CMakeLists.txt Installs LICENSE, README.md, and other documentation files from the 'doc' directory on Linux systems. Documentation is placed in standard installation directories. ```cmake install(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION ${CMAKE_INSTALL_DATADIR}/licenses/pcm) install(FILES ${CMAKE_SOURCE_DIR}/README.md DESTINATION ${CMAKE_INSTALL_DOCDIR}) ``` ```cmake file(GLOB DOC_FILES ${CMAKE_SOURCE_DIR}/doc/*.txt ${CMAKE_SOURCE_DIR}/doc/*.md) foreach(doc_file ${DOC_FILES}) get_filename_component(doc_file_name ${doc_file} NAME) configure_file(${doc_file} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${doc_file_name} COPYONLY) install(FILES ${doc_file} DESTINATION ${CMAKE_INSTALL_DOCDIR}) endforeach(doc_file ${DOC_FILES}) ``` -------------------------------- ### Build Static Library Example Source: https://github.com/intel/pcm/blob/master/examples/CMakeLists.txt Configures a static library example executable. It links against PCM_SHARED, sets runtime paths, and defines PCM_DYNAMIC_LIB. ```cmake file(GLOB EXAMPLE_FILE c_example.c) # create static lib example add_executable(c_example ${EXAMPLE_FILE}) add_dependencies(c_example PCM_SHARED) set_target_properties(c_example PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE INSTALL_RPATH_USE_LINK_PATH TRUE INSTALL_RPATH "${CMAKE_BINARY_DIR}/lib:${INSTALL_RPATH}") # rpath to libpcm.so target_compile_definitions(c_example PRIVATE PCM_DYNAMIC_LIB) # -DPCM_DYNAMIC_LIB target_link_libraries(c_example PRIVATE Threads::Threads dl) # -pthread -ldl ``` -------------------------------- ### Install Linux Daemon and Client Executables Source: https://github.com/intel/pcm/blob/master/src/CMakeLists.txt Configures and installs the 'daemon' and 'client' executables on Linux systems. The daemon is installed to the sbin directory, and the client to the bin directory. ```cmake file(GLOB DAEMON_SOURCES "daemon/*.cpp") add_executable(daemon ${DAEMON_SOURCES}) target_link_libraries(daemon PRIVATE PCM_STATIC Threads::Threads "-fPIE") set_target_properties(daemon PROPERTIES OUTPUT_NAME "pcm-daemon") install(TARGETS daemon DESTINATION ${CMAKE_INSTALL_SBINDIR}) ``` ```cmake file(GLOB CLIENT_SOURCES "client/*.cpp") add_executable(client ${CLIENT_SOURCES}) target_link_libraries(client PRIVATE Threads::Threads "-fPIE") set_target_properties(client PROPERTIES OUTPUT_NAME "pcm-client") install(TARGETS client DESTINATION ${CMAKE_INSTALL_BINDIR}) ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/intel/pcm/blob/master/doc/generate_summary_readme.md Installs all project dependencies listed in the requirements.txt file. ```bash pip3 install -r requirements.txt ``` -------------------------------- ### Install PCM on openSUSE Source: https://github.com/intel/pcm/blob/master/README.md Install PCM tools on openSUSE systems using zypper. This command installs the PCM package from the openSUSE repositories. ```bash sudo zypper install pcm ``` -------------------------------- ### Manual Install Steps 2-4: Copy Libraries and Headers Source: https://github.com/intel/pcm/blob/master/doc/MAC_HOWTO.txt Manually copies the necessary dynamic libraries and header files to specified locations on the system path. These steps are part of the manual installation process. ```bash copy build/lib/libPcmMsr.dylib to a location on your path (auto-install uses /usr/lib) copy src/MacMSRDriver/MSRKernel.h to a location on your path (auto-install uses /usr/include) copy src/MacMSRDriver/MSRAccessorPublic.h as MSRAccessor.h to a location on your path (auto-install uses /usr/include) ``` -------------------------------- ### Build Shared Library Example Source: https://github.com/intel/pcm/blob/master/examples/CMakeLists.txt Configures a shared library example executable. It links against PCM_SHARED and the Threads library. ```cmake add_executable(c_example_shlib ${EXAMPLE_FILE}) target_link_libraries(c_example_shlib PUBLIC PCM_SHARED PRIVATE Threads::Threads) ``` -------------------------------- ### Start PCM Sensor Server Source: https://github.com/intel/pcm/blob/master/scripts/grafana/README.md Start the pcm-sensor-server as root. This command assumes you are in the 'bin' directory after building. ```bash cd bin && sudo ./pcm-sensor-server ``` -------------------------------- ### Install PCM Data Directories and Files Source: https://github.com/intel/pcm/blob/master/CMakeLists.txt Installs the 'perfmon' directory and the 'third-party-software.txt' file to the PCM data directory during the build process. ```cmake install(DIRECTORY "perfmon" DESTINATION ${CMAKE_INSTALL_DATADIR}/pcm) install(FILES "third-party-software.txt" DESTINATION ${CMAKE_INSTALL_DATADIR}/pcm) ``` -------------------------------- ### Install PcmMsrDriver KEXT Source: https://github.com/intel/pcm/blob/master/src/MacMSRDriver/PcmMsr/CMakeLists.txt Installs the PcmMsrDriver target to the system's kernel extensions directory and loads it using 'kmutil'. ```cmake set(LIB_EXT_PATH "/Library/Extensions") install(TARGETS PcmMsrDriver DESTINATION "${LIB_EXT_PATH}/") install(CODE "execute_process(COMMAND kmutil load -b com.intel.driver.PcmMsr)") ``` -------------------------------- ### Start Grafana Frontend with Single Host Source: https://github.com/intel/pcm/blob/master/scripts/grafana/README.md Start the Grafana frontend using the start.sh script. This script sets up Telegraf, InfluxDB, and Grafana containers. Replace 'target_system_address' with the actual IP or hostname of the system running pcm-sensor-server. ```bash sudo bash start.sh http://target_system_address:9738 ``` -------------------------------- ### Install PCM on Ubuntu/Debian Source: https://github.com/intel/pcm/blob/master/README.md Install PCM tools on Ubuntu or Debian-based systems using apt. This command fetches the package from the distribution's repositories. ```bash sudo apt install pcm ``` -------------------------------- ### Install pipreqs Source: https://github.com/intel/pcm/blob/master/doc/generate_summary_readme.md Installs the pipreqs tool, which is used to generate requirements.txt files. ```bash pip3 install pipreqs ``` -------------------------------- ### Manual Install Step 1: Load Driver Source: https://github.com/intel/pcm/blob/master/doc/MAC_HOWTO.txt Loads the MacMSRDriver kernel extension manually. This is the first step in the manual installation process. ```bash src/MacMSRDriver/kextload.sh ``` -------------------------------- ### CPack License and Install Directory Source: https://github.com/intel/pcm/blob/master/CMakeLists.txt Specifies the license file for the package and the default installation directory. This ensures the license is included and the installation path is set correctly. ```cmake set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") set(CPACK_RPM_PACKAGE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}) set(CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) ``` -------------------------------- ### Install PCM on RHEL/Fedora Source: https://github.com/intel/pcm/blob/master/README.md Install PCM tools on RHEL or Fedora systems using dnf or yum. These commands install the PCM package from the respective distribution's repositories. ```bash sudo dnf install pcm ``` ```bash sudo yum install pcm ``` -------------------------------- ### Build pcm-sensor-server on Windows Source: https://github.com/intel/pcm/blob/master/doc/WINDOWS_HOWTO.md Use CMake to build the pcm-sensor-server executable on Windows. Ensure the MSR driver is compiled, signed, and installed first. ```bash cmake -B build cmake --build build --config Release --target pcm-sensor-server ``` -------------------------------- ### Start Grafana Frontend with Multiple Hosts Source: https://github.com/intel/pcm/blob/master/scripts/grafana/README.md Monitor multiple hosts running pcm-sensor-server by providing a 'targets.txt' file to the start scripts. The file should list each host's IP address and PCM port on separate lines. ```bash sudo bash start.sh targets.txt ``` ```bash sudo bash start-prometheus.sh targets.txt ``` -------------------------------- ### Run pcm-sensor-server with custom port Source: https://github.com/intel/pcm/blob/master/doc/WINDOWS_HOWTO.md Start the pcm-sensor-server on a specific port using the -p option. This is useful for running multiple instances or avoiding conflicts. ```bash pcm-sensor-server.exe -p 9738 ``` -------------------------------- ### Adding Subdirectories for Build Source: https://github.com/intel/pcm/blob/master/CMakeLists.txt Includes the 'src', 'examples', and 'tests' subdirectories into the build. This allows for modular management of different parts of the project. ```cmake add_subdirectory(src) add_subdirectory(examples) add_subdirectory(tests) ``` -------------------------------- ### Configure Runtime Output Directory Source: https://github.com/intel/pcm/blob/master/examples/CMakeLists.txt Sets the directory where runtime binaries for examples will be placed. This is a global setting for the CMake project. ```cmake set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/examples) ``` -------------------------------- ### Install Linux Extra Files Source: https://github.com/intel/pcm/blob/master/src/CMakeLists.txt Installs various extra files on Linux, including shell scripts, opcode definition files, and PMU register declarations. Ensures executability for shell scripts. ```cmake install(FILES pcm-bw-histogram.sh DESTINATION ${CMAKE_INSTALL_SBINDIR} RENAME pcm-bw-histogram PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ) ``` ```cmake file(GLOB OPCODE_FILES "opCode*.txt") foreach(opcode_file ${OPCODE_FILES}) get_filename_component(opcode_file_name ${opcode_file} NAME) configure_file(${opcode_file} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${opcode_file_name} COPYONLY) install(FILES ${opcode_file} DESTINATION ${CMAKE_INSTALL_DATADIR}/pcm) endforeach(opcode_file ${OPCODE_FILES}) ``` ```cmake file(COPY "PMURegisterDeclarations" DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) install(DIRECTORY "PMURegisterDeclarations" DESTINATION ${CMAKE_INSTALL_DATADIR}/pcm) ``` -------------------------------- ### Start Grafana Frontend with Prometheus Source: https://github.com/intel/pcm/blob/master/scripts/grafana/README.md An alternative script to start Grafana frontend using Prometheus instead of InfluxDB. Replace 'target_system_address' with the actual IP or hostname. ```bash sudo bash start-prometheus.sh target_system_address:9738 ``` -------------------------------- ### Monitor IAA Counters (10 times, 1 second interval) Source: https://github.com/intel/pcm/blob/master/doc/PCM_ACCEL_README.md This example monitors IAA counters, printing the data 10 times with a 1-second interval between samples. It then exits. ```bash pcm-accel -iaa 1.0 -i=10 ``` -------------------------------- ### Example Raw Telemetry Data (CPU_CLK_UNHALTED) Source: https://github.com/intel/pcm/blob/master/doc/PCM_RAW_README.md This snippet shows a sample of raw telemetry data for the CPU_CLK_UNHALTED event. The data includes timestamps, event names, and various counter values per core/thread. ```text 2021-09-27,00:07:40.507,CPU_CLK_UNHALTED.THREAD,1000,2102078418,1723000,183219,280560,1020631,365140,344897,382467,298699,257868,256243,254471,242757,254794,251172,252091,650377,232442,234209,253807,259024,289817,275179,545244,286717,437888,392646,680513,329759,520244,333662,618356,1184347,350594,400648,630580,1517122,599939,525847,313441,2765951,405441,364827,909395,1033366,625655,1898427,325614,881026,312798,305884,325245,367890,512845,338440,1197524,516836,341497,334581,322975,283138,275031,281300,273347,284616,250171,262581,261182,267455,271097,353013,296757,1487751,282516,283651,1076725,265489,282845,260889,365411,1212743,498705,611118,1287439,360493,571158,1549944,236616,6499483,229820,762766,245338,248648,239640,406676,287582,1714659 ``` -------------------------------- ### Include CPack Module Source: https://github.com/intel/pcm/blob/master/CMakeLists.txt Includes the CPack module, which provides the functionality for creating installation packages. This command should be called after all CPack variables have been set. ```cmake include (CPack) ``` -------------------------------- ### Event File Content for Multiplexing Source: https://github.com/intel/pcm/blob/master/doc/PCM_RAW_README.md Example content for an event file used with pcm-raw to specify event groups for multiplexing. Groups are separated by a semicolon. ```text # group 1 INST_RETIRED.ANY CPU_CLK_UNHALTED.REF_TSC CPU_CLK_UNHALTED.THREAD DTLB_LOAD_MISSES.STLB_HIT L1D_PEND_MISS.PENDING_CYCLES_ANY MEM_INST_RETIRED.LOCK_LOADS UOPS_EXECUTED.X87 UNC_CHA_DIR_LOOKUP.SNP UNC_CHA_DIR_LOOKUP.NO_SNP UNC_M_CAS_COUNT.RD UNC_M_CAS_COUNT.WR UNC_UPI_CLOCKTICKS UNC_UPI_TxL_FLITS.ALL_DATA UNC_UPI_TxL_FLITS.NON_DATA UNC_UPI_L1_POWER_CYCLES ; # group 2 INST_RETIRED.ANY CPU_CLK_UNHALTED.REF_TSC CPU_CLK_UNHALTED.THREAD OFFCORE_REQUESTS_BUFFER.SQ_FULL MEM_LOAD_L3_HIT_RETIRED.XSNP_HIT MEM_LOAD_L3_HIT_RETIRED.XSNP_HITM MEM_LOAD_L3_HIT_RETIRED.XSNP_MISS UNC_CHA_DIR_UPDATE.HA UNC_CHA_DIR_UPDATE.TOR UNC_M2M_DIRECTORY_UPDATE.ANY UNC_M_CAS_COUNT.RD UNC_M_CAS_COUNT.WR UNC_M_PRE_COUNT.PAGE_MISS UNC_UPI_TxL0P_POWER_CYCLES UNC_UPI_RxL0P_POWER_CYCLES UNC_UPI_RxL_FLITS.ALL_DATA UNC_UPI_RxL_FLITS.NON_DATA ; ``` -------------------------------- ### Example Raw Telemetry Data (UOPS_EXECUTED.X87) Source: https://github.com/intel/pcm/blob/master/doc/PCM_RAW_README.md This snippet shows raw telemetry data for the UOPS_EXECUTED.X87 event, which counts micro-operations executed by the x87 FPU. This can be useful for analyzing floating-point performance. ```text 2021-09-27,00:07:40.507,UOPS_EXECUTED.X87,1000,2102078418,1152,12,13,496,46,17,27,12,11,13,10,14,11,27,12,1591,11,10,11,13,23,11,257,12,64,52,216,31,231,31,1668,5944,31,30,85,710,101,54,34,41,100,33,1852,1561,423,2348,28,46,14,23,155,57,82,172,2776,281,19,52,107,18,36,18,19,14,11,10,10,10,26,57,10,108,31,33,151,31,32,30,63,3700,361,509,4610,31,396,1814,31,5607,33,4175,31,30,32,47,78,471 ``` -------------------------------- ### Sample CSV Output from pcm-raw Source: https://github.com/intel/pcm/blob/master/doc/PCM_RAW_README.md Example of the CSV output format generated by pcm-raw, showing date, time, event name, and collected counts. ```text 2021-09-27,00:07:40.507,UNC_CHA_DIR_LOOKUP.SNP,1000,2102078418,76,70,56,91,88,75,76,158,74,60,77,81,75,74,71,95,99,95,125,87,68,136,54,91,65,84,69,46,75,100,92,68,67,70,68,80,72,88,80,76,130,71,102,98,79,73,71,109 2021-09-27,00:07:40.507,UNC_CHA_DIR_LOOKUP.NO_SNP,1000,2102078418,1218,1280,1187,1310,1268,1287,1282,1331,1265,1267,1300,1270,1258,1307,1289,1300,1410,1378,1312,1316,1367,1337,1332,1317,1584,1519,1569,1557,1483,1537,1545,1520,1562,1527,1575,1540,1530,1581,1476,1525,1610,1680,1581,1657,1565,1613,1596,1600 2021-09-27,00:07:40.507,INST_RETIRED.ANY,1000,2102078418,705400,44587,45923,238392,53910,69547,46644,46172,44740,44732,45692,44864,46105,45352,45057,217052,46511,46671,46893,46459,53739,47021,114133,46339,61649,59027,142096,48048,98178,48288,162122,474329,48046,49795,78239,425635,105512,69933,49827,48913,71549,48451,294858,312316,149586,540477,49115,55144,46788,61681,82964,81127,116227,85776,453369,145979,81007,82269,83580,73595,73355,73751,72599,47169,47767,48191,48131,48359,48621,67664,48227,532184,49686,48704,324264,48539,48795,48609,60275,518368,116077,163734,526815,50650,140337,666605,47935,1368049,47243,337542,47153,46882,46925,62373,70186,466927 2021-09-27,00:07:40.507,CPU_CLK_UNHALTED.REF_TSC,1000,2102078418,3618636,384720,589092,2143512,766752,724164,803124,627312,541548,538188,534324,509964,535164,527436,529284,1366176,488124,491820,533148,543900,608580,577920,1145172,602196,919632,824544,1429344,692916,1092756,700644,1298640,2487156,736344,841344,1324008,1855476,1260084,1104768,658308,5805324,851424,766080,1909740,2170392,1313592,3986892,683844,986832,659064,642432,682668,772128,1076628,710220,2514876,1085112,715344,700812,676452,594468,577668,590856,574056,597996,525336,551460,548520,561624,569352,741468,623196,3124212,592032,596400,2265312,556584,593124,546756,766752,2547216,1047396,1280160,2704884,525336,1200444,3255000,497700,13643700,481572,1601040,515592,523740,503664,854280,603120,2305128 ``` -------------------------------- ### Example Raw Telemetry Data (L1D_PEND_MISS.PENDING_CYCLES_ANY) Source: https://github.com/intel/pcm/blob/master/doc/PCM_RAW_README.md This snippet shows raw telemetry data for the L1D_PEND_MISS.PENDING_CYCLES_ANY event. It captures pending cycles for L1 data cache misses, providing insights into memory access latency. ```text 2021-09-27,00:07:40.507,L1D_PEND_MISS.PENDING_CYCLES_ANY,1000,2102078418,682630,81530,114229,363299,169260,134931,441644,183870,89947,95379,98135,81156,75366,77990,78734,178321,52738,53883,57241,56306,65514,94824,152070,227164,87723,80980,300491,70675,148506,70130,173723,628031,142178,161405,503099,383743,255465,317627,67134,1509172,105102,242908,300344,336683,157280,555052,84017,615357,526290,88531,117674,387708,192129,157226,451213,201430,103646,106302,112452,86251,83203,82880,80239,189044,72389,73820,75135,70746,84963,106517,168907,249006,117006,109389,320326,98291,168531,100734,206075,647276,167155,154684,495947,359092,257614,322235,78189,1473756,148139,278653,308380,343576,166510,556816,90475,306546 ``` -------------------------------- ### Example Raw Telemetry Data (MEM_INST_RETIRED.LOCK_LOADS) Source: https://github.com/intel/pcm/blob/master/doc/PCM_RAW_README.md This snippet provides raw telemetry data for the MEM_INST_RETIRED.LOCK_LOADS event, which counts retired memory instructions involving locked loads. This can indicate contention or synchronization points. ```text 2021-09-27,00:07:40.507,MEM_INST_RETIRED.LOCK_LOADS,1000,2102078418,3462,231,235,1159,259,277,239,237,236,238,236,239,238,237,237,1114,237,237,238,237,265,237,555,237,277,278,542,237,431,240,389,906,239,238,385,3973,435,280,238,238,401,238,847,1238,604,1948,238,238,235,275,266,267,428,277,1287,399,271,277,272,239,240,239,239,237,237,237,237,237,238,347,237,4266,238,238,1174,238,238,238,270,1361,526,697,1101,238,615,2172,238,4276,236,642,236,237,236,275,299,2842 ``` -------------------------------- ### Print IAA Counters in Human-Readable CSV Source: https://github.com/intel/pcm/blob/master/doc/PCM_ACCEL_README.md This example prints IAA counter data in a human-readable CSV format. The sampling interval defaults to 3 seconds. ```bash pcm-accel -iaa -csv -human-readable ``` -------------------------------- ### Example Raw Telemetry Data (DTLB_LOAD_MISSES.STLB_HIT) Source: https://github.com/intel/pcm/blob/master/doc/PCM_RAW_README.md This snippet displays raw telemetry data for the DTLB_LOAD_MISSES.STLB_HIT event. It includes similar fields to other events, showing counts related to TLB load misses and STLB hits. ```text 2021-09-27,00:07:40.507,DTLB_LOAD_MISSES.STLB_HIT,1000,2102078418,10093,1178,1186,2593,1184,1356,1182,1201,1187,1200,1191,1179,1189,1179,1177,1444,1218,1205,1158,1183,1216,1190,1789,1184,1388,1347,2207,1384,1566,1352,1541,3221,1374,1398,1580,11223,1690,1427,1398,1356,1531,1388,3429,3567,2136,2639,1354,1393,1181,1188,1457,1456,1801,1437,4698,1697,1426,1434,1418,1452,1396,1394,1434,1164,1349,1349,1356,1318,1354,1528,1349,18546,1168,1160,8935,1166,1172,1167,1194,4432,1801,2341,3152,1190,1777,4328,1178,4396,1170,1939,1199,1150,1158,1197,1187,12441 ``` -------------------------------- ### Accessing PMT Raw Telemetry Counter Source: https://github.com/intel/pcm/blob/master/doc/PCM_RAW_README.md This example demonstrates the syntax for accessing a specific PMT raw telemetry counter. It requires unique ID, sample ID, sample type, LSB, and MSB values from the Intel PMT aggregator XML. ```bash pmt/config=0x87b6fef1,config1=770,config2=0,config3=32,config4=63,name="Temperature_histogram_range_5_(50.5-57.5C)_counter_for_core_0" ``` -------------------------------- ### Example Raw Telemetry Data (UNC_UPI_L1_POWER_CYCLES) Source: https://github.com/intel/pcm/blob/master/doc/PCM_RAW_README.md This snippet displays raw telemetry data for UNC_UPI_L1_POWER_CYCLES, indicating power cycles for the L1 interface of the UPI. This metric is relevant for power consumption analysis of the interconnect. ```text 2021-09-27,00:07:40.507,UNC_UPI_L1_POWER_CYCLES,1000,2102078418,0,0,1200328715,0,0,1200283803 ``` -------------------------------- ### Example Raw Telemetry Data (UNC_UPI_TxL_FLITS.ALL_DATA) Source: https://github.com/intel/pcm/blob/master/doc/PCM_RAW_README.md This snippet displays raw telemetry data for UNC_UPI_TxL_FLITS.ALL_DATA, counting data flits transmitted over the UPI link. This metric is crucial for understanding UPI bandwidth utilization. ```text 2021-09-27,00:07:40.507,UNC_UPI_TxL_FLITS.ALL_DATA,1000,2102078418,132768,150840,0,285147,269190,0 ``` -------------------------------- ### Display Help for pcm-sensor-server Source: https://github.com/intel/pcm/blob/master/doc/PCM-EXPORTER.md Shows all available command-line options for the pcm-sensor-server. Use this to understand configuration possibilities. ```bash $ ./pcm-sensor-server --help Usage: ./pcm-sensor-server [OPTION] Valid Options: -d : Run in the background (Linux/macOS only) -p portnumber : Run on port (default port is 9738) -l|--listen address : Listen on IP address
(default: all interfaces) -r|--reset : Reset programming of the performance counters. -D|--debug level : level = 0: no debug info, > 0 increase verbosity. -R|--real-time : If possible the daemon will run with real time priority, could be useful under heavy load to stabilize the async counter fetching. (Linux only) -h|--help : This information ``` -------------------------------- ### Build PCM Sensor Server Source: https://github.com/intel/pcm/blob/master/scripts/grafana/README.md Build the pcm-sensor-server binary from the root PCM directory. Ensure you navigate to the correct directory and use make with parallel jobs for faster compilation. ```bash cd ../.. mkdir build && cd build cmake .. && make -j$(nproc) pcm-sensor-server ``` -------------------------------- ### Build numa_to_socket_example Source: https://github.com/intel/pcm/blob/master/examples/CMakeLists.txt Configures the numa_to_socket_example executable, which is built only on non-Apple Unix systems. It links against PCM_SHARED and the Threads library. ```cmake if(NOT APPLE) add_executable(numa_to_socket_example numa_to_socket_example.cpp) target_link_libraries(numa_to_socket_example PUBLIC PCM_SHARED PRIVATE Threads::Threads) endif() ``` -------------------------------- ### Navigate to Project Directory Source: https://github.com/intel/pcm/blob/master/doc/generate_summary_readme.md Changes the current directory to the PCM scripts directory. ```bash cd /path/to/pcm/scripts ``` -------------------------------- ### Build PCM Package Source: https://github.com/intel/pcm/blob/master/README.md Navigate to the build directory and execute the cpack command to create DEB or RPM packages. ```bash cd build cpack ``` -------------------------------- ### Clean Build Directory Source: https://github.com/intel/pcm/blob/master/README.md Prepare a clean build environment by removing the existing build directory. Use this for the first build or a full rebuild. ```bash cmake -E rm -rf build && cmake -E make_directory build ``` -------------------------------- ### Enable Test Signing Mode Source: https://github.com/intel/pcm/blob/master/doc/WINDOWS_HOWTO.md Enables test-signed drivers to be loaded on the system. This command must be run in an administrator command prompt. ```bash bcdedit /set testsigning on ``` -------------------------------- ### Display Help for Summary Script Source: https://github.com/intel/pcm/blob/master/doc/generate_summary_readme.md Shows the help message and available arguments for the generate_summary.py script. ```bash python3 generate_summary.py --help ``` -------------------------------- ### Show Available PCM Events Source: https://github.com/intel/pcm/blob/master/doc/PCM_RAW_README.md Use the -? flag with pcm-raw to list all available events for the processor on the system. This helps in identifying the metrics you can monitor. ```bash pcm-raw -? ``` -------------------------------- ### Build Release Configuration Source: https://github.com/intel/pcm/blob/master/README.md Build the PCM tools in Release mode on Windows and macOS. Specify the configuration to build the Release version. ```bash cmake --build . --config Release ``` -------------------------------- ### CPack General Package Information Source: https://github.com/intel/pcm/blob/master/CMakeLists.txt Sets general package information for CPack, including contact, name, and version. This information is used when generating installation packages. ```cmake set(CPACK_PACKAGE_CONTACT "intel ") set(CPACK_PACKAGE_NAME "pcm") set(CPACK_PACKAGE_VERSION "0000") ``` -------------------------------- ### Configure File Copy Source: https://github.com/intel/pcm/blob/master/tests/utests/CMakeLists.txt Copies a configuration file to the runtime output directory. ```cmake configure_file( ${CMAKE_SOURCE_DIR}/src/opCode-6-174.txt ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/opCode-6-174.txt COPYONLY ) ``` -------------------------------- ### Build PCM with CMake Source: https://github.com/intel/pcm/blob/master/doc/FREEBSD_HOWTO.txt Use CMake to configure and build the PCM tool. Ensure the build directory is created first. ```bash cmake -B build cmake --build build ``` -------------------------------- ### Uninstall MSR Driver Source: https://github.com/intel/pcm/blob/master/doc/WINDOWS_HOWTO.md Uninstalls the MSR driver if encountering issues like 'Starting MSR service failed with error 3'. A reboot may be optionally required. ```bash pcm --uninstallDriver ``` -------------------------------- ### Get NUMA Node for a PCI Device Source: https://github.com/intel/pcm/blob/master/doc/NUMA_NODE_API.md Opens a PCI device and retrieves its NUMA node ID. Use this to check if NUMA information is available for a specific device. ```cpp #include "pci.h" using namespace pcm; // Open a PCI device at segment 0, bus 0, device 0, function 0 PciHandleType handle(0, 0, 0, 0); // Get the NUMA node int32 numa_node = handle.getNUMANode(); if (numa_node >= 0) { std::cout << "Device is on NUMA node: " << numa_node << "\n"; } else { std::cout << "NUMA information not available\n"; } ``` -------------------------------- ### Run pcm-sensor-server on Windows Source: https://github.com/intel/pcm/blob/master/doc/WINDOWS_HOWTO.md Execute the pcm-sensor-server as Administrator to expose PCM metrics. The server defaults to port 9738. ```bash pcm-sensor-server.exe ``` -------------------------------- ### Example Raw Telemetry Data (UNC_UPI_TxL_FLITS.NON_DATA) Source: https://github.com/intel/pcm/blob/master/doc/PCM_RAW_README.md This snippet shows raw telemetry data for UNC_UPI_TxL_FLITS.NON_DATA, counting non-data flits transmitted over the UPI link. This can include control or other overhead traffic. ```text 2021-09-27,00:07:40.507,UNC_UPI_TxL_FLITS.NON_DATA,1000,2102078418,298203,319302,0,293389,264875,0 ``` -------------------------------- ### Targets File Format Source: https://github.com/intel/pcm/blob/master/scripts/grafana/README.md The 'targets.txt' file should list the IP address and PCM port for each target system, separated by a colon. ```properties host1_ipaddress:pcmport host2_ipaddress:pcmport . . hostn_ipaddress:pcmport ``` -------------------------------- ### Save IAA Counters to CSV (twice per second) Source: https://github.com/intel/pcm/blob/master/doc/PCM_ACCEL_README.md This example saves IAA counter values to a file named 'test.log' in CSV format. It samples the data twice per second. ```bash pcm-accel -iaa 0.5 -csv=test.log ``` -------------------------------- ### Run PCM Server Container (Limited Capabilities) Source: https://github.com/intel/pcm/blob/master/doc/DOCKER_README.md Run the Intel PCM server container with limited capabilities, avoiding privileged mode. Mounts necessary host directories and devices, and exposes port 9738. ```bash docker run -d --name pcm --cap-add=SYS_ADMIN --cap-add=SYS_RAWIO --device=/dev/cpu --device=/dev/mem -v /sys/firmware/acpi/tables/MCFG:/pcm/sys/firmware/acpi/tables/MCFG:ro -v /proc/bus/pci/:/pcm/proc/bus/pci/ -v /proc/sys/kernel/nmi_watchdog:/pcm/proc/sys/kernel/nmi_watchdog -v /sys:/sys:rw -p 9738:9738 ghcr.io/intel/pcm ``` -------------------------------- ### Setting Output Directories Source: https://github.com/intel/pcm/blob/master/CMakeLists.txt Configures the runtime and library output directories for the build. This ensures executables and libraries are placed in expected locations within the binary directory. ```cmake set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) ``` -------------------------------- ### Run Summary Generation Script Source: https://github.com/intel/pcm/blob/master/doc/generate_summary_readme.md Executes the generate_summary.py script with a specified filename and multiple arguments. ```bash python3 generate_summary.py -{argument1} -{argument2} ....-{argumentN} ``` -------------------------------- ### MSVC Macro Definition Example Source: https://github.com/intel/pcm/blob/master/AGENTS.md Illustrates a common macro definition for 'max' found in Windows headers, which conflicts with standard C++ library functions. This macro expansion is the root cause of the compilation error. ```cpp #define max(a,b) (((a) > (b)) ? (a) : (b)) ``` -------------------------------- ### Build PCM Utility with CMake Source: https://github.com/intel/pcm/blob/master/doc/WINDOWS_HOWTO.md Builds the pcm.exe utility using CMake. This command should be run from the project's root directory. ```bash cmake -B build cmake --build build --config Release --parallel ``` -------------------------------- ### Example Raw Telemetry Data (UNC_UPI_CLOCKTICKS) Source: https://github.com/intel/pcm/blob/master/doc/PCM_RAW_README.md This snippet shows raw telemetry data for UNC_UPI_CLOCKTICKS, representing clock ticks for the Uncore UPI (Ultra Path Interconnect) interface. This is useful for analyzing inter-chip communication performance. ```text 2021-09-27,00:07:40.507,UNC_UPI_CLOCKTICKS,1000,2102078418,1300347171,1300351441,1200328715,1300297715,1300303139,1200283803 ``` -------------------------------- ### Example Raw Telemetry Data (UNC_M_CAS_COUNT.WR) Source: https://github.com/intel/pcm/blob/master/doc/PCM_RAW_README.md This snippet displays raw telemetry data for the UNC_M_CAS_COUNT.WR event, counting CAS operations for memory writes. Similar to the read count, this helps in understanding memory write traffic. ```text 2021-09-27,00:07:40.507,UNC_M_CAS_COUNT.WR,1000,2102078418,58994,53007,0,0,0,0,25088,0,21901,0,0,0 ``` -------------------------------- ### Example Raw Telemetry Data (UNC_M_CAS_COUNT.RD) Source: https://github.com/intel/pcm/blob/master/doc/PCM_RAW_README.md This snippet shows raw telemetry data for the UNC_M_CAS_COUNT.RD event, which counts CAS (Column Address Strobe) operations for memory reads. This is relevant for memory controller performance analysis. ```text 2021-09-27,00:07:40.507,UNC_M_CAS_COUNT.RD,1000,2102078418,33584,0,0,0,0,40306,0,37373,0,0,0 ``` -------------------------------- ### Build PCM Tools Source: https://github.com/intel/pcm/blob/master/README.md Compile the PCM tools using CMake. This command builds all utilities and places them in the build/bin directory. ```bash cd build cmake .. cmake --build . ``` -------------------------------- ### Build pcm-service Executable Source: https://github.com/intel/pcm/blob/master/src/CMakeLists.txt Configures and builds the pcm-service executable, linking against pcm-lib and setting specific Windows properties. ```cmake file(GLOB PCM_SERVICE_SOURCES windows/PCMInstaller.cpp windows/PCMService.cpp windows/AssemblyInfo.cpp winddows/utils.cpp) add_executable(pcm-service ${PCM_SERVICE_SOURCES}) target_compile_definitions(pcm-service PRIVATE _UNICODE UNICODE _CONSOLE) set_target_properties(pcm-service PROPERTIES LINK_FLAGS "/INCREMENTAL:NO" COMMON_LANGUAGE_RUNTIME "") set_property(TARGET pcm-service PROPERTY VS_DOTNET_REFERENCES "System;System.Configuration.Install;System.Data;System.Management;System.ServiceProcess;System.Xml") target_link_libraries(pcm-service pcm-lib) ``` -------------------------------- ### Build PCM and MacMSRDriver Source: https://github.com/intel/pcm/blob/master/doc/MAC_HOWTO.txt Builds the PCM utility and the MacMSRDriver using CMake. The compiled binaries and libraries will be located in the build directory. ```bash mkdir build && cd build cmake .. && cmake --build . ``` -------------------------------- ### Configure SIMDJSON Interface Library Source: https://github.com/intel/pcm/blob/master/src/CMakeLists.txt Sets up an interface library for SIMDJSON and defines a flag indicating its applicability. ```cmake add_library(PCM_SIMDJSON INTERFACE) # interface library for simdjson set(SIMDJSON_IS_APPLICABLE TRUE) # true if simdjson can be used, default - TRUE ``` -------------------------------- ### Run PCM Server Container (GitHub) Source: https://github.com/intel/pcm/blob/master/doc/DOCKER_README.md Run the Intel PCM server container in detached mode from GitHub Container Registry. Requires root privileges and exposes port 9738. ```bash docker run -d --name pcm --privileged -p 9738:9738 ghcr.io/intel/pcm ``` -------------------------------- ### Build numa_to_socket_test Executable Source: https://github.com/intel/pcm/blob/master/tests/CMakeLists.txt Creates the numa_to_socket_test executable on Unix systems, excluding macOS. Links against Threads and PCM_STATIC. ```cmake add_executable(numa_to_socket_test numa_to_socket_test.cpp) target_link_libraries(numa_to_socket_test Threads::Threads PCM_STATIC) ``` -------------------------------- ### Set Optimized Power Mode on Linux/FreeBSD/UNIX Source: https://github.com/intel/pcm/blob/master/doc/LATENCY-OPTIMIZED-MODE.md Use this bash script to revert to Optimized Power Mode. Ensure the pcm-tpmi utility is accessible. ```bash bash bhs-power-mode.sh --optimized-power-mode ``` -------------------------------- ### Add Post-Build Custom Commands for PMURegisterDeclarations (MSVC) Source: https://github.com/intel/pcm/blob/master/src/CMakeLists.txt On MSVC, this command ensures the 'PMURegisterDeclarations' directory is created and then copies its contents to the output directory of the 'pcm-raw' target after the build. ```cmake add_custom_command(TARGET pcm-raw POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "$/PMURegisterDeclarations") add_custom_command(TARGET pcm-raw POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory "${PROJECT_SOURCE_DIR}/src/PMURegisterDeclarations" "$/PMURegisterDeclarations") ``` -------------------------------- ### Run PCM Sensor Server as Non-Root Source: https://github.com/intel/pcm/blob/master/README.md Execute the pcm-sensor-server command as a non-root user by setting environment variables directly in the command. ```bash PCM_NO_MSR=1 PCM_KEEP_NMI_WATCHDOG=1 pcm-sensor-server ``` -------------------------------- ### Clone PCM Repository Source: https://github.com/intel/pcm/blob/master/README.md Clone the PCM repository including its submodules. This is the first step to obtain the PCM source code. ```bash git clone --recursive https://github.com/intel/pcm cd pcm ``` -------------------------------- ### Build cache_verification_test Executable Source: https://github.com/intel/pcm/blob/master/tests/CMakeLists.txt Creates the cache_verification_test executable on Unix systems, excluding macOS. Links against Threads and PCM_STATIC. ```cmake add_executable(cache_verification_test cache_verification_test.cpp) target_link_libraries(cache_verification_test Threads::Threads PCM_STATIC) ``` -------------------------------- ### Add Post-Build Custom Command for Service Config (MSVC) Source: https://github.com/intel/pcm/blob/master/src/CMakeLists.txt On MSVC, this command copies the 'pcm-service.exe.config' file to the output directory of the 'pcm-service' target after the build, using 'copy_if_different'. ```cmake add_custom_command(TARGET pcm-service POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${PROJECT_SOURCE_DIR}/src/windows/pcm-service.exe.config" $) ``` -------------------------------- ### Generate requirements.txt Source: https://github.com/intel/pcm/blob/master/doc/generate_summary_readme.md Generates a requirements.txt file for the current directory using pipreqs. ```bash python3 -m pipreqs.pipreqs --encoding utf-8 . ``` -------------------------------- ### Run PCM with Environment Variables Source: https://github.com/intel/pcm/blob/master/README.md Execute the pcm command after setting specific environment variables for MSR access and NMI watchdog behavior. ```bash export PCM_NO_MSR=1 export PCM_KEEP_NMI_WATCHDOG=1 pcm ``` -------------------------------- ### Obtain Raw PMU Event Encodings with emon Source: https://github.com/intel/pcm/blob/master/doc/PCM_RAW_README.md Use the emon tool with `--dry-run -m` to find the raw PMU event encodings for desired events. This output provides the necessary configuration details for pcm-raw. ```bash # emon -C BR_MISP_RETIRED.ALL_BRANCHES,UNC_CHA_CLOCKTICKS,UNC_IIO_DATA_REQ_OF_CPU.MEM_WRITE.PART0,UNC_UPI_TxL_FLITS.NON_DATA --dry-run -m Event Set 0 BR_MISP_RETIRED.ALL_BRANCHES (PerfEvtSel0 (0x186) = 0x00000000004300c5) CC=ALL PC=0x0 UMASK=0x0 E=0x1 INT=0x0 INV=0x0 CMASK=0x0 AMT=0x0 cha Uncore Event Set 0 UNC_CHA_CLOCKTICKS (CHA Counter 0 (0xe01) = 0x0000000000400000) qpill Uncore Event Set 0 UNC_UPI_TxL_FLITS.NON_DATA (QPILL Counter 0 (0x350) = 0x0000000000409702) iio Uncore Event Set 0 UNC_IIO_DATA_REQ_OF_CPU.MEM_WRITE.PART0 (IIO Counter 0 (0xa48) = 0x0000701000400183) ``` -------------------------------- ### Parallel Build PCM Tools Source: https://github.com/intel/pcm/blob/master/README.md Accelerate the build process by utilizing multiple cores. The '--parallel' flag enables parallel compilation. ```bash cmake --build . --parallel ```