?
Solved

simple timing method with a lot of operations

Posted on 2003-03-29
7
Medium Priority
?
147 Views
Last Modified: 2010-03-31
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
Comment
Question by:patra1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 26

Expert Comment

by:ksivananth
ID: 8230062
Timer and TimerTask classes?
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 300 total points
ID: 8230137
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
 
LVL 4

Expert Comment

by:funnyveryfunny
ID: 8231816
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
Independent Software Vendors: 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!

 
LVL 1

Expert Comment

by:b612_forever
ID: 8236220
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
 

Expert Comment

by:CleanupPing
ID: 9058411
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
 
LVL 15

Expert Comment

by:jimmack
ID: 9735470
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses
Course of the Month12 days, 10 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question