|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +TEST_FOLDERS=( |
| 4 | + "test_intra_shared_10ms_n100_m10000_l100000" |
| 5 | + "test_inter_shared_10ms_n100_m10000_l100000" |
| 6 | + "test_intra_unique_10ms_n100_m10000_l100000" |
| 7 | + "test_inter_unique_10ms_n100_m10000_l100000" |
| 8 | + |
| 9 | + "test_intra_shared_10ms_n10_m10000_l1000000" |
| 10 | + "test_inter_shared_10ms_n10_m10000_l1000000" |
| 11 | + "test_intra_unique_10ms_n10_m10000_l1000000" |
| 12 | + "test_inter_unique_10ms_n10_m10000_l1000000" |
| 13 | + |
| 14 | + "test_intra_shared_10ms_n1_m10000_l10000000" |
| 15 | + "test_inter_shared_10ms_n1_m10000_l10000000" |
| 16 | + "test_intra_unique_10ms_n1_m10000_l10000000" |
| 17 | + "test_inter_unique_10ms_n1_m10000_l10000000" |
| 18 | + |
| 19 | + # These tests below suffers of starvation |
| 20 | + # "test_intra_shared_10ms_n5_m100_l10000000" |
| 21 | + # "test_inter_shared_10ms_n5_m100_l10000000" |
| 22 | +) |
| 23 | + |
| 24 | +COMMAND_ARGUMENTS=( |
| 25 | + "-p 10 -n 100 -m 10000 -l 100000 -intra" |
| 26 | + "-p 10 -n 100 -m 10000 -l 100000" |
| 27 | + "-p 10 -n 100 -m 10000 -l 100000 -intra -unique" |
| 28 | + "-p 10 -n 100 -m 10000 -l 100000 -unique" |
| 29 | + |
| 30 | + "-p 10 -n 10 -m 10000 -l 1000000 -intra" |
| 31 | + "-p 10 -n 10 -m 10000 -l 1000000" |
| 32 | + "-p 10 -n 10 -m 10000 -l 1000000 -intra -unique" |
| 33 | + "-p 10 -n 10 -m 10000 -l 1000000 -unique" |
| 34 | + |
| 35 | + "-p 10 -n 1 -m 10000 -l 10000000 -intra" |
| 36 | + "-p 10 -n 1 -m 10000 -l 10000000" |
| 37 | + "-p 10 -n 1 -m 10000 -l 10000000 -intra -unique" |
| 38 | + "-p 10 -n 1 -m 10000 -l 10000000 -unique" |
| 39 | + |
| 40 | + # "-p 10 -n 5 -m 10000 -l 10000000 -intra" |
| 41 | + # "-p 10 -n 5 -m 10000 -l 10000000" |
| 42 | +) |
| 43 | + |
| 44 | + |
| 45 | +DESCRIPTION=( |
| 46 | + "Intraprocess, shared publish, 100 pubs/subs, 10000 messages, 100000 bytes length, 10ms period." |
| 47 | + "Interprocess, shared publish, 100 pubs/subs, 10000 messages, 100000 bytes length, 10ms period." |
| 48 | + "Intraprocess, unique publish, 100 pubs/subs, 10000 messages, 100000 bytes length, 10ms period." |
| 49 | + "Interprocess, unique publish, 100 pubs/subs, 10000 messages, 100000 bytes length, 10ms period." |
| 50 | + |
| 51 | + "Intraprocess, shared publish, 10 pubs/subs, 10000 messages, 1000000 bytes length, 10ms period." |
| 52 | + "Interprocess, shared publish, 10 pubs/subs, 10000 messages, 1000000 bytes length, 10ms period." |
| 53 | + "Intraprocess, unique publish, 10 pubs/subs, 10000 messages, 1000000 bytes length, 10ms period." |
| 54 | + "Interprocess, unique publish, 10 pubs/subs, 10000 messages, 1000000 bytes length, 10ms period." |
| 55 | + |
| 56 | + "Intraprocess, shared publish, 1 pubs/subs, 10000 messages, 10000000 bytes length, 10ms period." |
| 57 | + "Interprocess, shared publish, 1 pubs/subs, 10000 messages, 10000000 bytes length, 10ms period." |
| 58 | + "Intraprocess, unique publish, 1 pubs/subs, 10000 messages, 10000000 bytes length, 10ms period." |
| 59 | + "Interprocess, unique publish, 1 pubs/subs, 10000 messages, 10000000 bytes length, 10ms period." |
| 60 | + |
| 61 | + # "Intraprocess, shared publish, 5 pubs/subs, 10000 messages, 10000000 bytes length, 10ms period." |
| 62 | + # "Interprocess, shared publish, 5 pubs/subs, 10000 messages, 10000000 bytes length, 10ms period." |
| 63 | +) |
| 64 | + |
| 65 | +main() |
| 66 | +{ |
| 67 | + set -e |
| 68 | + parse_arguments "$@" |
| 69 | + if [[ $skip -eq 0 ]]; then |
| 70 | + run_tests |
| 71 | + fi |
| 72 | + show_results |
| 73 | +} |
| 74 | + |
| 75 | +parse_arguments() |
| 76 | +{ |
| 77 | + set -e |
| 78 | + out_dir="logs" |
| 79 | + skip=0 |
| 80 | + |
| 81 | + while [[ $# > 0 ]] |
| 82 | + do |
| 83 | + key="$1" |
| 84 | + case $key in |
| 85 | + -d|--dir) |
| 86 | + out_dir="$2" |
| 87 | + shift # past argument |
| 88 | + ;; |
| 89 | + -s|--skip) |
| 90 | + skip=1 |
| 91 | + ;; |
| 92 | + -h|--help) |
| 93 | + print_help |
| 94 | + ;; |
| 95 | + *) |
| 96 | + print_help |
| 97 | + ;; |
| 98 | + esac |
| 99 | + shift # past argument or value |
| 100 | + done |
| 101 | +} |
| 102 | + |
| 103 | +print_help() |
| 104 | +{ |
| 105 | + echo "Usage: $0 -d OUTPUT_DIR [--skip]" |
| 106 | + echo "The logs file will be generated inside OUTPUT_DIR" |
| 107 | + echo "Options:" |
| 108 | + echo -e "\t\t-s|--skip: Only posprocess and show results, skip running tests." |
| 109 | + exit 0 |
| 110 | +} |
| 111 | + |
| 112 | +run_tests() |
| 113 | +{ |
| 114 | + set -e |
| 115 | + mkdir -p $out_dir |
| 116 | + pushd $out_dir > /dev/null |
| 117 | + |
| 118 | + i=0 |
| 119 | + for folder in "${TEST_FOLDERS[@]}" |
| 120 | + do |
| 121 | + echo -e "\e[34mRunning performance test with the following configuration:\e[39m" |
| 122 | + echo -e "\e[34m\t\t${COMMAND_ARGUMENTS[i]}\e[39m" |
| 123 | + mkdir -p $folder |
| 124 | + ros2 run rclcpp_performance communication_performance -d $folder ${COMMAND_ARGUMENTS[i]} |
| 125 | + i=$i+1 |
| 126 | + echo |
| 127 | + done |
| 128 | + |
| 129 | + popd |
| 130 | +} |
| 131 | + |
| 132 | +show_results() |
| 133 | +{ |
| 134 | + set -e |
| 135 | + pushd $out_dir > /dev/null |
| 136 | + |
| 137 | + echo -e "\e[34mThe generated data will be posprocessed an showed.\e[39m" |
| 138 | + echo |
| 139 | + |
| 140 | + i=0 |
| 141 | + for folder in "${TEST_FOLDERS[@]}" |
| 142 | + do |
| 143 | + echo "Next configuration to be posprocessed:" |
| 144 | + echo -e "\t\t${COMMAND_ARGUMENTS[i]}" |
| 145 | + read -p "Press enter to posprocess and plot the results." |
| 146 | + echo |
| 147 | + ros2 run rclcpp_performance posprocess_logging -d $folder |
| 148 | + i=$i+1 |
| 149 | + done |
| 150 | + |
| 151 | + popd |
| 152 | +} |
| 153 | + |
| 154 | +main "$@" |
0 commit comments