| #!/bin/sh |
| # - runtime |
| # - nr_task |
| # - iterations |
| # - test_memory_size |
| |
| ## Page Fault Test |
| # This test run in different mode, and the mode is determined by |
| # the combination of parameters. The valid combinations are as |
| # follows in which the smaller index has higher priority: |
| # 1. iterations |
| # 2. nr_task, runtime |
| # 3. nr_task, iterations |
| |
| cd "$BENCHMARK_ROOT/pft" || exit |
| |
| . "$LKP_SRC/lib/unit.sh" |
| . "$LKP_SRC/lib/sysinfo.sh" |
| . "$LKP_SRC/lib/reproduce-log.sh" |
| |
| if [ -z "$test_memory_size" ]; then |
| memory=$(to_byte "$memory") |
| pft_mapping_size=$((memory / 5)) |
| else |
| pft_mapping_size=$test_memory_size |
| fi |
| |
| if [ -z "$nr_task" ]; then |
| [ -n "$iterations" ] || { |
| echo "Error: Please specify iterations if nr_task is not specified." >&2 |
| exit 1 |
| } |
| |
| setup_threads_to_iterate |
| |
| for clients in $threads_to_iterate |
| do |
| echo "Clients: $clients" |
| for iteration in $(seq 1 "$iterations") |
| do |
| echo "Iteration: $iteration" |
| log_test ./pft -m "$pft_mapping_size" -n "$clients" -F |
| done |
| done |
| elif [ -n "$runtime" ]; then |
| iteration=1 |
| start_time=$(date +%s) |
| echo "Clients: $nr_task" |
| while :; do |
| echo "Iteration: $iteration" |
| log_test ./pft -m "$pft_mapping_size" -n "$nr_task" -F |
| now=$(date +%s) |
| [ $((now - start_time)) -gt "$runtime" ] && break |
| iteration=$((iteration + 1)) |
| done |
| elif [ -n "$iterations" ]; then |
| echo "Clients: $nr_task" |
| for iteration in $(seq 1 "$iterations") |
| do |
| echo "Iteration: $iteration" |
| log_test ./pft -m "$pft_mapping_size" -n "$nr_task" -F |
| done |
| else |
| echo "Error: Please specify the correct combination of parameters which is shown in following: |
| 1. iterations |
| 2. nr_task, runtime |
| 3. nr_task, iterations" >&2 |
| exit 1 |
| fi |
| |