diff --git a/general_setup b/general_setup index 007db94..38cf977 100755 --- a/general_setup +++ b/general_setup @@ -45,6 +45,8 @@ source ~/.bashrc # # Present usage information. # +to_pcp=1 +to_pcp_args="" gs_usage_info() @@ -149,6 +151,11 @@ do to_puser=$value shift 2 ;; + --pcp) + i=$((i + 2)) + to_pcp=$value + shift 2 + ;; --run_label) i=$((i + 2)) to_run_label=$value @@ -199,4 +206,5 @@ fi if [ $to_times_to_run -eq 0 ]; then to_times_to_run=$iteration_default fi + set $gen_args_back diff --git a/pcp_start b/pcp_start new file mode 100755 index 0000000..96a74a4 --- /dev/null +++ b/pcp_start @@ -0,0 +1,84 @@ +#!/bin/bash + +pcp_install() +{ + # + # Make sure PCP is installed. + # + if [ $to_pcp -eq 1 ]; then + # + # Make sure pcp is installed. + # We will have to handle different OS's eventually. + # For some reason we can not use pcp-zerconf itself. + echo here + dnf list installed pcp-zeroconf.x86_64 &> /dev/null + if [ $? -ne 0 ]; then + echo here 1 + dnf install -y pcp-zeroconf.x86_64 + fi + fi +} + +pcp_verify() +{ + cfg_file="$1" + + # Verify PMCD is running (pcp-zeroconf is installed) + pgrep pmcd > /dev/null + if [ $? != 0 ]; then + echo "PCP pmcd is not running. Is PCP installed?" + echo "Suggested syntax: sudo dnf install pcp-zeroconf" + exit 2 + fi + + # Verify primary pmlogger is not running + pgrep pmlogger > /dev/null + if [ $? == 0 ]; then + echo "Primary PCP pmlogger is running. Stopping it." + sudo systemctl stop pmlogger + fi + + # Verify user provided pmlogger.conf file exists + if [ ! -f "$cfg_file" ]; then + echo "File $cfg_file not found!" + exit 2 + fi +} + +pcp_start() +{ + echo "PCP Start" + + cfg_file="$1" + pcp_archive_dir="$2" + pcp_archive_name="$3" + + mkdir -p ${pcp_archive_dir} + +# Run PCP logger +# JTH - VERIFY success, ensure pmlogger starts + pmlogger -c ${cfg_file} -t 1 -l "${pcp_archive_dir}/pmlogger.log" "${pcp_archive_name}" & + + # Sleep 3 seconds prior to starting workload + sleep 3 + + # JTH - VERIFY success, ensure pmlogger starts + pgrep pmlogger > /dev/null + if [ $? != 0 ]; then + echo "FAILED to Start PCP pmlogger. Aborting test." + exit 2 + fi +} + +DATE=$(date -u +"%Y%m%dT%H%M%S") +ARCHIVE_DIR=$curdir/"ARCHIVE.${DATE}" +PCPARCHIVE_NAME="$ARCHIVE_DIR/coremark_archive" + +CONF_FILE="/var/lib/pcp/config/pmlogger/config.default" + +if [ $to_pcp -eq 1 ]; then + to_pcp_args="--mv_dir $ARCHIVE_DIR" + pcp_install + pcp_verify $CONF_FILE + pcp_start $CONF_FILE $ARCHIVE_DIR $PCPARCHIVE_NAME +fi diff --git a/pcp_stop b/pcp_stop new file mode 100644 index 0000000..557345f --- /dev/null +++ b/pcp_stop @@ -0,0 +1,22 @@ +#!/bin/bash +pcp_stop() +{ + echo "PCP Stop" + +# Sleep 3 seconds to have system calm down + sleep 3 + +# Stop PCP logger and pause for pmlogger to write archive + pkill -USR1 pmlogger + sleep 3 + +# JTH - VERIFY success, ensure pmlogger stops + pid=$(pgrep pmlogger) + if [ $? == 0 ]; then + echo "FAILED to Stop PCP pmlogger. PID $pid should be manually stopped" + fi +} + +$if [ $to_pcp -eq 1 ]; then + pcp_stop +fi diff --git a/save_results b/save_results index 4c3b569..8efbf07 100755 --- a/save_results +++ b/save_results @@ -25,6 +25,7 @@ curdir="" home_root="" other_files="" copy_dir="" +mv_dir="" results="" tar_file="" test_name="" @@ -66,6 +67,7 @@ ARGUMENT_LIST=( "copy_dir" "curdir" "home_root" + "mv_dir" "other_files" "results" "tar_file" @@ -107,6 +109,10 @@ while [[ $# -gt 0 ]]; do home_root=$2 shift 2 ;; + --mv_dir) + mv_dir=$2 + shift 2 + ;; --other_files) other_files=$2 shift 2 @@ -184,6 +190,9 @@ fi if [[ $copy_dir != "" ]]; then cp -R $copy_dir $RESULTS_PATH fi +if [[ $mv_dir != "" ]]; then + mv $mv_dir $RESULTS_PATH +fi if [[ $version == "" ]]; then echo tag: No version provided > $RESULTS_PATH/version else