Thunderbrd
C2C War Dog
This post is for the programmers here. I'll start with the discussion that Koshling and I had a long time back:
Koshling said:Ok - you'll need Chipotle enabled (I assume you generally have it anyway?) and you'll need a debug build and a spreadsheet to view the results in (I use Excel but any spreadsheet should suffice).
When running the debug version and wanted to profile a turn end enable profiling (ctrl-D as I recall pops up the window [or maybe its shift - some meta-D combo]). Tick DLL profiling and the other obvious sounding one (I forget what the exact options are). After the end-turn has completed and it's your turn again you should find the profile output file in your logs folder - it's called IFP_log.txt
It will contain multiple sections separated by header lines of the form:
These are profiles for each time slice. There will be one big one for the actual end-turn processing - basically scan down visually until you find a large section of data, which will be the one you want and then chop everything before and after it out of the file (leave its header line but remove all previous section, and remove the sections following including their starting header line). Once that is done you should be able to import it into a spreadsheet and get properly columned formatting.Code:[518965.125] Fn Time (mS) Main thread time (mS) Avg time #calls Child time Self time Parent Alternate Time
Generally I sort the spreadsheet on the 'Fn time' column, which includes time in things called from that function (so its time in a subtree rooted in each function). Hot-spots will hopefully be visible, especially comparing a save that has a performance problem to one that does not.
I said:Where do you put the Chipotle code again? It was something I read about when I was just getting setup but I've never used it because I'd perceived it as something purely for enabling Python writing mid-game.
Koshling said:Chipotle also enables tons of extra shift/ctrl combo hover texts which can be very useful when debugging to see a bit more about what is going on (for instance they tell you the unit and group ids of units, which is invaluable to know how to set breakpoints on those units when trying to debug what they do). If you search these boards for 'Chipotle' you should find what you need (and also a summary of the extra commands it enables, like autoplay and swap players etc.). It goes in your INI file:
Code:CheatCode = chipotle
Alberts2(after reading the above) said:Koshling said you have to use a debug build, but doing so could give different results as profiling a release or final release build. This is because of debug build specific code(the release build also has some of that) and compiler optimizations. This means to be sure there is a real performance problem you have to also profile at least with release build and if the same function stands out you have a winner. Profiling the debug build can be usefull to see and track the impact changes make, but to see their real life impact you have to profile the optimized build as well because that is what people use. The profiler is at the moment active in the debug and release builds but not in the final release.
I said:I had similar thoughts on the subject - but would the debug dll have that many processes that differ so greatly that it couldn't still point out hotspots with fair accuracy? I wouldn't begin to know how one would be able to turn it on for the final release vs the debug dll...
I think the conversation ended there and I have probably not done any further profiling for myself since then because well... I did not know where or how to set the define he was talking about. Perhaps someone can clarify that for me and hopefully all of this serves as a good enough start to the conversation about how to profile CivIV properly.Alberts2 said:It could differ alot in some places. You have to set the define USE_INTERNAL_PROFILER also for the final release build to enable the profiler for it.