(#7) Turns out profiling with Firefox is good enough, no need for legally-dubious ROMs.

This commit is contained in:
Alcaro
2018-04-10 00:37:21 +02:00
parent 40e77dd9bd
commit c214e7b577
5 changed files with 26 additions and 52 deletions

View File

@@ -833,7 +833,7 @@ struct errorinfo CreatePatch(LPCWSTR inromname, LPCWSTR outromname, enum patchty
if (errinf.level<el_notthis)
{
if (!WriteWholeFile(patchname, patch)) errinf=error(el_broken, "Couldn't write ROM. Are you on a read-only medium?");
if (!WriteWholeFile(patchname, patch)) errinf=error(el_broken, "Couldn't write patch. Are you on a read-only medium?");
}
if (patch.ptr) free(patch.ptr);
return errinf;

20
make.sh
View File

@@ -2,6 +2,17 @@
#This script creates a heavily optimized binary. For debugging, you're better off using 'make'.
if [ ! -e profile/choice ]; then
while true; do
read -p "Do you wish to use profile-guided optimization? This will download a 100MB training corpus from the internet. (y/n)" yn
case $yn in
[Yy]* ) profile/download.sh; break;;
[Nn]* ) echo n > profile/choice; break;;
* ) echo "Please answer yes or no."; exit 1;;
esac
done
fi
#clean up
rm flips flips.exe floating.zip obj/*
@@ -34,18 +45,17 @@ FLAGS=$FLAGS' -Wl,-z,relro,--as-needed,--hash-style=gnu,--relax'
#[ -e flips ] || exit
#create linux binary
if [ -e profile/smw.sfc ]; then
if [ -e profile/firefox-45.0esr.tar ]; then
echo 'GTK+ (1/3)'
rm flips; make TARGET=gtk OPTFLAGS="$FLAGS -fprofile-generate -lgcov"
[ -e flips ] || exit
rm flips; make TARGET=gtk OPTFLAGS="$FLAGS -fprofile-generate -lgcov" || exit $?
[ -e flips ] || exit 1
echo 'GTK+ (2/3)'
profile/profile.sh ./flips
echo 'GTK+ (3/3)'
rm flips; make TARGET=gtk OPTFLAGS="$FLAGS -fprofile-use"
#mv flips '~/bin/flips'
else
echo 'Warning: Missing ROMs for profiling, building without'
rm flips; make TARGET=gtk OPTFLAGS="$FLAGS"
rm flips; make TARGET=gtk OPTFLAGS="$FLAGS" || exit $?
fi
#echo Finishing

View File

@@ -1,19 +0,0 @@
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 <https://media.smwcentral.net/Alcaro/flips-profile.zip>.
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.

8
profile/download.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/sh
FX45=https://ftp.mozilla.org/pub/firefox/releases/45.0esr/linux-x86_64/en-US/firefox-45.0esr.tar.bz2
FX52=https://ftp.mozilla.org/pub/firefox/releases/52.0esr/linux-x86_64/en-US/firefox-52.0esr.tar.bz2
wget $FX45 -O- | bzcat > profile/firefox-45.0esr.tar || exit $?
wget $FX52 -O- | bzcat > profile/firefox-52.0esr.tar || exit $?
echo y > profile/choice

View File

@@ -3,30 +3,5 @@
#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
$1 --create --bps-delta profile/firefox-45.0esr.tar profile/firefox-52.0esr.tar /dev/null
$1 --create --bps-delta-moremem profile/firefox-45.0esr.tar profile/firefox-52.0esr.tar /dev/null