I was asked to profile (using some tool, such as YourKit or JVisualVM) a couple of implementations of the Traveling Salesman Problem (find the minimum path that visits all the given set of cities), in the context of a Algorithms Analysis and Design graduate course.
Taking in consideration the brute force approach of the algorithm, I'm wondering, though, how to best use the tools (for instance, JVisualVM) to analyze the spatial and temporal complexities of the algorithm. If I'm not in error the algorithm has spatial complexity of O(n), as it basically grows linearly with the number of cities, while it is O(n!) in temporal complexity.
The math isn't the issue here.
After playing for a bit with both the referred tools, I'm having some hard time understanding how can they be of any use to my problem.
Sure I can see which methods are being used the most and which % of the time is being used in each one of them, and what is the actual memory footprint, so that can be all be regarded as hints where to optimize.
But other than that, and other than seeing the % of the CPU which is actually being used (or IO accesses, which never occur in this program), I can't see how can I actually learn something about the algorithm with these tools than the math before referred didn't.
What should be my main concerns when using profilers to the analysis of algorithms? Also, I've put basic time recording capabilities embedded in my program. Maybe I could use the profiling tools to better do that job?