LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-14-2006, 01:20 PM   #1
alred
Member
 
Registered: Mar 2005
Location: singapore
Distribution: puppy and Ubuntu and ... erh ... redhat(sort of) :( ... + the venerable bsd and solaris ^_^
Posts: 658
Blog Entries: 8

Rep: Reputation: 31
how to start timing and print the timing result on portions of java codes ??


how to insert timer within java code , for example ...

Code:
timerStart(); //probably set to zero or ...

docall(s1 , i1 , i2);

print(timerStop()); //probably returning a deducted result
i donno , but the timing part doesnt need to be highly precise but fine enough for some general use , not necessarily must they be called as a timing function ...

links to example code welcome ...

//thanks in advance ...


.
 
Old 05-14-2006, 06:21 PM   #2
psiteddy
LQ Newbie
 
Registered: Nov 2003
Location: Australia
Posts: 2

Rep: Reputation: 0
are you looking for

System.currentTimeMillis(), or
System.nanoTime()?

i can't post a link to the javadoc because im not allowed, but it is in System (obviously).

the example code given there is...

Code:
long startTime = System.nanoTime();
// ... the code being measured ...
long estimatedTime = System.nanoTime() - startTime;
 
Old 05-15-2006, 10:00 AM   #3
alred
Member
 
Registered: Mar 2005
Location: singapore
Distribution: puppy and Ubuntu and ... erh ... redhat(sort of) :( ... + the venerable bsd and solaris ^_^
Posts: 658

Original Poster
Blog Entries: 8

Rep: Reputation: 31
thanks ... those lines really work great for my general needs ...

//sorry for my laziness , actually i was kind of onto this tcl , so no java/pascal during that moment but i just need a java live doc ...

//great ...


.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Timing issues eagle683 Programming 4 06-01-2005 01:35 PM
timing a function saajii Programming 1 10-25-2004 02:37 AM
mencoder timing delos Linux - Software 1 09-27-2004 02:24 PM
timing in c++ deveraux83 Programming 2 04-20-2004 05:34 PM
Timing problems frostmagic Programming 6 02-01-2004 10:26 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration