How Do You Tell How Long it Takes for a Piece of Code to Execute?
- From: kvnsmnsn@xxxxxxxxxxx
- Date: 17 Jul 2006 16:18:06 -0700
I've been looking at classes <Time>, <Date>, and <Calendar>, trying to
figure out how to time how long it takes my program to execute, but
without any luck. What I want to do is store a time value at the be-
ginning of my program, and then store a time value at the end of my
program, and then at the end of my program subtract the two values and
come up with how many milliseconds passed while the program was exe-
cuting.
For a bit I thought I could simply call the <getTime()> method of
class <Date> twice to accomplish this, since that method is supposed
to give the number of milliseconds transpired since 1 January 1970,
but no matter how long it takes for my program to run when I subtract
the two values I always get zero.
Does anyone know what I can do to time my Java program? Any informa-
tion anyone can give me would be greatly appreciated.
---Kevin Simonson
.
- Follow-Ups:
- Re: How Do You Tell How Long it Takes for a Piece of Code to Execute?
- From: Patricia Shanahan
- Re: How Do You Tell How Long it Takes for a Piece of Code to Execute?
- From: Thomas Fritsch
- Re: How Do You Tell How Long it Takes for a Piece of Code to Execute?
- From: Thomas Fritsch
- Re: How Do You Tell How Long it Takes for a Piece of Code to Execute?
- From: Mike Schilling
- Re: How Do You Tell How Long it Takes for a Piece of Code to Execute?
- From: Lionel
- Re: How Do You Tell How Long it Takes for a Piece of Code to Execute?
- Prev by Date: Re: Why not written in Java?
- Next by Date: Re: Why not written in Java?
- Previous by thread: java.lang.SecurityException: Prohibited package name: java
- Next by thread: Re: How Do You Tell How Long it Takes for a Piece of Code to Execute?
- Index(es):
Relevant Pages
|