Rivroner
17/12/2007, 13:12
Pues esto es de hace ya unos meses pero por si a algún programador español se le ha escapado por no leer gp32x pues lo pongo para que se puedan aprovechar de él; igual la nueva versión de MetalBrain del GP2Xpectrum o la nueva del PocketSnes de Headoverheels puedan beneficiarse de esto :) AL igual que futuras versiones de emuladores como el FBA o el GP2XEngine y cualquier juego homebrew de cualquier programador :)
Reviving this thread to tell that I am using -fprofile-use and -fprofile-generate for quite some time now. It is giving ~20% improvement to recent uae4all builds, for example.
But there is one thing: it is quite important to do those profiling runs on GP2X itself. It doesn't require to port your program to PC and avoids all those CRC errors. The only problem is that you need Linux box to do it properly. It might be doable using cygwin, though.
Here is the method I am using, step by step:
1. If you havent already done so, install open2x toolchain to your linux box. You may also need a prebuilt library pack
2. Make a directory on your Linux box which can be made on your GP2X too. I use "sudo mkdir -p /mnt/sd/tmp", "chown notaz /mnt/sd/tmp"
3. Copy you whole sourcecode there. Add "-fprofile-generate" option to your compile flags. Make sure it gets passed to both compiling c/cpp files and the linking phase.
4. Clean old .o files, if there are any and recompile. This should create a bunch of .gcno files along with usual .o ones.
5. Copy the resulting binary from /mnt/sd/tmp on your PC to /mnt/sd/tmp on GP2X. It's important that the paths match, because full path is now embedded into the binary and will be used for the output profiling data files. You don't need to copy any .gcno files.
6. Run your newly built program on GP2X. If it's an emulator, load some heavy titles, which cause most slowdowns. I mostly load up 3-4 games and play every of them for a minute or two. Note that your program will run very slow, because it is also collecting profiling data, along with doing what it was meant to (or not smile.gif).
7. Exit your program. Do not kill it. Oh heck, I almost forgot. Make sure your program doesn't run the menu on exit (my emus have a command line option for this), or else it won't produce needed files. If everything went right, you now should have a bunch of *.gcda files in your GP2X /mnt/sd/tmp directory (and sub-dirs, if your source tree is more complicated).
8. Copy all those *.gcda files from GP2X /mnt/sd/tmp to your PC's /mnt/sd/tmp. They should be paired with *.gcno files, if you sort them by name.
9. Open up your Makefile again and change all "-fprofile-generate" to "-fprofile-use". Do not change any other compile options.
10. Clean your old .o files again (but do not kill .gcno and .gcda)
11. Recompile
Now you should have your optimized binary. It depends on your program itself how much better it performs. For example, PicoDrive doesn't perform much better with genesis games (as rendering code is asm anyway), but Sega CD scaling/rotation chip code performs much better (maybe 50% improvement?).
Si tenéis algún problema para hacerlo funcionar igual en este hilo os ayudan ;) :
http://www.gp32x.com/board/index.php?showtopic=28490&hl=gcc%20dynamic%20profiling&st=15
:lovegp2x:
Reviving this thread to tell that I am using -fprofile-use and -fprofile-generate for quite some time now. It is giving ~20% improvement to recent uae4all builds, for example.
But there is one thing: it is quite important to do those profiling runs on GP2X itself. It doesn't require to port your program to PC and avoids all those CRC errors. The only problem is that you need Linux box to do it properly. It might be doable using cygwin, though.
Here is the method I am using, step by step:
1. If you havent already done so, install open2x toolchain to your linux box. You may also need a prebuilt library pack
2. Make a directory on your Linux box which can be made on your GP2X too. I use "sudo mkdir -p /mnt/sd/tmp", "chown notaz /mnt/sd/tmp"
3. Copy you whole sourcecode there. Add "-fprofile-generate" option to your compile flags. Make sure it gets passed to both compiling c/cpp files and the linking phase.
4. Clean old .o files, if there are any and recompile. This should create a bunch of .gcno files along with usual .o ones.
5. Copy the resulting binary from /mnt/sd/tmp on your PC to /mnt/sd/tmp on GP2X. It's important that the paths match, because full path is now embedded into the binary and will be used for the output profiling data files. You don't need to copy any .gcno files.
6. Run your newly built program on GP2X. If it's an emulator, load some heavy titles, which cause most slowdowns. I mostly load up 3-4 games and play every of them for a minute or two. Note that your program will run very slow, because it is also collecting profiling data, along with doing what it was meant to (or not smile.gif).
7. Exit your program. Do not kill it. Oh heck, I almost forgot. Make sure your program doesn't run the menu on exit (my emus have a command line option for this), or else it won't produce needed files. If everything went right, you now should have a bunch of *.gcda files in your GP2X /mnt/sd/tmp directory (and sub-dirs, if your source tree is more complicated).
8. Copy all those *.gcda files from GP2X /mnt/sd/tmp to your PC's /mnt/sd/tmp. They should be paired with *.gcno files, if you sort them by name.
9. Open up your Makefile again and change all "-fprofile-generate" to "-fprofile-use". Do not change any other compile options.
10. Clean your old .o files again (but do not kill .gcno and .gcda)
11. Recompile
Now you should have your optimized binary. It depends on your program itself how much better it performs. For example, PicoDrive doesn't perform much better with genesis games (as rendering code is asm anyway), but Sega CD scaling/rotation chip code performs much better (maybe 50% improvement?).
Si tenéis algún problema para hacerlo funcionar igual en este hilo os ayudan ;) :
http://www.gp32x.com/board/index.php?showtopic=28490&hl=gcc%20dynamic%20profiling&st=15
:lovegp2x: