From 6b807cc652544879ee4cb43ddcd384e850568f4d Mon Sep 17 00:00:00 2001 From: Alcaro Date: Sat, 7 Apr 2018 01:57:33 +0200 Subject: [PATCH] Clean up profiling script, per #7 --- make.sh | 12 +++++---- profile/README.txt | 19 +++++++++++++++ profile/profile.sh | 59 ++++++++++++++++++++++++--------------------- profile/profile1.sh | 9 ------- 4 files changed, 57 insertions(+), 42 deletions(-) create mode 100644 profile/README.txt delete mode 100755 profile/profile1.sh diff --git a/make.sh b/make.sh index 0c45680..b9d162f 100755 --- a/make.sh +++ b/make.sh @@ -1,12 +1,14 @@ +#!/bin/sh + #This script creates a heavily optimized binary. For debugging, you're better off using 'make'. #clean up -rm flips.exe floating.zip flips obj/* +rm flips flips.exe floating.zip obj/* -FLAGS='-Wall -Werror -O3 -s -flto -fomit-frame-pointer -fmerge-all-constants -fvisibility=hidden' -FLAGS+=' -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables' -FLAGS+=' -ffunction-sections -fdata-sections -Wl,--gc-sections -fprofile-dir=obj/' -FLAGS+=' -Wl,-z,relro,--as-needed,--hash-style=gnu,--relax' +FLAGS='-Wall -Werror -O3 -s -flto -fwhole-program -fweb -fomit-frame-pointer -fmerge-all-constants -fvisibility=hidden' +FLAGS=$FLAGS' -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables' +FLAGS=$FLAGS' -ffunction-sections -fdata-sections -Wl,--gc-sections -fprofile-dir=obj/' +FLAGS=$FLAGS' -Wl,-z,relro,--as-needed,--hash-style=gnu,--relax' ##create windows binary #echo 'Windows/Resource (Wine warmup)' diff --git a/profile/README.txt b/profile/README.txt new file mode 100644 index 0000000..4b6e5bf --- /dev/null +++ b/profile/README.txt @@ -0,0 +1,19 @@ +To optimally profile Floating IPS, you must provide the following files: + +sha1 filename source +c4f257b372f08c6be7e11e234bf1699cd8a34998 langrisser-eng.ups https://www.zophar.net/translations/snes/english/der-langrisser.html +5b24fa7e8fbe9e5148bd9993087ea66ff2e02f4c sm64-star.bps https://smwc.me/s/13353 +adcee2237f7e84bcba0dfa036e59001144109114 smw-2dland.bps https://smwc.me/s/6068 +466c44839b35adff8f168ddd35f7e0b0cd8a980a smw-kamek.bps https://smwc.me/s/12161 +61d14f13f66c5dadb6d9eb970888e4ec617a6447 smw-senate.bps https://smwc.me/s/6161 +5213560235ac8ae2390b4ee3f280567779ae4994 smw-smwcp.bps https://smwc.me/s/5420 +2680805f7a5c16dfa1c22b3f59eab388b700134c smw-tll.bps https://smwc.me/s/6410 +e2cb4935cfb5b442928ecad43da8b59ee5b159e4 langrisser.sfc Langrisser, Der (Japan).sfc +9bef1128717f958171a4afac3ed78ee2bb4e86ce sm64.z64 Super Mario 64 (USA).z64 +6b47bb75d16514b6a476aa0c73a683a2a4c18765 smw.sfc Super Mario World (USA).sfc + +As a convenience, the patches are available (with the expected names) at . +The ROMs (the last three files) are not, you'll have to track them down yourself. + +I'd prefer if I had a set of files that I can freely redistribute that train Flips as well as these, +but I wasn't able to find anything suitable. diff --git a/profile/profile.sh b/profile/profile.sh index 4471fc4..25cbbfc 100755 --- a/profile/profile.sh +++ b/profile/profile.sh @@ -1,29 +1,32 @@ -#sorry guys, you'll have to supply these ROMs yourself -#expected files: -# md5 crc32 filename source -# 2142a3390ea54ecbfb14caf6b707859d f3824cbe 2dland-dec2013.smc https://smwc.me/s/6068 -# 8134163af1e658a3f1af130afd66d17a 2144df1c dl.ups https://www.zophar.net/translations/snes/english/der-langrisser.html -# fa15ce41d3fd835c379d5d846707c1bd 8577d85f kamek.smc https://smwc.me/s/12161 -# 91d62c4cb790fc2fb38b10b68616e228 35f9eecc langrisser.sfc -# 77e866c718d67f28a83012b29d5501b8 ebca0fab nsmw-tll.smc https://smwc.me/s/6410 -# b278fec07b672853b9f31667ef9e1ddc bf1d7697 senate13.smc https://smwc.me/s/6161 -# 20b854b239203baf6c961b850a4a51a2 3ce60709 sm64.z64 -# 84525c7acf9f7c0d869ba1a88062dd81 b61e3965 smwcp.smc https://smwc.me/s/5420 -# dbe1f3c8f3a0b2db52b7d59417891117 a31bead4 smw.smc -# f3ae75790723c6c753c3583852b10c01 cf940969 star.z64 https://smwc.me/s/13353 -#(don't worry too much if you don't get identical checksums, the download links may have updated) +#!/bin/sh -OMP_NUM_THREADS=1 $1 --apply profile/dl.ups profile/langrisser.sfc profile/tmp -echo 1/6 -profile/profile1.sh "$1" profile/smw.smc profile/2dland-dec2013.smc -echo 2/6 -profile/profile1.sh "$1" profile/smw.smc profile/smwcp.smc -echo 3/6 -profile/profile1.sh "$1" profile/smw.smc profile/nsmw-tll.smc -echo 4/6 -profile/profile1.sh "$1" profile/smw.smc profile/senate13.smc -echo 5/6 -profile/profile1.sh "$1" profile/smw.smc profile/kamek.smc -echo 6/6 -profile/profile1.sh "$1" profile/sm64.z64 profile/star.z64 -rm profile/tmp +#profiling plus threading tends to act weirdly, disable it +export OMP_NUM_THREADS=1 + +FLIPS=$1 +TEMP=$(mktemp) + +profile_one() +{ +echo "$1/7" +SRC=$2 +$FLIPS --apply $3 $SRC $TEMP +$FLIPS --create --bps-delta $SRC $TEMP $TEMP +$FLIPS --apply $TEMP $SRC $TEMP +$FLIPS --create --bps-delta-moremem $SRC $TEMP $TEMP +$FLIPS --apply $TEMP $SRC $TEMP +$FLIPS --create --bps-linear $SRC $TEMP $TEMP +$FLIPS --apply $TEMP $SRC $TEMP +$FLIPS --create --ips $SRC $TEMP $TEMP +$FLIPS --apply $TEMP $SRC $TEMP +} + +profile_one 1 profile/smw.sfc profile/smw-2dland.bps +profile_one 2 profile/smw.sfc profile/smw-kamek.bps +profile_one 3 profile/smw.sfc profile/smw-senate.bps +profile_one 4 profile/smw.sfc profile/smw-smwcp.bps +profile_one 5 profile/smw.sfc profile/smw-tll.bps +profile_one 6 profile/langrisser.sfc profile/langrisser-eng.ups +profile_one 7 profile/sm64.z64 profile/sm64-star.bps + +rm $TEMP diff --git a/profile/profile1.sh b/profile/profile1.sh deleted file mode 100755 index e4f237d..0000000 --- a/profile/profile1.sh +++ /dev/null @@ -1,9 +0,0 @@ -OMP_NUM_THREADS=1 $1 --create --ips $2 $3 profile/tmp -OMP_NUM_THREADS=1 $1 --apply --ips profile/tmp $2 profile/tmp - -OMP_NUM_THREADS=1 $1 --create --bps-linear $2 $3 profile/tmp -OMP_NUM_THREADS=1 $1 --apply --bps-linear profile/tmp $2 profile/tmp - -OMP_NUM_THREADS=1 $1 --create --bps-delta $2 $3 profile/tmp -OMP_NUM_THREADS=1 $1 --create --bps-delta-moremem $2 $3 profile/tmp -OMP_NUM_THREADS=1 $1 --apply --bps-delta profile/tmp $2 profile/tmp