Skip to content
Merged
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
16 changes: 12 additions & 4 deletions multiplex.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"integer_ge_zero": {
"description": "a whole number >= 0",
"args": [
"dma-latency"
"dma-latency",
"deepest-idle-state"
],
"vals": "[0-9]*$"
},
Expand All @@ -14,15 +15,16 @@
"description": "a whole number > 0",
"args": [
"duration",
"period"
"period",
"warm-up"
],
"vals": "^[1-9][0-9]*$"
},
"integer_range": {
"description": "a range of whole numbers >= 0",
"args": [
"cpus",
"housekeeping"
"house-keeping"
],
"vals": "(\\d+(-\\d+)?(,\\s*\\d+(-\\d+)?)*|\\d+(-\\d+)?)"
},
Expand All @@ -39,8 +41,14 @@
"smt"
],
"vals": "on|off"
},
"thread_type": {
"description": "thread type (user/kernel)",
"args": [
"thread"
],
"vals": "u|k"
}

}
}

125 changes: 103 additions & 22 deletions timerlat-client
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,17 @@ dump_runtime
validate_label
validate_sw_prereqs

if [ -z "${WORKLOAD_CPUS}" ]; then
exit_error "WORKLOAD_CPUS is not defined. This must be defined to run timerlat"
else
echo "WORKLOAD_CPUS: ${WORKLOAD_CPUS}"
fi
if [ -z "${HK_CPUS}" ]; then
exit_error "HK_CPUS is not defined. This must be defined to run timerlat"
else
echo "HK_CPUS: ${HK_CPUS}"
fi

no_load_balance=0
priority=""
duration=60
smt="on"
period=1000000
housekeeping=${HK_CPUS}
house_keeping=${HK_CPUS}
warm_up=""
thread=""
dma_latency=""

opts=$(getopt -q -o "" --longoptions "cpus:,housekeeping:,priority:,no-load-balance:,duration:,smt:,period:" -n "getopt.sh" -- "$@");
+opts=$(getopt -q -o "" --longoptions "cpus:,house-keeping:,priority:,no-load-balance:,duration:,smt:,period:,warm-up:,thread:,dma-latency:,deepest-idle-state:" -n "getopt.sh" -- "$@");
if [ $? -ne 0 ]; then
printf -- "\tUnrecognized option specified\n\n"
exit 1
Expand All @@ -41,9 +33,9 @@ while true; do
cpus=$1
shift;
;;
--housekeeping)
--house-keeping)
shift;
housekeeping=$1
house_keeping=$1
shift;
;;
--priority)
Expand Down Expand Up @@ -71,6 +63,26 @@ while true; do
no_load_balance=$1
shift;
;;
--warm-up)
shift;
warm_up=" --warm-up $1"
shift;
;;
--thread)
shift;
thread="-$1"
shift;
;;
--dma-latency)
shift;
dma_latency="--dma-latency $1"
shift;
;;
--deepest-idle-state)
shift;
deepest_idle_state="--deepest-idle-state $1"
shift;
;;
--)
shift;
break
Expand All @@ -81,11 +93,30 @@ while true; do
esac
done

if [ "$no_load_balance" == "1" ]; then
disable_balance $cpus_list
if [ -z "${WORKLOAD_CPUS}" ] && [ -z "${cpus}" ]; then
exit_error "Unable to auto-detect WORKLOAD_CPUS and the param 'cpus' is not specified."
fi

# adjust CPUs to use
if [ -z "${HK_CPUS}" ] && [ -z "${house_keeping}" ]; then
exit_error "Unable to auto-detect HK_CPUS and the param 'house-keeping' is not specified."
fi

# Override WORKLOAD_CPUS w/ cpus param (if defined)
if [ -n "${cpus}" ]; then
echo "'cpus' param is defined: ${cpus}"
# Cpu range to comma separated list: e.g. 1-5,10-12 ==> 1,2,3,4,5,10,11,12
cmd="${TOOLBOX_HOME}/bin/cpumask.py --cpus ${cpus}"
echo "about to run: ${cmd}"
CMD_OUTPUT=$(${cmd})
echo -e "${CMD_OUTPUT}"
WORKLOAD_CPUS=$(echo -e "${CMD_OUTPUT}" | grep cpulist | awk -F= '{print $2}')
echo "WORKLOAD_CPUS: ${WORKLOAD_CPUS}"
else
# Fallback to auto-detected WORKLOAD_CPUS list
echo "'cpus' undefined, using the auto-detected workload cpus: $WORKLOAD_CPUS."
fi

# Update WORKLOAD_CPUS smt-wise
cpu_str=""
for cpu in $(echo $WORKLOAD_CPUS | sed -e "s/,/ /g"); do
cpu_str+=" --cpu $cpu"
Expand All @@ -97,9 +128,54 @@ echo -e "${CMD_OUTPUT}"
WORKLOAD_CPUS=$(echo -e "${CMD_OUTPUT}" | grep "final cpus:" | awk '{ print $3 }')
echo "WORKLOAD_CPUS: ${WORKLOAD_CPUS}"

