Profiling Java AI

Profiling Java AI

Here is where ideas can be collected for the skirmish AI in development

Moderators: hoijui, Moderators

Post Reply
aeonios
Posts: 202
Joined: 03 Feb 2015, 14:27

Profiling Java AI

Post by aeonios »

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. :P Does anyone know the easiest way to set up such a thing?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Profiling Java AI

Post by AF »

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?
aeonios
Posts: 202
Joined: 03 Feb 2015, 14:27

Re: Profiling Java AI

Post by aeonios »

It turns out it was probably because the threatmap was being redrawn every time enemyEnterLos was called. ._.
User avatar
PauloMorfeo
Posts: 2004
Joined: 15 Dec 2004, 20:53

Re: Profiling Java AI

Post by PauloMorfeo »

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?
DeinFreund
Posts: 12
Joined: 14 Aug 2014, 00:12

Re: Profiling Java AI

Post by DeinFreund »

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.
Post Reply

Return to “AI”