In light of your first set of comments, I dived in and just felt around the UI as it bore little resemblance to the document. As you point out, I did get the offer to do an initial calibration when I first asked to do a profile. Fortunately, I did not see the issues you reported below and as a novice to this tool, can’t be of much help as to interpreting your exceptions. The profiler did present views for each of its options in the drop-down (part of Profile button) and found the ‘Method’ option to be the most useful. I had deliberately, during coding, left a sequential scan within the code that I knew needed optimising to see if the Profiler would spot it. The good news is that it did and reported that most of the time was spent inside this method. I was optimistically hoping to see a count for each line of code visited as that would be ideal for my analysis, as given a specific test set of data, I know how often I am expecting each piece of code to be executed and so if the number of iterations were high then I could investigate further. The ‘hot spots’ icon allowing a quick drill down into the methods and sorting them by the time spent within each method. I did find a column for the number of ‘hits’, as opposed to Total Time, by selecting the drop down arrow on the far right hand side. However, the number presented was meaningless to me as was way too low. To prove this, I wrote my own debug method to log iterations for specific methods to evaluate a true figure. For example, a method ‘FindDuplicateRow’ reported 403 hits, yet by counting the number of executions of this method I had 48,219! So, while my initial requirement was not met (number of times each line of code executed), the time spent in each of the main methods at least gave an indicator of where inefficiencies may be. When I first looked around, I can see that there are several plugins to purchase but as a amateur developer, I can’t justify the expense and so this built in one is probably a reasonable substitute. The only issue that I have currently discovered is that it appears that you can profile a specific class or method, which the online documentation also discusses. The UI for this is very clean (right click the suspect routine and select ‘Profile method’ or ‘Profile class’) but if I then run the profiler again, it runs but never displays anything, regardless of what method / class I pick and so I can only profile the whole project. The Output window appears to think that everything is not as it should be as I get the following output with several ‘Profiler engine warning: ...’ messages (see below) -------------< com.propertymanagement:propertyManagement >-------------- Building propertyManagement 1.0 --------------------------------[ jar ]--------------------------------- --- exec-maven-plugin:3.0.0:exec (default-cli) @ propertyManagement --- Profiler Agent: Waiting for connection on port 5140, timeout 10 seconds (Protocol version: 18) Profiler Agent: Established connection with the tool *** Profiler engine warning: Cannot use ClassLoader.findLoadedClass() and/or ClassLoader.findBootstrapClass() in ClassLoaderManager Profiler Agent: Local accelerated session Profiler Agent: Initializing... Profiler Agent: Options: >C:\Development\Netbeans\Netbeans-12.6\profiler\lib,5140,10< Profiler Agent: Initialized successfully Profiler Agent: 250 classes cached. Profiler Agent: 250 classes cached. Profiler Agent: 250 classes cached. Profiler Agent: 250 classes cached. Profiler Agent: 250 classes cached. Loaded the database configuration for C:\Development\Work\PropertyManagement\Configuration\Configuration.json Read the database dictionary for propertyManagement 0:00:00.044.502500 [Elapsed 0:00:00.044.502500] Published database dictionary for propertyManagement 0:00:00.054.744300 [Elapsed 0:00:00.099.246800] Import data from c:\PropertyManagement\ 0:00:00.002.900500 [Elapsed 0:00:00.102.147300] *** Profiler engine warning: class java.security.AllPermissionCollection loaded by *** Profiler Agent Communication Thread *** Profiler engine warning: class jdk.internal.reflect.GeneratedMethodAccessor1 loaded by *** Profiler Agent Communication Thread *** Profiler engine warning: class jdk.internal.reflect.GeneratedMethodAccessor2 loaded by *** Profiler Agent Communication Thread Import data complete 0:00:36.330.365900 [Elapsed 0:00:37.207.295700] Execution time: 0:00:37.207.452500 Debug messages for [SQL statement] written to c:\Log\PropertyManagement.log Profiler Agent: Connection with agent closed Profiler Agent: Connection with agent closed Profiler Agent: 250 classes cached. ------------------------------------------------------------------------ BUILD SUCCESS ------------------------------------------------------------------------ Total time: 47.465 s Finished at: 2022-01-29T20:56:58Z ------------------------------------------------------------------------ Now time to go and optimise my sequential scan! John From: Peter Ream I found this intriguing. I know nothing about “profiling”, but thought this was a good opportunity to learn something new. I started reading the tutorial, and with Michael’s help was able to get started, but cannot get through calibration. See attached messages.Probably user error. |
- RE: Re: Introduction to Profiling Java Applications in NetBea... John