Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » measure runtime of a java program using Eclipse
measure runtime of a java program using Eclipse [message #334475] Wed, 11 February 2009 16:03 Go to next message
Tarek Garoui is currently offline Tarek GarouiFriend
Messages: 7
Registered: July 2009
Junior Member
Hello,

I would like to measure the runtime of a java program. I am using Eclipse.
Can somebody tell me how it works ?

Thanks
Re: measure runtime of a java program using Eclipse [message #334478 is a reply to message #334475] Wed, 11 February 2009 23:51 Go to previous messageGo to next message
Walter Harley is currently offline Walter HarleyFriend
Messages: 847
Registered: July 2009
Senior Member
"Tarek Garoui" <tgaroui@yahoo.de> wrote in message
news:3feb1f8f1df3aab2d3575579bad008a7$1@www.eclipse.org...
> Hello,
>
> I would like to measure the runtime of a java program. I am using Eclipse.
> Can somebody tell me how it works ?

There are two answers I can think of offhand. One is to use a Java
profiling tool, such as Eclipse TPTP. This will give you extremely detailed
information at the cost of a fairly steep learning curve.

The other is to write a test wrapper (shell script, Java class with a main()
method, JUnit test...) that checks the system time, calls your program, and
then checks the system time again and spits out the difference. If you
choose, you could build this functionality right into your program,
controlled for instance with a command line argument or system property.

Which one of those solutions is right for you depends on your goals.
Re: measure runtime of a java program using Eclipse [message #334484 is a reply to message #334478] Thu, 12 February 2009 12:44 Go to previous messageGo to next message
Tarek Garoui is currently offline Tarek GarouiFriend
Messages: 7
Registered: July 2009
Junior Member
Hello,
in the second alternative, I will have the time difference which includes
the runtime of other parallel programs. What I need is the runtime of a
single Eclipse process.

Thanks
Re: measure runtime of a java program using Eclipse [message #334494 is a reply to message #334484] Thu, 12 February 2009 16:52 Go to previous message
Walter Harley is currently offline Walter HarleyFriend
Messages: 847
Registered: July 2009
Senior Member
"Tarek Garoui" <tgaroui@yahoo.de> wrote in message
news:56a515540829377763e1858b2c449d98$1@www.eclipse.org...
> Hello,
> in the second alternative, I will have the time difference which includes
> the runtime of other parallel programs. What I need is the runtime of a
> single Eclipse process.

"runtime" is not a well-defined term. If you want people to answer specific
questions, you need to ask specific questions. We are not telepathic.

But, cumulative CPU time for a process is also not well defined,
unfortunately. That's not really how operating systems work. For instance,
if two processes are writing files in the same area, the file subsystem may
process them together - in that case, how much CPU time was spent on which
process? You can measure cumulative *user* time for a single process, that
is time spent in that process's code, but measuring cumulative system time
is harder. And of course if you have more than one CPU, then cumulative
user CPU time will not be the same as real run time.

That said, perhaps you are running on an operating system that can give you
the estimated cumulative CPU time for a process upon completion. In that
case, and if that is really all the information you need, then all you need
is to be able to wrap your program with a shell of some sort and capture the
console output upon completion, no?

Personally I would suggest that if your needs are this detailed, you should
be using a profiler (YourKit, Eclipse TPTP, JProfiler, ...).
Previous Topic:Additional Files for Deployed Product
Next Topic:Update process hanging on download
Goto Forum:
  


Current Time: Mon Dec 30 17:14:44 GMT 2024

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

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

Back to the top