-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
112 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
|
||
function exec-fuzzer() { | ||
# parameters: | ||
# fuzzer: should be either "lto" or "fast" | ||
# timeout: in seconds | ||
# cpu: which core to bind, default is 7 | ||
fuzzer="${1}" | ||
timeout="${2}" | ||
declare -i cpu="${3}" || 7 | ||
|
||
# last_update should look like this | ||
# [Stats #0] clients: 1, corpus: 425, objectives: 0, executions: 23597, exec/sec: 1511 | ||
last_update=$(timeout "${timeout}" taskset -c "${cpu}" ../target/release/exercise-one-solution -c "${fuzzer}" | grep Stats | tail -1) | ||
|
||
# regex + cut below will return the total # of executions | ||
total_execs=$(echo $last_update | egrep -o "executions: ([0-9]+)" | cut -f2 -d' ') | ||
|
||
execs_per_sec=$((total_execs/"${timeout}")) | ||
|
||
echo $execs_per_sec | ||
} | ||
|
||
function average_of_five_runs() { | ||
# parameters: | ||
# fuzzer: should be either "lto" or "fast" | ||
fuzzer="${1}" | ||
declare -i total_execs_per_sec=0 | ||
declare -i total_runs=5 | ||
timeout=120 | ||
|
||
for i in $(seq 1 "${total_runs}"); | ||
do | ||
current=$(exec-fuzzer "${fuzzer}" "${timeout}" $((i+1))) | ||
total_execs_per_sec=$((total_execs_per_sec+current)) | ||
echo "[${fuzzer}][${i}] - ${current} execs/sec" | ||
done | ||
|
||
final=$((total_execs_per_sec/total_runs)) | ||
echo "[${fuzzer}][avg] - ${final} execs/sec" | ||
} | ||
|
||
#average_of_five_runs fast | ||
average_of_five_runs lto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters