|JamaicaVM 3.4 — User Documentation: The Virtual Machine for Realtime and Embedded Systems|
|Prev||Chapter 5. Jamaicavm Commands||Next|
jamaicavmp is a variant of jamaicavm_slim that collects profiling information. This profiling information can be used when creating an optimized version of the application using option -useProfile <file> of the Jamaica builder command (see Chapter 6).
The profiling information is written to a file whose name is the name of the main class of the executed Java application with the suffix .prof. The following run of a HelloWorld-application shows how the profiling information is written after the execution of the application.
> jamaicavmp HelloWorld Hello World! [...] Start writing profile data into file `HelloWorld.prof' Write instantiation data... Write invocation data... Write heap data... 0%....10%....20%....30%....40%....50%....60%....70%....80%....90%....100% Done writing profile data
Profiling information is written after the termination of the application. This requires an additional mechanism for applications which are not self-terminating. There are two possible approaches: adding an explicit termination mechanism to the application or requesting a profile dump remotely.
For an explicit termination, the application needs to be rewritten to terminate at a certain point, e.g., after a timeout or on a certain user input. The easiest means to terminate an application is via a call to System.exit(). Otherwise, all threads that are not daemon threads need to be terminated.
To request a remote profile, the property jamaica.profile_request_port has to be set to a port number. Then, a request to write the profile can be sent via the command "jamaicavm com.aicas.jamaica.lang.Profile <IP-address> <port #>". See Appendix C for more information on this mechanism.
Profiling information is always appended to the profiling file. This means that profiling information from several profiling runs of the same application, e.g. using different input data, will automatically be written into a single profiling file. To fully overwrite the profiling information, e.g., after a major change in the application, the profiling file must be deleted manually.
The collection of profiling information requires additional CPU time, and memory to store this information. It may therefore be necessary to increase the memory size. Also expect poorer runtime performance during a profiling run.