Search:

Type: Posts; User: Norm

Search: Search took 0.09 seconds.

  1. Replies
    33
    Views
    3,578

    Re: Average length of time for input/output

    No. There needs to be a class that holds the item's value and start time so that the start time is with the item.
  2. Replies
    33
    Views
    3,578

    Re: Average length of time for input/output

    If the start time is NOT saved with the item, then there will only be one value in the program. There needs to be a starttime saved for EACH ITEM.
  3. Replies
    33
    Views
    3,578

    Re: Average length of time for input/output

    I'm talking about this statement:

    startTime = System.currentTimeMillis(); // ***** GET TIME *****


    I don't see any use of the Timer class in the posted code.
  4. Replies
    33
    Views
    3,578

    Re: Average length of time for input/output

    The start and stop times are not associated with the items. If two items are added before one is removed, the start time for the first item is lost. When the first item added is removed, its start...
  5. Replies
    33
    Views
    3,578

    Re: Average length of time for input/output

    How are the values of those variables set? If they are not given values, their value would be 0.
  6. Replies
    33
    Views
    3,578

    Re: Average length of time for input/output

    I'm not sure how that works. The time between events would be the difference between the time when an item is added and the time when it is removed.
  7. Replies
    33
    Views
    3,578

    Re: Average length of time for input/output

    The code should NOT use hardcoded magic numbers. Values in variables should be used to control loops.

    I have compiled and executed it. I changed one of the 10 to a 2 for quicker testing and the...
  8. Replies
    33
    Views
    3,578

    Re: Average length of time for input/output

    Then you do not understand the problem.

    Questions on the code:
    Why the hardcoded 10 in two places vs a single parameter to control the number of loops the code takes?
    Why does the Watcher...
  9. Replies
    33
    Views
    3,578

    Re: Average length of time for input/output

    I really don't have another suggestion. I've said the same thing now several times.

    If there is no test scheme to validate the results. Then will any answer work?
    It seems like a waste of time...
  10. Replies
    33
    Views
    3,578

    Re: Average length of time for input/output

    Can there be more than one item in the buffer? If so, the times of the events should be kept with the item.

    What are the ins and outs used for? Would ins == outs at the end of the run? To make...
  11. Replies
    33
    Views
    3,578

    Re: Average length of time for input/output

    There are printlns for when the item is added and when it is removed. Do they define the times of the two events you are interested in? If so, at the add, save the time in the item object. At the...
  12. Replies
    33
    Views
    3,578

    Re: Average length of time for input/output

    SorrY I don't know what those counters are used for.
    I was talking about recording the clock time when an item is inserted and subtracting it from the clock time when the item is removed.
  13. Replies
    33
    Views
    3,578

    Re: Average length of time for input/output

    When an item is inserted, record the time in the object. When the item's object is removed, compute the duration.
    Save the item with the saved duration in a list somewhere.
  14. Replies
    33
    Views
    3,578

    Re: Average length of time for input/output

    How about a class whose objects will hold the time of its insertion?
  15. Replies
    33
    Views
    3,578

    Re: Average length of time for input/output

    The System class has a method that returns the PC's current time in a long.

    How will the code associate the time of insertion with the item that was inserted?
  16. Replies
    33
    Views
    3,578

    Re: Average length of time for input/output

    Which part is the problem:
    Getting the time of insertion
    getting the time of removal
    computing the difference
    summing the times
    computing the average
Results 1 to 16 of 16