mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-10-18 16:40:23 +00:00
PT-1052 include numa information in pt tool output (#547)
* PT-1052: fix for pt-summary
* Re-added fix from commit 71fae6d117
into proper place: library directory
Added tests for PT-1052 (pt-summary only)
* Fixed tests for pt-summary,
set locale for pt-summary tests, so they are not affected by user environment.
Finished tests for PT-1052
* Added fix for PT-1983 into the proper place: library file
* PT-1052: fix for pt-stalk which now includes numastat data
This commit is contained in:
@@ -332,6 +332,10 @@ collect_system_data_loop() {
|
||||
(echo $ts; df -k) >> "$d/$p-df" &
|
||||
(echo $ts; netstat -antp) >> "$d/$p-netstat" &
|
||||
(echo $ts; netstat -s) >> "$d/$p-netstat_s" &
|
||||
(echo $ts;
|
||||
for node in `ls -d /sys/devices/system/node/node*`; do
|
||||
echo `basename $node`; cat "$node/numastat"
|
||||
done) >> "$d/$p-numastat" &
|
||||
}
|
||||
|
||||
collect_mysql_data_two() {
|
||||
|
@@ -101,6 +101,7 @@ collect_system_data () { local PTFUNCNAME=collect_system_data;
|
||||
[ "$CMD_DMIDECODE" ] && $CMD_DMIDECODE > "$data_dir/dmidecode" 2>/dev/null
|
||||
|
||||
find_memory_stats "$platform" > "$data_dir/memory"
|
||||
find_numa_stats > "$data_dir/numactl"
|
||||
[ "$OPT_SUMMARIZE_MOUNTS" ] && mounted_fs_info "$platform" > "$data_dir/mounted_fs"
|
||||
raid_controller "$data_dir/dmesg_file" "$data_dir/lspci_file" >> "$data_dir/summary"
|
||||
|
||||
@@ -225,6 +226,12 @@ linux_exclusive_collection () { local PTFUNCNAME=linux_exclusive_collection;
|
||||
echo "dirtystatus $(awk '/vm.dirty_bytes/{print $3}' "$data_dir/sysctl"), $(awk '/vm.dirty_background_bytes/{print $3}' "$data_dir/sysctl")" >> "$data_dir/summary"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -e "$data_dir/numactl" ]; then
|
||||
echo "numa-available $(awk '/available/{print $2}' "$data_dir/numactl")" >> "$data_dir/summary"
|
||||
echo "numa-policy $(awk '/policy/{print $2}' "$data_dir/numactl")" >> "$data_dir/summary"
|
||||
echo "numa-preferred-node $(awk '/preferred node/{print $3}' "$data_dir/numactl")" >> "$data_dir/summary"
|
||||
fi
|
||||
|
||||
schedulers_and_queue_size "$data_dir/summary" > "$data_dir/partitioning"
|
||||
|
||||
@@ -449,6 +456,13 @@ find_memory_stats () { local PTFUNCNAME=find_memory_stats;
|
||||
fi
|
||||
}
|
||||
|
||||
find_numa_stats () { local PTFUNCNAME=find_numa_stats;
|
||||
if command -v numactl >/dev/null; then
|
||||
numactl --hardware
|
||||
numactl --show
|
||||
fi
|
||||
}
|
||||
|
||||
mounted_fs_info () { local PTFUNCNAME=mounted_fs_info;
|
||||
local platform="$1"
|
||||
|
||||
|
@@ -141,6 +141,7 @@ parse_free_minus_b () { local PTFUNCNAME=parse_free_minus_b;
|
||||
name_val "Total" $(shorten $(awk '/Mem:/{print $2}' "${file}") 1)
|
||||
name_val "Free" $(shorten $(awk '/Mem:/{print $4}' "${file}") 1)
|
||||
name_val "Used" "physical = $(shorten ${physical} 1), swap allocated = $(shorten ${swap_alloc} 1), swap used = $(shorten ${swap_used} 1), virtual = ${virtual}"
|
||||
name_val "Shared" $(shorten $(awk '/Mem:/{print $5}' "${file}") 1)
|
||||
name_val "Buffers" $(shorten $(awk '/Mem:/{print $6}' "${file}") 1)
|
||||
name_val "Caches" $(shorten $(awk '/Mem:/{print $7}' "${file}") 1)
|
||||
name_val "Dirty" "$(awk '/Dirty:/ {print $2, $3}' "${file}")"
|
||||
@@ -230,12 +231,38 @@ parse_dmidecode_mem_devices () { local PTFUNCNAME=parse_dmidecode_mem_devices;
|
||||
-e 's/>/}/g' \
|
||||
-e 's/[ \t]*\n/\n/g' \
|
||||
"${file}" \
|
||||
| awk -F: '/Size|Type|Form.Factor|Type.Detail|^[\t ]+Locator/{printf("|%s", $2)}/^[\t ]+Speed/{print "|" $2}' \
|
||||
| awk -F: '/Size|Type|Form.Factor|Type.Detail|^[\t ]+Locator|^[\t ]+Speed/{printf("|%s", $2)}/^$/{print}' \
|
||||
| sed '/^$/d' \
|
||||
| sed -e 's/No Module Installed/{EMPTY}/' \
|
||||
| sort \
|
||||
| awk -F'|' '{printf(" %-9s %-8s %-17s %-13s %-13s %-8s\n", $4, $2, $7, $3, $5, $6);}'
|
||||
}
|
||||
|
||||
# ##############################################################################
|
||||
# Parse the output of 'numactl'.
|
||||
# ##############################################################################
|
||||
parse_numactl () { local PTFUNCNAME=parse_numactl;
|
||||
local file="$1"
|
||||
|
||||
[ -e "$file" ] || return
|
||||
|
||||
# Print info about NUMA nodes
|
||||
echo " Node Size Free CPUs"
|
||||
echo " ==== ==== ==== ===="
|
||||
|
||||
sed -n -e 's/node /node/g' \
|
||||
-e '/node[[:digit:]]/p' \
|
||||
"${file}" \
|
||||
| sort -r \
|
||||
| awk '$1 == cnode {
|
||||
if (NF > 4) { for(i=3;i<=NF;i++){printf("%s ", $i)} printf "\n" }
|
||||
else { printf("%-12s", $3" "$4); }
|
||||
}
|
||||
$1 != cnode { cnode = $1; printf(" %-8s", $1); printf("%-12s", $3" "$4); }'
|
||||
|
||||
echo
|
||||
}
|
||||
|
||||
# ##############################################################################
|
||||
# Parse the output of 'ip -s link'
|
||||
# ##############################################################################
|
||||
@@ -842,6 +869,9 @@ section_Memory () {
|
||||
local platform="$1"
|
||||
local data_dir="$2"
|
||||
|
||||
local name_val_len_orig=$NAME_VAL_LEN;
|
||||
local NAME_VAL_LEN=14
|
||||
|
||||
section "Memory"
|
||||
if [ "${platform}" = "Linux" ]; then
|
||||
parse_free_minus_b "$data_dir/memory"
|
||||
@@ -867,6 +897,16 @@ section_Memory () {
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -s "$data_dir/numactl" ]; then
|
||||
name_val "Numa Nodes" "$(get_var "numa-available" "$data_dir/summary")"
|
||||
name_val "Numa Policy" "$(get_var "numa-policy" "$data_dir/summary")"
|
||||
name_val "Preferred Node" "$(get_var "numa-preferred-node" "$data_dir/summary")"
|
||||
|
||||
parse_numactl "$data_dir/numactl"
|
||||
fi
|
||||
|
||||
local NAME_VAL_LEN=$name_val_len_orig;
|
||||
|
||||
if [ -s "$data_dir/dmidecode" ]; then
|
||||
parse_dmidecode_mem_devices "$data_dir/dmidecode"
|
||||
fi
|
||||
@@ -1071,12 +1111,29 @@ report_system_summary () { local PTFUNCNAME=report_system_summary;
|
||||
"$data_dir/vmstat" \
|
||||
"$platform"
|
||||
|
||||
section "Memory management"
|
||||
report_transparent_huge_pages
|
||||
|
||||
# ########################################################################
|
||||
# All done. Signal the end so it's explicit.
|
||||
# ########################################################################
|
||||
section "The End"
|
||||
}
|
||||
|
||||
report_transparent_huge_pages () {
|
||||
|
||||
if [ -f /sys/kernel/mm/transparent_hugepage/enabled ]; then
|
||||
CONTENT_TRANSHP=$(</sys/kernel/mm/transparent_hugepage/enabled)
|
||||
STATUS_THP_SYSTEM=$(echo $CONTENT_TRANSHP | grep -cv '\[never\]')
|
||||
fi
|
||||
if [ $STATUS_THP_SYSTEM = 0 ]; then
|
||||
echo "Transparent huge pages are currently disabled on the system."
|
||||
else
|
||||
echo "Transparent huge pages are enabled."
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
# ###########################################################################
|
||||
# End report_system_info package
|
||||
# ###########################################################################
|
||||
|
Reference in New Issue
Block a user