Re: Java Timer



sconeek wrote:
I want to try something like this,
for (int i=0;i<10000;i++) {
 not sure what to do while its looping????
}
Then do whatever.

any help on what should go inside the for loop and if this will
actually loop for 10secs or not. thanks to all who reply.


You asked how to do it and even got some examples. Now you are telling us you want to do it with a loop. The reason you aren't getting a loop as an answer is that isn't the way to do it. Use Thread.sleep() or use java.util.Timer but forget the loop.


--

Knute Johnson
email s/nospam/knute/
.



Relevant Pages

  • Re: Java Timer
    ... sconeek wrote: ... actually loop for 10secs or not. ... It gets executed as fast as the CPU can execute it. ...
    (comp.lang.java.programmer)
  • Re: object system...
    ... but you shall not reason contradictory. ... while Halt loop ... Any finite halting problem is decidable, ...
    (comp.object)
  • Re: Which Is Better?
    ... The reason they gave was from a DBA perpspective like it was ... MERGE really necessary here - do you do any inserts in that loop, ... statistics for both approaches and compare them to see what could ... Did you capture any other statistics aside from run time ...
    (comp.databases.oracle.misc)
  • Re: measuring clock cycles per second
    ... In fact, I am not trying to convince you, I'm trying to find a reason why you would think it's useless. ... Let's assume that a program only executes a single loop and this loop ... Even if the average execution time of #1 is exactly 1/4 of the sampling interval and the average execution time of #2 is exactly 3/4 of the sampling interval, then, provided the standard deviation of the respective probability distributions of times is nonzero, the total time taken by the loop will, in general, be unequal to the sampling interval, even if by a mere 1%. ... Rather than the poor resolution, I find the fact that measurement itself leads to changes in timing more difficult to work with, especially when -g is used (not sure about the reason). ...
    (comp.os.linux.development.apps)
  • Re: Need Thread Advice
    ... The event object concept seems more reasonable. ... The code is written so that when a button is clicked, I open a com port ... but the release code hung in the whileloop. ... reason for this is volatile typically does not have the correct memory ...
    (microsoft.public.vc.mfc)