Commit 8d588fbc authored by Michal Berger's avatar Michal Berger Committed by Tomasz Zawadzki
Browse files

scripts/perf: Tag PM data with current run_test() instance



Add signal handler to catch USR1 and drive re-tagging of the PM data.
This should allow for a quick cross-reference while troubleshooting
target test and its potential impact on the system.

Change-Id: I6eb7ff0ed0fc4d0162db0166543a070a4ad90de4
Signed-off-by: default avatarMichal Berger <michal.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/21179


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent 3d834218
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -40,3 +40,4 @@ test_completions.txt
timing.txt
test/common/build_config.sh
.coredump_path
.run_test_name
+3 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ shopt -s nullglob extglob
pmdir=$(readlink -f "$(dirname "$0")")
rootdir=$(readlink -f "$pmdir/../../../")
source "$rootdir/test/scheduler/common.sh"
source "$pmdir/common"

help() {
	cat <<- HELP
@@ -65,4 +66,6 @@ mkdir -p "$output_dir"
cpus=("$@")
((${#cpus[@]} > 0)) || cpus=($(get_online_cpus))

trap 'retag' USR1

_get_cpu_time "$count" "" 1 "$interval" "${cpus[@]}"
+8 −4
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ shopt -s extglob nullglob
pmdir=$(readlink -f "$(dirname "$0")")
rootdir=$(readlink -f "$pmdir/../../../")
source "$rootdir/test/scheduler/common.sh"
source "$pmdir/common"

to_celsius() { echo $(($1 / 1000)); }

@@ -52,10 +53,11 @@ report_hwmon_generic() {
		label+=":${dev##*/}"
	fi

	printf '(%s) --- %s (%u C)\n' \
	printf '(%s) --- %s (%u C) (test:%s)\n' \
		"$ts" \
		"$label" \
		"$(to_celsius "$temp")"
		"$(to_celsius "$temp")" \
		"$TEST_TAG"
	printf '%s\n' "---"
}

@@ -91,10 +93,11 @@ report_hwmon_coretemp() {
	# physical_package_id and/or numa assignment (cpu_node_map[@]).
	[[ -n $node ]] || return 1

	printf '(%s) --- Node%u (%u C)\n' \
	printf '(%s) --- Node%u (%u C) (test:%s)\n' \
		"$ts" \
		"$node" \
		"$(to_celsius "${package[node]}")"
		"$(to_celsius "${package[node]}")" \
		"$TEST_TAG"

	for core in "${!cores_input[@]}"; do
		threads=($(get_cpus "$node" "$core"))
@@ -262,6 +265,7 @@ if [[ $log_to_file == yes ]]; then
fi

trap 'cleanup' EXIT
trap 'retag' USR1

init_modules "$@"

+4 −1
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ shopt -s nullglob extglob

pmdir=$(readlink -f "$(dirname "$0")")
rootdir=$(readlink -f "$pmdir/../../../")
source "$pmdir/common"

help() {
	cat <<- HELP
@@ -48,7 +49,7 @@ _vmstat() {
	while ((stat_idx = stat_idx == reprint_header ? 1 : ++stat_idx, count <= 0 ? 1 : _count--)); do
		mapfile -t vmstat < <(vmstat --timestamp)
		# Enhance output to include stuff we are most interested in
		vmstat[2]="${vmstat[2]} $(get_extra_meminfo)"
		vmstat[2]="${vmstat[2]} $(get_extra_meminfo) (test:$TEST_TAG)"
		if ((stat_idx == 1)); then
			header=("${vmstat[@]::2}")
			header[0]="${header[0]}     ----extra memory----"
@@ -88,4 +89,6 @@ declare -r log_file=${prefix:+${prefix}_}${0##*/}.pm.log

mkdir -p "$output_dir"

trap 'retag' USR1

_vmstat "$count" "$interval" "$reprint_header"

scripts/perf/pm/common

0 → 100755
+17 −0
Original line number Diff line number Diff line
#!/usr/bin/env bash
#  SPDX-License-Identifier: BSD-3-Clause
#  Copyright (C) 2023 Intel Corporation
#  All rights reserved.

_pmdir=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")
_pmrootdir=$(readlink -f "$_pmdir/../../../")

retag() {
	[[ -s $TEST_TAG_FILE ]] || return 0
	# If we got signalled but the tag didn't change, just bail
	[[ $(< "$TEST_TAG_FILE") == "$TEST_TAG" ]] && return 0
	TEST_TAG=$(< "$TEST_TAG_FILE")
}

TEST_TAG=${TEST_TAG:-N/A}
TEST_TAG_FILE=${TEST_TAG_FILE:-"$_pmrootdir/.run_test_name"}
Loading