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 » 22 Nov 2015, 16:44

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?
0 x

User avatar
AF
AI Developer
Posts: 20669
Joined: 14 Sep 2004, 11:32

Re: Profiling Java AI

Post by AF » 23 Nov 2015, 14:48

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?
0 x

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

Re: Profiling Java AI

Post by aeonios » 28 Nov 2015, 18:13

It turns out it was probably because the threatmap was being redrawn every time enemyEnterLos was called. ._.
0 x

User avatar
PauloMorfeo
Posts: 2004
Joined: 15 Dec 2004, 20:53

Re: Profiling Java AI

Post by PauloMorfeo » 04 Jan 2016, 23:50

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?
0 x

DeinFreund
Posts: 12
Joined: 14 Aug 2014, 00:12

Re: Profiling Java AI

Post by DeinFreund » 09 Apr 2017, 01:36

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.
0 x

Post Reply

Return to “AI”

cron