Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Test and Performance Tools Platform (TPTP) » Get exact CPU time of a Java Application
Get exact CPU time of a Java Application [message #93364] Mon, 12 March 2007 15:38 Go to next message
Eclipse UserFriend
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 #93378 is a reply to message #93364] Tue, 13 March 2007 11:13 Go to previous messageGo to next message
Asaf Yaffe is currently offline Asaf YaffeFriend
Messages: 333
Registered: July 2009
Senior Member
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
Re: Get exact CPU time of a Java Application [message #93450 is a reply to message #93378] Wed, 14 March 2007 09:34 Go to previous message
Eclipse UserFriend
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
Previous Topic:What is a live instance?
Next Topic:GetCurrentThreadCpuTime
Goto Forum:
  


Current Time: Sat Aug 08 17:51:16 GMT 2020

Powered by FUDForum. Page generated in 0.01941 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top