I am facing a problem raised with legacy code that I don't know what to do.
The issue is regarding an app developed in java-swing. After several monts working on the app I have just spot it is consuming high amounts of CPU time when opening a PopupMenu based on JPopupMenu.
This Class belongs to a jar file wrapping the calls to JPopMenu. When opening that popup menu you see runing a top command that X process reaches 100% and java around 70%. The app stills looks fluent, but I was told to reduce the CPU consume. By contrast, running jconsole or jvisualvm the CPU is no more than 10%. Then... I don't understand what happens: why those high differences between top and jconsole; don't understand how to relate X process and java. Could be the rendering/ the mouse listeners? Why this Component take over the CPU and the rest of windows, the behaviour is correct?
By the way, the app is working over RHEL 7 and motif windows manager as desktop. One more thing: when trying to debug the app, eclipse stops at breakpoint and everthing freezes.
May you please give me some light to solve the problem?