Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 149
  • Last Modified:

simple timing method with a lot of operations

what you suggest for a simple timing method with a lot of operations.
I want to count timing for a sorting algorithm.Because it's fast i want something with a lot of operations.Something simple.like clock()
0
patra1
Asked:
patra1
1 Solution
 
ksivananthCommented:
Timer and TimerTask classes?
0
 
CEHJCommented:
Scale up the operation(s) by running it/them in a loop. Before the start:

long then = System.currentTimeMillis();
// loop
long now = System.currentTimeMillis();
int durationInMilliseconds = (int)(now - then);
0
 
funnyveryfunnyCommented:
Hi,

This link provides a Timer library that is more sensitive than System.currentTimeMillis():

>>>http://www.javaworld.com/javaworld/javaqa/2003-01/01-qa-0110-timing.html

I've been using it to experiment with various sorting algorithms myself. I hope it will be useful to you. Another thing make sure that hrt.dll (something like this, it comes with the library) is added to yr libray.path.

bye.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
b612_foreverCommented:
You may try this little Timer package at:
http://www.geocities.com/tao4dummies/untitle/java.html

It is quite convenient, you may get the duration in 3 different format.

Hope this may help.
0
 
CleanupPingCommented:
patra1:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
jimmackCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept CEHJ's comment as answer.

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jimmack
EE Cleanup Volunteer
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now