I have a java class file in my hand and can simply able to run it from windows cmd to view the output. Only thing I need to observe the running time of this java program depending on different input parameters. I don’t have the source code so I can not modify it to generate the running time for me. Please suggest possible way out to observe this. Thanks in advance.
Share
Wrap it in another class and run that. For example if your class (to which you dont have code) is called Runner then you may be currently running it as
If you create another class that then calls Runner you can do anything in that class. For example you could call the class InstrumentedRunner.
(I haven’t tested the code above.)
You could then run
It would then run Runner’s run method (assuming that is the method you want to time) and output the time it took.