Skip to content

Prototype for adding pcp to wrappers, do not push #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions general_setup
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ source ~/.bashrc
#
# Present usage information.
#
to_pcp=1
to_pcp_args=""


gs_usage_info()
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -199,4 +206,5 @@ fi
if [ $to_times_to_run -eq 0 ]; then
to_times_to_run=$iteration_default
fi

set $gen_args_back
84 changes: 84 additions & 0 deletions pcp_start
Original file line number Diff line number Diff line change
@@ -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
22 changes: 22 additions & 0 deletions pcp_stop
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions save_results
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ curdir=""
home_root=""
other_files=""
copy_dir=""
mv_dir=""
results=""
tar_file=""
test_name=""
Expand Down Expand Up @@ -66,6 +67,7 @@ ARGUMENT_LIST=(
"copy_dir"
"curdir"
"home_root"
"mv_dir"
"other_files"
"results"
"tar_file"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading