File: benchmark_write_to_file.sh

package info (click to toggle)
nodejs 20.19.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 219,072 kB
  • sloc: cpp: 1,277,408; javascript: 565,332; ansic: 129,476; python: 58,536; sh: 3,841; makefile: 2,725; asm: 1,732; perl: 248; lisp: 222; xml: 42
file content (58 lines) | stat: -rw-r--r-- 1,692 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash

echo "Benchmarking writing to file from pipe."

# Set the number of trials
num_trials=50

if [ -f "linux_files.txt" ]; then
    echo "linux_files.txt exists."
else 
    echo "downloading linux_files.txt."
    curl https://raw.githubusercontent.com/ada-url/url-various-datasets/main/files/linux_files.txt -O
fi

if [ -f "wikipedia_100k.txt" ]; then
    echo "wikipedia_100k.txt exists."
else 
    echo "downloading wikipedia_100k.txt."
    curl https://raw.githubusercontent.com/ada-url/url-various-datasets/main/wikipedia/wikipedia_100k.txt -O
fi

if [ -f "top100.txt" ]; then
    echo "top100.txt exists."
else 
    echo "downloading top100.txt."
    curl https://raw.githubusercontent.com/ada-url/url-various-datasets/main/top100/top100.txt -O
fi

# File list to benchmark against
files=("top100.txt" "linux_files.txt" "wikipedia_100k.txt" )

# Run the programs for the specified number of trials
for file in "${files[@]}"; do
  echo "Benchmarking $file"

  # Variables to store the sum of the Gb/s values for each program
  sum_fastpipespeed=0

  for i in $(seq 1 $num_trials); do
      result_fastspeed=$(cat $file | ../../build/tools/adaparse --benchmark --output test_write_speeds.txt 2>&1 | tail -1 | grep -oP '\d+(\.\d+)?') 
      sum_fastpipespeed=$(echo "$sum_fastpipespeed + $result_fastspeed" | bc)
  done

  # Compute the averages
  avg_fastpipespeed=$(echo "scale=7; $sum_fastpipespeed / $num_trials" | bc)

  # Display the results
  echo "------------------------------"
  echo "Finished benchmarking $file"
  echo "Number of trials: $num_trials"
  echo "Average Gb/s for fastpipespeed: $avg_fastpipespeed"

  echo "----------------------------"



  echo ""
done