Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
sbellem committed Sep 16, 2023
1 parent dac7bc2 commit 80bcaad
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
4 changes: 2 additions & 2 deletions hacking/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3.9"
services:
localsecret-1:
image: initc3/localsecret:d5175c9c3
image: initc3/localsecret:dac7bc254
#image: devlocalsecret
#build:
# context: ..
Expand Down Expand Up @@ -42,7 +42,7 @@ services:
- genesis:/genesis

localsecret-2:
image: initc3/localsecret:d5175c9c3
image: initc3/localsecret:dac7bc254
#image: devlocalsecret
#build:
# context: ..
Expand Down
34 changes: 24 additions & 10 deletions hacking/scripts/run_mev_demo_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ set -e

source ./scripts/mev_utils.sh

rm -f /tmp/ecall_handle_millis.log
rm -f /tmp/ecall_handle_micros.log
rm -f /tmp/ecall_handle_nanos.log

CONTRACT_ADDRESS=`cat $CONTRACT_LOC/contractAddress.txt`
CODE_HASH=`cat $CONTRACT_LOC/codeHash.txt`

Expand All @@ -22,7 +18,11 @@ echo "victim tx amount of token A = 10, expected return = 20"
echo

# use the nano benchmark logs to measure the loop only
#rm -f /tmp/ecall_init_nanos.log
rm -f /tmp/ecall_handle_nanos.log
rm -f /tmp/ecall_query_nanos.log
#touch /tmp/ecall_init_nanos.log
touch /tmp/ecall_query_nanos.log

start_time=$(date +%s%N)
cnt=0
Expand Down Expand Up @@ -111,20 +111,34 @@ done

end_time=$(date +%s%N)

ecall_time_nanos=$(awk '{ sum += $1 } END { print sum }' /tmp/ecall_handle_nanos.log)
ecall_time_millis=$( echo "$ecall_time_nanos / 1000000" | bc)
#ecall_init_time_nanos=$(awk '{ sum += $1 } END { print sum }' /tmp/ecall_init_nanos.log)
#ecall_init_time_millis=$( echo "$ecall_init_time_nanos / 1000000" | bc)
ecall_handle_time_nanos=$(awk '{ sum += $1 } END { print sum }' /tmp/ecall_handle_nanos.log)
ecall_handle_time_millis=$( echo "$ecall_handle_time_nanos / 1000000" | bc)
ecall_query_time_nanos=$(awk '{ sum += $1 } END { print sum }' /tmp/ecall_query_nanos.log)
ecall_query_time_millis=$( echo "$ecall_query_time_nanos / 1000000" | bc)
#ecalls_total_time_nanos=$( echo "$ecall_init_time_nanos + $ecall_handle_time_nanos + $ecall_query_time_nanos" | bc)
ecalls_total_time_nanos=$( echo "$ecall_handle_time_nanos + $ecall_query_time_nanos" | bc)
ecalls_total_time_millis=$( echo "$ecalls_total_time_nanos / 1000000" | bc)

total_time_nanos=$(echo "$end_time - $start_time" | bc)
total_time_millis=$(echo "$total_time_nanos / 1000000" | bc)

untrusted_time_nanos=$(echo "$total_time_nanos - $ecall_time_nanos" | bc)
untrusted_time_millis=$(echo "$total_time_millis - $ecall_time_millis" | bc)
untrusted_time_nanos=$(echo "$total_time_nanos - $ecalls_total_time_nanos" | bc)
untrusted_time_millis=$(echo "$total_time_millis - $ecalls_total_time_millis" | bc)

printf "\nTotal time spent for trial: ${total_time_nanos} nanosecs"
printf "\nEstimated time spent for (trusted) ecall_handle ${ecall_time_nanos} nanosecs"
#printf "\nEstimated time spent for (trusted) ecall_init ${ecall_init_time_nanos} nanosecs"
printf "\nEstimated time spent for (trusted) ecall_handle ${ecall_handle_time_nanos} nanosecs"
printf "\nEstimated time spent for (trusted) ecall_query ${ecall_query_time_nanos} nanosecs"
printf "\nEstimated time spent for (trusted) ecalls (handle & query) ${ecalls_total_time_nanos} nanosecs"
printf "\nEstimated time spent for untrusted code ${untrusted_time_nanos} nanosecs\n"

printf "\nTotal time spent for trial: ${total_time_millis} millisecs"
printf "\nEstimated time spent for (trusted) ecall_handle ${ecall_time_millis} millisecs"
#printf "\nEstimated time spent for (trusted) ecall_init ${ecall_init_time_millis} millisecs"
printf "\nEstimated time spent for (trusted) ecall_handle ${ecall_handle_time_millis} millisecs"
printf "\nEstimated time spent for (trusted) ecall_query ${ecall_query_time_millis} millisecs"
printf "\nEstimated time spent for (trusted) ecalls (handle & query) ${ecalls_total_time_millis} millisecs"
printf "\nEstimated time spent for untrusted code ${untrusted_time_millis} millisecs\n\n"

set_snapshot "${UNIQUE_LABEL}-${cnt}"
Expand Down

0 comments on commit 80bcaad

Please sign in to comment.