Get exact CPU time of a Java Application [message #93364] |
Mon, 12 March 2007 15:38 |
Eclipse User |
|
|
|
Originally posted by: schlossh.fh-trier.de
Hello everyone,
I would like to measureexact execution time of a Java application. The
textbook approach calling "System.currentTimeMillis" before and after the
code to be measured may include much more than just code's execution time.
Now my question: Is there a simply way to import and use a tptp-library
which implements the "GetCurrentThreadCPUTime"-method declared in jvmti.h in
order to get the exact execution time?
Thanks a lot
Hermann
|
|
|
|
Re: Get exact CPU time of a Java Application [message #93450 is a reply to message #93378] |
Wed, 14 March 2007 09:34 |
Eclipse User |
|
|
|
Originally posted by: schlossh.fh-trier.de
Hi Asaf,
thank you for your fast replay.
>The main problem with the JVMTI GetCurrentThreadCPUTime is that it uses
>inaccurate CPU counters. These counters seem to be updated at a millisecond
>resolution, so it it actually not very useful for most practical purposes.
>For most functions, you are likely to get a CPU time of 0.
For my purpose is the resolution of JVMTI's GetCurrentThreadCPUTime
suficient. So I just like to access this method within my Java-Application.
Do you have any idea how it could work?
> I am not aware of any way of obtaining this information from a Java
> application. If you wish to write your own native JVMTI-based data
> collector for doing this, take a look at the source code of the JVMTI CPU
> Data Collector
> (org.eclipse.tptp.platform.jvmti.runtime/src-native/src/CGPr of) and let me
> know if you have any specific questions.
I have actually checked out the
org.eclipse.tptp.platform.jvmti.runtime/src-native/src/CGPro f-project from
eclips's cvs repository and going to take a clooser look at it. So thank you
for your advice!
Best regards
Hermann
"Asaf Yaffe" <asaf.yaffe@intel.com> schrieb im Newsbeitrag
news:et6117$375$1@utils.eclipse.org...
> Hermann,
>
>>
>> Now my question: Is there a simply way to import and use a tptp-library
>> which implements the "GetCurrentThreadCPUTime"-method declared in jvmti.h
>> in order to get the exact execution time?
>>
>
> The main problem with the JVMTI GetCurrentThreadCPUTime is that it uses
> inaccurate CPU counters. These counters seem to be updated at a
> millisecond resolution, so it it actually not very useful for most
> practical purposes. For most functions, you are likely to get a CPU time
> of 0.
>
> The new JVMTI CPU Profiler can collect this information for you. To enable
> this feature, double click the "Execution time analysis" analysis type in
> the Monitor tab of the Profiling Launch Configuration dialog, and select
> the "Collect method CPU time information" option.
>
> I am not aware of any way of obtaining this information from a Java
> application. If you wish to write your own native JVMTI-based data
> collector for doing this, take a look at the source code of the JVMTI CPU
> Data Collector
> (org.eclipse.tptp.platform.jvmti.runtime/src-native/src/CGPr of) and let me
> know if you have any specific questions.
>
> HTH,
> Asaf
>
> --
> Asaf Yaffe
> Eclipse TPTP Committer, JVMTI Profiler
|
|
|
Powered by
FUDForum. Page generated in 0.02738 seconds