Profiling Java AI
Moderators: hoijui, Moderators
Profiling Java AI
I've recently been working on Zero-K Graph Based AI (ZKGBAI: https://github.com/Anarchid/zkgbai) and ran across some problems with pathological (ie 1fps) lag issues. I want to profile it to see if I can track down what's eating CPU so badly, but since it's not a standalone app most approaches to profiling won't work. The most promising profiler I came across was jrat (http://jrat.sourceforge.net/), but that requires calling the ai through jrat through the jvm, which means I have no idea with spring. Does anyone know the easiest way to set up such a thing?
Re: Profiling Java AI
Your lag, can you determine its nature? Is it continuous lag, super spiky lag, regular short period spikes? The standard ingame profile should help find this, and might give clues as to what to look for if it's regular spikes.
What IDE are you using to build and run the AI?
What IDE are you using to build and run the AI?
Re: Profiling Java AI
It turns out it was probably because the threatmap was being redrawn every time enemyEnterLos was called. ._.
- PauloMorfeo
- Posts: 2004
- Joined: 15 Dec 2004, 20:53
Re: Profiling Java AI
How did you find that out? Did you do Ad Hoc profiling (ex: dump into a file the time spent inside functions X, Y and Z)? Or what did you use to profile?
-
- Posts: 12
- Joined: 14 Aug 2014, 00:12
Re: Profiling Java AI
You can simply use the NetBeans Profiler. It shows you the time spent in each method, memory usage per object and some other helpful stats. It helped me a lot in optimizing CSI.