Oh ok, I'll give that a try.
Cheers.
Type: Posts; User: ManInTheMiddle
Oh ok, I'll give that a try.
Cheers.
So, I need another long to add all the time between inserts and removes together and then divide it by the outs?
stopTime = System.currentTimeMillis(); // ****** GET TIME ******
...
Yeah, I changed it earlier but site crashed, so ,wasn't sure which one you seen.
Is that in the one with the Timer class?
In the producer and consumer try blocks I have them being called. I'v edited it again and went about it a different angle but now
I'm down to a single error in run time NullPointerException in...
If I print the getTotalTime and totalTimeInMilis anywhere in the program for testing purposes I get 0. Surely it should return some sort of value
Hi, I'v changed magic numbers to variables and added a timer class to calculate the average but it's returning 0.
I'v been testing it and I think it returns a 0 because the start and stop have same...
The hard 10 should be 60 as the question requests. I have it at 10 to speed up testing time. The watcher buffer time should be set to 60 as well. The sleep is set to 1000 milliseconds and print out...
I know, if I code something I'v no way in checking if I'm right.. It seems a bit pointless with the type of project that's in it. I will try some of your suggestions, if no joy I will just loose 10...
The ins and out are used to tell you what's in the buffer and removed when it's ran ( as in quantity). Buffer size is set by the user.
I don't think there's a specific answer at the end as I'd...
They just count buffer run times.
Yeah, I could capture the time between the add then remove in separate longs, compute it then print. I would have to use the amount of times it happens as well....
They are used in The Watcher class's run method.
I see what you mean but I'm a bit stuck in how to actually get that code working.
Would I record the time with a statement eg if( buffer != 0)...
So, in the public synchronized void insertItem and public synchronized void removeItem the ins++ and outs++ can be used?
And call the Producer as parameters and store it?
Cool, I'll have a look, cheers.
I have until Friday, so, I might be back haha
--- Update ---
I'v no idea
It's the average of the time from the Producer entering an integer and the consumer removing it.
Getting the time of insertion
getting the time of removal
I can prob do the rest
Hi, here's my question
After the threads have terminated the program should print out the average length of time (in ms)
between the Producer inserting an integer and the Consumer removing that...