How to turn on logging for AWT
I have a performance p开发者_如何转开发roblem that makes mouse events stack up in a strange way. My profiling tool says that the AWT thread is very occupied all the time. I wonder if there is some smart way (e.g. setting some value in a properties file or something) to make the AWT thread spit out detailed log messages about what it is doing.
You can use AspectJ to 'annotate' method calls. However it very likely makes more sense to use a profiler. Or the "the profiler" that comes with your JDK.
I do not know who this log will be informative. I have just tried to look for usage of logger into AWT classes and did not see anything.
But I probably have other idea for you.
Connect to event queue using Toolkit.getDefaultToolkit().addAWTEventListener(listener, eventMask)
. Print events to log file. Probably you will see what kind of events take more time.
精彩评论