Skip to content

Commit

Permalink
Merge tag '2024-05-21' into push-2024-05-21
Browse files Browse the repository at this point in the history
Change-Id: I5c1aead093735cd73826c00e72d8aaf35ca918e4
  • Loading branch information
rdementi committed May 22, 2024
2 parents 6ef66c4 + 6d442e9 commit 694d038
Show file tree
Hide file tree
Showing 32 changed files with 3,385 additions and 904 deletions.
30 changes: 30 additions & 0 deletions doc/PCM_RAW_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,33 @@ Sample csv output (date,time,event_name,milliseconds_between_samples,TSC_cycles_
2021-09-27,00:07:40.507,UNC_UPI_L1_POWER_CYCLES,1000,2102078418,0,0,1200328715,0,0,1200283803
```
The unit can be logical core, memory channel, CHA, etc, depending on the event type.

--------------------------------------------------------------------------------
Low-level access to Intel PMT telemetry data
--------------------------------------------------------------------------------

pcm-raw can read raw telemetry data from Intel PMT (https://github.com/intel/Intel-PMT/).

Syntax for a PMT raw telemetry counter:

```
pmt/config=<uniqueid>,config1=<sampleID>,config2=<sampleType>,config3=<lsb,config4=<msb>[,name=<description>]
```

The fields are the values for the counter from the Intel PMT aggregator XML:

* uniqueid : Intel PMT Telemetry unique identifier
* sampleID : sample ID of the counter
* sampleType counter encoding:
- 0 : Snapshot (last value reported in csv)
- non-zero : Counter (delta to last value reported in csv)
* lsb : lsb field
* msb : msb field

Example for https://github.com/intel/Intel-PMT/blob/868049006ad2770a75e5fc7526fd0c4b22438e27/xml/SPR/OOBMSM/CORE/spr_aggregator.xml#L15428:
```
pmt/config=0x87b6fef1,config1=770,config2=0,config3=32,config4=63,name="Temperature_histogram_range_5_(50.5-57.5C)_counter_for_core_0"
```

Current limitations: this feature (PMT access) is currently only available on Linux (with Intel PMT Linux driver).
44 changes: 44 additions & 0 deletions scripts/bhs-die-stat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash


echo "Intel(r) Performance Counter Monitor"
echo "Birch Stream Die Statistics Utility"
echo

# Run the pcm-tpmi command and store the output
output=$(pcm-tpmi 2 0x10 -d)

# Use a while loop to read each line of the output
echo "$output" | while read -r line; do
# Check if the line contains "Read value"
if [[ $line =~ Read\ value\ ([0-9]+)\ from\ TPMI\ ID\ 2@16\ for\ entry\ ([0-9]+)\ in\ instance\ ([0-9]+) ]]; then
# Extract the value using BASH_REMATCH
value=${BASH_REMATCH[1]}
die=${BASH_REMATCH[2]}
socket=${BASH_REMATCH[3]}

freq=$(( (value & 0x7F) * 100 ))
compute=$(( (value >> 23) & 1 ))
llc=$(( (value >> 24) & 1 ))
memory=$(( (value >> 25) & 1 ))
io=$(( (value >> 26) & 1 ))

die_type=""
if [ "$compute" -ne 0 ]; then
die_type="compute/"
fi
if [ "$llc" -ne 0 ]; then
die_type="${die_type}LLC/"
fi
if [ "$memory" -ne 0 ]; then
die_type="${die_type}memory/"
fi
if [ "$io" -ne 0 ]; then
die_type="${die_type}IO"
fi
die_type="${die_type%"${die_type##*[!\/]}"}"
str="Socket $socket die $die ($die_type) uncore frequency"
printf "%-60s: %d MHz\n" "$str" "$freq"
fi
done

2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# All pcm-* executables
set(PROJECT_NAMES pcm pcm-numa pcm-latency pcm-power pcm-msr pcm-memory pcm-tsx pcm-pcie pcm-core pcm-iio pcm-lspci pcm-pcicfg pcm-mmio pcm-tpmi pcm-raw pcm-accel)

file(GLOB COMMON_SOURCES pcm-accel-common.cpp msr.cpp cpucounters.cpp pci.cpp mmio.cpp bw.cpp utils.cpp topology.cpp debug.cpp threadpool.cpp uncore_pmu_discovery.cpp)
file(GLOB COMMON_SOURCES pcm-accel-common.cpp msr.cpp cpucounters.cpp pci.cpp mmio.cpp tpmi.cpp pmt.cpp bw.cpp utils.cpp topology.cpp debug.cpp threadpool.cpp uncore_pmu_discovery.cpp)

if (APPLE)
file(GLOB UNUX_SOURCES dashboard.cpp)
Expand Down
145 changes: 145 additions & 0 deletions src/PMURegisterDeclarations/GenuineIntel-6-AF-0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
{
"core" : {
"programmable" : {
"EventCode": {"Config": 0, "Position": 0, "Width": 8},
"UMask": {"Config": 0, "Position": 8, "Width": 8},
"User": {"Config": 0, "Position": 16, "Width": 1, "DefaultValue": 1},
"OS": {"Config": 0, "Position": 17, "Width": 1, "DefaultValue": 1},
"EdgeDetect": {"Config": 0, "Position": 18, "Width": 1},
"PinControl": {"Config": 0, "Position": 19, "Width": 1, "DefaultValue": 0},
"APICInt": {"Config": 0, "Position": 20, "Width": 1, "DefaultValue": 0},
"Enable": {"Config": 0, "Position": 22, "Width": 1, "DefaultValue": 1},
"Invert": {"Config": 0, "Position": 23, "Width": 1},
"CounterMask": {"Config": 0, "Position": 24, "Width": 8},
"MSRIndex": {
"0x1a6" : {"Config": 1, "Position": 0, "Width": 64},
"0x1a7" : {"Config": 2, "Position": 0, "Width": 64},
"0x3f6" : {"Config": 3, "Position": 0, "Width": 64},
"0x3f7" : {"Config": 4, "Position": 0, "Width": 64}
}
},
"fixed0" : {
"OS": {"Config": 0, "Position": 0, "Width": 1, "DefaultValue": 1},
"User": {"Config": 0, "Position": 1, "Width": 1, "DefaultValue": 1},
"EnablePMI": {"Config": 0, "Position": 3, "Width": 1, "DefaultValue": 0},
"EventCode": {"Config": 0, "Position": -1, "__comment": "position=-1 means field ignored"},
"UMask": {"Config": 0, "Position": -1, "__comment": "position=-1 means field ignored"},
"EdgeDetect": {"Config": 0, "Position": -1, "__comment": "position=-1 means field ignored"},
"Invert": {"Config": 0, "Position": -1, "__comment": "position=-1 means field ignored"},
"CounterMask": {"Config": 0, "Position": -1, "__comment": "position=-1 means field ignored"}
},
"fixed1" : {
"OS": {"Config": 0, "Position": 4, "Width": 1, "DefaultValue": 1},
"User": {"Config": 0, "Position": 5, "Width": 1, "DefaultValue": 1},
"EnablePMI": {"Config": 0, "Position": 7, "Width": 1, "DefaultValue": 0},
"EventCode": {"Config": 0, "Position": -1, "__comment": "position=-1 means field ignored"},
"UMask": {"Config": 0, "Position": -1, "__comment": "position=-1 means field ignored"},
"EdgeDetect": {"Config": 0, "Position": -1, "__comment": "position=-1 means field ignored"},
"Invert": {"Config": 0, "Position": -1, "__comment": "position=-1 means field ignored"},
"CounterMask": {"Config": 0, "Position": -1, "__comment": "position=-1 means field ignored"}
},
"fixed2" : {
"OS": {"Config": 0, "Position": 8, "Width": 1, "DefaultValue": 1},
"User": {"Config": 0, "Position": 9, "Width": 1, "DefaultValue": 1},
"EnablePMI": {"Config": 0, "Position": 11, "Width": 1, "DefaultValue": 0},
"EventCode": {"Config": 0, "Position": -1, "__comment": "position=-1 means field ignored"},
"UMask": {"Config": 0, "Position": -1, "__comment": "position=-1 means field ignored"},
"EdgeDetect": {"Config": 0, "Position": -1, "__comment": "position=-1 means field ignored"},
"Invert": {"Config": 0, "Position": -1, "__comment": "position=-1 means field ignored"},
"CounterMask": {"Config": 0, "Position": -1, "__comment": "position=-1 means field ignored"}
}
},
"cha" : {
"programmable" : {
"EventCode": {"Config": 0, "Position": 0, "Width": 8},
"UMask": {"Config": 0, "Position": 8, "Width": 8},
"TIDEnable": {"Config": 0, "Position": 16, "Width": 1, "DefaultValue": 0},
"EdgeDetect": {"Config": 0, "Position": 18, "Width": 1, "DefaultValue": 0},
"Threshold": {"Config": 0, "Position": 24, "Width": 8, "DefaultValue": 0},
"UMaskExt": {"Config": 0, "Position": 32, "Width": 26},
"TID": {"Config": 1, "Position": 0, "Width": 10, "DefaultValue": 0}
}
},
"imc" : {
"programmable" : {
"EventCode": {"Config": 0, "Position": 0, "Width": 8},
"UMask": {"Config": 0, "Position": 8, "Width": 8},
"EdgeDetect": {"Config": 0, "Position": 18, "Width": 1, "DefaultValue": 0},
"Threshold": {"Config": 0, "Position": 24, "Width": 8, "DefaultValue": 0}
}
},
"xpi" : {
"__comment" : "this is for UPI LL and QPI LL uncore PMUs",
"programmable" : {
"EventCode": {"Config": 0, "Position": 0, "Width": 8},
"UMask": {"Config": 0, "Position": 8, "Width": 8},
"EdgeDetect": {"Config": 0, "Position": 18, "Width": 1, "DefaultValue": 0},
"Threshold": {"Config": 0, "Position": 24, "Width": 8, "DefaultValue": 0},
"UMaskExt": {"Config": 0, "Position": 32, "Width": 24}
}
},
"m2m" : {
"programmable" : {
"EventCode": {"Config": 0, "Position": 0, "Width": 8},
"UMask": {"Config": 0, "Position": 8, "Width": 8},
"EdgeDetect": {"Config": 0, "Position": 18, "Width": 1, "DefaultValue": 0},
"Threshold": {"Config": 0, "Position": 24, "Width": 8, "DefaultValue": 0},
"UMaskExt": {"Config": 0, "Position": 32, "Width": 8}
}
},
"m3upi" : {
"programmable" : {
"EventCode": {"Config": 0, "Position": 0, "Width": 8},
"UMask": {"Config": 0, "Position": 8, "Width": 8},
"EdgeDetect": {"Config": 0, "Position": 18, "Width": 1, "DefaultValue": 0},
"Threshold": {"Config": 0, "Position": 24, "Width": 8, "DefaultValue": 0}
}
},
"mdf" : {
"programmable" : {
"EventCode": {"Config": 0, "Position": 0, "Width": 8},
"UMask": {"Config": 0, "Position": 8, "Width": 8},
"EdgeDetect": {"Config": 0, "Position": 18, "Width": 1, "DefaultValue": 0},
"Threshold": {"Config": 0, "Position": 24, "Width": 8, "DefaultValue": 0}
}
},
"irp" : {
"programmable" : {
"EventCode": {"Config": 0, "Position": 0, "Width": 8},
"UMask": {"Config": 0, "Position": 8, "Width": 8},
"EdgeDetect": {"Config": 0, "Position": 18, "Width": 1, "DefaultValue": 0},
"Threshold": {"Config": 0, "Position": 24, "Width": 8, "DefaultValue": 0}
}
},
"pcu" : {
"programmable" : {
"EventCode": {"Config": 0, "Position": 0, "Width": 8},
"UMask": {"Config": 0, "Position": 8, "Width": 8},
"EdgeDetect": {"Config": 0, "Position": 18, "Width": 1, "DefaultValue": 0}
}
},
"pciex8" : {
"programmable" : {
"EventCode": {"Config": 0, "Position": 0, "Width": 8},
"UMask": {"Config": 0, "Position": 8, "Width": 8},
"EdgeDetect": {"Config": 0, "Position": 18, "Width": 1, "DefaultValue": 0}
}
},
"pciex16" : {
"programmable" : {
"EventCode": {"Config": 0, "Position": 0, "Width": 8},
"UMask": {"Config": 0, "Position": 8, "Width": 8},
"EdgeDetect": {"Config": 0, "Position": 18, "Width": 1, "DefaultValue": 0}
}
},
"iio" : {
"programmable" : {
"EventCode": {"Config": 0, "Position": 0, "Width": 8},
"UMask": {"Config": 0, "Position": 8, "Width": 8},
"EdgeDetect": {"Config": 0, "Position": 18, "Width": 1, "DefaultValue": 0},
"Threshold": {"Config": 0, "Position": 24, "Width": 12, "DefaultValue": 0},
"PortMask": {"Config": 0, "Position": 36, "Width": 12},
"FCMask": {"Config": 0, "Position": 48, "Width": 3}
}
}
}
2 changes: 1 addition & 1 deletion src/client/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ int main(int argc, char * argv[])
printTitle("PMM Memory Mode hit rate p/Sock. ");
for (PCMDaemon::uint32 i = 0; i < counters.system.numOfOnlineSockets; ++i)
{
std::cout << std::setprecision(coutPrecision) << counters.memory.sockets[i].pmmMemoryModeHitRate << " ";
std::cout << std::setprecision(coutPrecision) << counters.memory.sockets[i].memoryModeHitRate << " ";
}
std::cout << "\n";
}
Expand Down
Loading

0 comments on commit 694d038

Please sign in to comment.