Search:

Type: Posts; User: ManInTheMiddle

Search: Search took 0.07 seconds.

  1. Re: Average length of time for input/output

    Oh ok, I'll give that a try.

    Cheers.
  2. Re: Average length of time for input/output

    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 ******
    ...
  3. Re: Average length of time for input/output

    Yeah, I changed it earlier but site crashed, so ,wasn't sure which one you seen.
  4. Re: Average length of time for input/output

    Is that in the one with the Timer class?
  5. Re: Average length of time for input/output

    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...
  6. Re: Average length of time for input/output

    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
  7. Re: Average length of time for input/output

    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...
  8. Re: Average length of time for input/output

    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...
  9. Re: Average length of time for input/output

    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...
  10. Re: Average length of time for input/output

    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...
  11. Re: Average length of time for input/output

    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....
  12. Re: Average length of time for input/output

    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)...
  13. Re: Average length of time for input/output

    So, in the public synchronized void insertItem and public synchronized void removeItem the ins++ and outs++ can be used?
  14. Re: Average length of time for input/output

    And call the Producer as parameters and store it?
  15. Re: Average length of time for input/output

    Cool, I'll have a look, cheers.

    I have until Friday, so, I might be back haha

    --- Update ---

    I'v no idea
  16. Re: Average length of time for input/output

    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
  17. Average length of time for input/output

    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...
Results 1 to 17 of 18