I'd like an automation process to run a data crunching java program with a profiler, or otherwise in a way that will dump typical JVM performance information about resource usage and GC - to a data file. It means a human process like "run the program" --> "start the tool" --> "attach to JVM" --> "select save..." won't fit.
So which of the various JVM profiling or performance tools may have an option to make this kind of attachment on JVM startup?
Or is there alternatively a library that I can include in my application, arriving at the same end result — of having saved performance/profiling data — perhaps by calling its api from within my program?