# Run on the workload cpus (exclude hk cpus by default)
if [ -z ${cpus} ]; then
cpus=${WORKLOAD_CPUS}
# Transform the list of comma-separated cpus into range(s) e.g. 1,2,3->1-3
cmd="${TOOLBOX_HOME}/bin/get-cpu-range.py ${WORKLOAD_CPUS}"
echo "about to run: ${cmd}"
CMD_OUTPUT=$(${cmd})
echo -e "${CMD_OUTPUT}"
WORKLOAD_CPUS=${CMD_OUTPUT}
echo "WORKLOAD_CPUS: ${WORKLOAD_CPUS}"

# Override HK_CPUS w/ house-keeping param (if defined)
if [ -n $house_keeping ]; then
echo "'house-keeping' param is defined: ${house_keeping}"
# Cpu range to comma separated list: e.g. 2-3 ==> 2,3
cmd="${TOOLBOX_HOME}/bin/cpumask.py --cpus ${house_keeping}"
echo "about to run: ${cmd}"
CMD_OUTPUT=$(${cmd})
echo -e "${CMD_OUTPUT}"
HK_CPUS=$(echo -e "${CMD_OUTPUT}" | grep cpulist | awk -F= '{print $2}')
echo "HK_CPUS: ${HK_CPUS}"
else
# fallback to auto-detected HK_CPUS
echo "'house-keeping' undefined, using the auto-detected house-keeping: $HK_CPUS."
fi

# Update HK_CPUS smt-wise
cpu_str=""
for cpu in $(echo $HK_CPUS | sed -e "s/,/ /g"); do
if [[ ",$WORKLOAD_CPUS," =~ ",$cpu," ]]; then
exit_error "House-keeping must NOT overlap with the workload cpus."
fi
cpu_str+=" --cpu $cpu"
done
cmd="${TOOLBOX_HOME}/bin/get-cpus-ordered.py --smt ${smt} ${cpu_str}"
echo "about to run: ${cmd}"
CMD_OUTPUT=$(${cmd})
echo -e "${CMD_OUTPUT}"
HK_CPUS=$(echo -e "${CMD_OUTPUT}" | grep "final cpus:" | awk '{ print $3 }')
echo "HK_CPUS: ${HK_CPUS}"

# Transform the list of comma-separated cpus into range(s) e.g. 1,2,3->1-3
cmd="${TOOLBOX_HOME}/bin/get-cpu-range.py ${HK_CPUS}"
echo "about to run: ${cmd}"
CMD_OUTPUT=$(${cmd})
echo -e "${CMD_OUTPUT}"
HK_CPUS=${CMD_OUTPUT}
echo "HK_CPUS: ${HK_CPUS}"

if [ "$no_load_balance" == "1" ]; then
disable_balance $cpus_list
fi

echo
Expand All @@ -117,7 +193,12 @@ if [ $? != 0 ]; then
exit_error "${output}"
fi

cmd="taskset -c ${WORKLOAD_CPUS} rtla timerlat top --quiet --duration ${duration}s --house-keeping ${housekeeping} --cpus ${WORKLOAD_CPUS} --period ${period} $priority"
cmd="taskset -c ${HK_CPUS},${WORKLOAD_CPUS}
rtla timerlat top
--quiet --duration ${duration}s
--house-keeping ${HK_CPUS} --cpus ${WORKLOAD_CPUS}
--period ${period}
${priority} ${warm_up} ${dma_latency} ${deepest_idle_state}"
echo "About to run: $cmd"
date +%s.%N >begin.txt
$cmd >timerlat-bin-stderrout.txt 2>&1
Expand Down
24 changes: 14 additions & 10 deletions workshop.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,23 @@
{
"name": "default",
"requirements": [
"packages",
"gettext_src",
"flex_src",
"libtraceevent_src",
"libtracefs_src",
"linux_src"
"packages"
]
}
],
"requirements": [
{
"name": "packages",
"type": "distro",
"distro_info": {
"packages": [
"rtla"
]
}
},
{
"name": "src-dependencies",
"type": "distro",
"distro_info": {
"packages": [
"python3-docutils"
Expand Down Expand Up @@ -92,11 +96,11 @@
"name": "linux_src",
"type": "source",
"source_info": {
"url": "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/snapshot/linux-6.11.tar.gz",
"filename": "linux.tar.gz",
"url": "https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.12.31.tar.xz",
"filename": "linux.tar.xz",
"commands": {
"unpack": "tar -xzf linux.tar.gz",
"get_dir": "tar -tzf linux.tar.gz | head -n 1",
"unpack": "tar -xf linux.tar.xz",
"get_dir": "tar -tf linux.tar.xz | head -n 1",
"commands": [
"cd tools/tracing/rtla; make",
"cd tools/tracing/rtla; make install",
Expand Down