Changes between Version 5 and Version 6 of EngineProfiling
- Timestamp:
- Jun 23, 2013, 2:24:14 PM (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
EngineProfiling
v5 v6 68 68 == Simulation replay mode == 69 69 70 If you're not measuring graphics or GUI code, replay mode lets you run the simulation (the gameplay code and scripts and the AI etc) at maximum speed with all graphics disabled. This should be fully deterministic (i.e. you'll get the same results on each run) and doesn't need user interaction (so you can easily run in Valgrind). 70 If you're not measuring graphics or GUI code, replay mode lets you run the simulation (the gameplay code and scripts and the AI etc) at maximum speed with all graphics disabled. This should be fully deterministic (i.e. you'll get the same results on each run) and doesn't need user interaction (so you can easily run in Valgrind). It even allows you to create nice graphs for comparing the performance before and after your changes! 71 71 72 72 First, play the game normally, in either single-player or multiplayer. It will generate a file `sim_log/${PID}/commands.txt` in the game's logs path (see GameDataPaths) based on the process ID; looking for the newest directory should find it. This contains the map setup data and a list of all players' inputs, so the game can be replayed. You might want to copy the `commands.txt` to somewhere memorable. … … 78 78 (or something equivalent on Windows). It will print its status to `stdout` (or the Output window on Windows). It gives the MD5 checksum of the complete simulation state once it's finished, which is handy if you're changing the code and want to make sure you're not affecting the simulation behaviour. Run in a profiler to measure whatever you want to measure. 79 79 80 It also stores the in-game profiler state in `profile.txt` every 20 turns. There's a script in `source/tools/replayprofile/` which can plot a graph from that file. 80 === Creating graphs === 81 The replay mode also stores the in-game profiler state in `profile.txt` every 20 turns. There's a script in `source/tools/replayprofile/` which can plot a graph from that file. 82 83 1. Check source/tools/replayprofile/extract.pl if it points to the right profile.txt (you can also change it to point to another working copy, but remember not to accidentally commit this change later) 84 1. Optionally apply the [http://trac.wildfiregames.com/attachment/wiki/EngineProfiling/filter_data.diff attached patch] and define a filter for some of the events (again, don't commit your changes!) 85 1. Run perl extract.pl > data.js 86 1. Optionally make a second measurement for your modified code using the same commands.txt and extracting the data to data_1.js 87 1. Optionally copy and paste lines from data_1.js to data.js and give them a sensible name (of course you can paste as many lines from as many other data files as you want) 88 1. Open graph.html 89 90 It will look similar to this:[[BR]] 91 [[Image(profile_24_1.gif, 25%)]] 92 81 93 82 94 == Valgrind ==