File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

In Windows, how to measure any java program execution time from other monitoring java program ?

 
Rahul Chhabra
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am trying to write a java program which can find out execution time of any other java program, on window platform.

Is it possible to do this ?

I am able to read all java process, using below snippet:-



Thanks in advance,
Rahul
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33699
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How would you identify the "unknown" program from the list as a human? Identifying that is the first step before being able to code anything.
 
Rahul Chhabra
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hhmm.. To make it more clear and to the point-

How to write java program say 'A', that can measure execution time of any other java program say 'B' or 'C'.
'A' can be ever-running monitor program, that's waiting for any other java program to execute and calculate its execution time.

I am trying to fetch this information from tasklist command in windows.

Any hints ??
 
Paul Clapham
Sheriff
Pie
Posts: 20203
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What kind of hints are you looking for? Or to put it another way, what part of that can't you do?
 
Rahul Chhabra
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hint Required-

1. how to get information from tasklist command, that any other java process (say PID 2130) has started at this particular timestamp and once its finished, its finishing timestamp.

If not possible from tasklist command, any other way to get this information.

I dont want to put in java code- System.currentTimeMillis() way of calculating execution time.

Thanks.
 
Paul Clapham
Sheriff
Pie
Posts: 20203
26
MySQL Database
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But the tasklist.exe program only displays tasks that are running at the moment you call that program, isn't that right? In other words it won't tell you when a particular task starts, nor will it tell you when it finishes. And since those are the two pieces of information you want, and tasklist.exe doesn't provide either of them, I really don't think it's the best choice. Wouldn't you agree?
 
Rahul Chhabra
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Agree and exactly, and thats where I am stuck.

What other alternatives I have ?
I need to compute much more information like memory space etc, starting with timestamp. So I thought tasklist.exe can be sufficient, but surely, it does not seem so.

Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic