Merge pull request #140 from akopytov/2.2

Add CPU cache configuration info to pt-summary.
This commit is contained in:
Sveta Smirnova
2024-01-30 23:03:57 +03:00
committed by GitHub
6 changed files with 67 additions and 0 deletions

View File

@@ -238,6 +238,27 @@ parse_dmidecode_mem_devices () { local PTFUNCNAME=parse_dmidecode_mem_devices;
| awk -F'|' '{printf(" %-9s %-8s %-17s %-13s %-13s %-8s\n", $4, $2, $7, $3, $5, $6);}'
}
# ##############################################################################
# Parse CPU cache from the output of 'dmidecode'.
# ##############################################################################
parse_dmidecode_cache_info () { local PTFUNCNAME=parse_dmidecode_cache_info;
local file="$1"
[ -e "$file" ] || return
echo " Designation Configuration Size Associativity"
echo " ========================= ============================== ======== ======================"
sed -e '/./{H;$!d;}' \
-e 'x;/Cache Information\n/!d;' \
-e 's/: /:/g' \
-e 's/</{/g' \
-e 's/>/}/g' \
-e 's/[ \t]*\n/\n/g' \
"${file}" \
| awk -F: '/Socket Designation|Configuration|Installed Size/{printf("|%s", $2)}/^[\t ]+Associativity/{print "|" $2}' \
| awk -F'|' '{printf(" %-25s %-30s %-8s %-22s\n", $2, $3, $4, $5);}'
}
# ##############################################################################
# Parse the output of 'numactl'.
# ##############################################################################
@@ -863,6 +884,10 @@ section_Processor () {
parse_psrinfo_cpus "$data_dir/psrinfo_minus_v"
# TODO: prtconf -v actually prints the CPU model name etc.
fi
if [ -s "$data_dir/dmidecode" ]; then
parse_dmidecode_cache_info "$data_dir/dmidecode"
fi
}
section_Memory () {