tools/testing/selftests/amd-pstate/tbench.sh

Source file repositories/reference/linux-study-clean/tools/testing/selftests/amd-pstate/tbench.sh

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/amd-pstate/tbench.sh
Extension
.sh
Size
14533 bytes
Lines
340
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: tools
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

if ($flag == 1) {
			plot \
			"<(sed -n -e 's/,//g' -e '/${all_scaling_names[0]}-${tbench_governors[0]}/p' $OUTFILE_TBENCH.csv)" using $4:xtic(2) title "${all_scaling_names[0]}-${tbench_governors[0]}", \
			"<(sed -n -e 's/,//g' -e '/${all_scaling_names[0]}-${tbench_governors[1]}/p' $OUTFILE_TBENCH.csv)" using $4:xtic(2) title "${all_scaling_names[0]}-${tbench_governors[1]}"
		} else {
			if ($flag == 2) {
				plot \
				"<(sed -n -e 's/,//g' -e '/${all_scaling_names[1]}-${tbench_governors[0]}/p' $OUTFILE_TBENCH.csv)" using $4:xtic(2) title "${all_scaling_names[1]}-${tbench_governors[0]}", \
				"<(sed -n -e 's/,//g' -e '/${all_scaling_names[1]}-${tbench_governors[1]}/p' $OUTFILE_TBENCH.csv)" using $4:xtic(2) title "${all_scaling_names[1]}-${tbench_governors[1]}"
			} else {
				if ($flag == 3 ) {
					plot \
					"<(sed -n -e 's/,//g' -e '/${all_scaling_names[0]}-${tbench_governors[0]}/p' $OUTFILE_TBENCH.csv)" using $4:xtic(2) title "${all_scaling_names[0]}-${tbench_governors[0]}", \
					"<(sed -n -e 's/,//g' -e '/${all_scaling_names[0]}-${tbench_governors[1]}/p' $OUTFILE_TBENCH.csv)" using $4:xtic(2) title "${all_scaling_names[0]}-${tbench_governors[1]}", \
					"<(sed -n -e 's/,//g' -e '/${all_scaling_names[1]}-${tbench_governors[0]}/p' $OUTFILE_TBENCH.csv)" using $4:xtic(2) title "${all_scaling_names[1]}-${tbench_governors[0]}", \
					"<(sed -n -e 's/,//g' -e '/${all_scaling_names[1]}-${tbench_governors[1]}/p' $OUTFILE_TBENCH.csv)" using $4:xtic(2) title "${all_scaling_names[1]}-${tbench_governors[1]}"
				}
			}
		}
		quit
EOF
}

amd_pstate_tbench()
{
	printf "\n---------------------------------------------\n"
	printf "*** Running tbench                        ***"
	printf "\n---------------------------------------------\n"

	pre_clear_tbench

	get_lines_csv_tbench "Governor"
	if [ $? -eq 0 ]; then
		# add titles and unit for csv file
		store_csv_tbench "Governor" "Round" "Des-perf" "Freq" "Load" "Performance" "Energy" "Performance Per Watt"
		store_csv_tbench "Unit" "" "" "GHz" "" "MB/s" "J" "MB/J"
	fi

	backup_governor
	for governor in ${tbench_governors[*]} ; do
		printf "\nSpecified governor is $governor\n\n"
		switch_governor $governor
		loop_tbench $governor
		gather_tbench $governor
	done
	restore_governor

	plot_png_tbench "tbench_perfromance.png" "Tbench Benchmark Performance" "Performance" 6
	plot_png_tbench "tbench_energy.png" "Tbench Benchmark Energy" "Energy (J)" 7
	plot_png_tbench "tbench_ppw.png" "Tbench Benchmark Performance Per Watt" "Performance Per Watt (MB/J)" 8

	calc_comp_tbench

	post_clear_tbench
}

Annotation

Implementation Notes