Results 1 to 9 of 9
  1. #1
    Samgetsmoney is offline Member
    Join Date
    Feb 2009
    Posts
    32
    Rep Power
    0

    Default Quick latency testing question..

    ok at the beginning of the boolean i have
    long start = System.currentTimeMillis();
    and at the end i have
    long end = System.currentTimeMillis();
    long latency = end - start;



    How do i make it more precise?
    Like System.currentTimeNanos()?
    lol


    this is what i mean
    pastebin*/m21d2c9af

    where the * is put .com

    Thanks
    Last edited by Samgetsmoney; 02-17-2009 at 07:02 AM.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    why do you need timing more precise than milliseconds? Perhaps instead you need to correct your design.

  3. #3
    Samgetsmoney is offline Member
    Join Date
    Feb 2009
    Posts
    32
    Rep Power
    0

    Default

    Well then help with my design..
    Because latency just equals 0 all the time..

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Well then help with my design
    I'd love to do just that if I had any inkling what the heck you're trying to do. I must have left my mind-reading hat back at work.

    You may wish to provide more detail. A great site to help you formulate your questions so that they are more easily answered can be found here: How To Ask Questions The Smart Way

  5. #5
    Samgetsmoney is offline Member
    Join Date
    Feb 2009
    Posts
    32
    Rep Power
    0

    Default

    And a quick question why when u do
    Thread.sleep(NUMBER);
    it never actually sleeps for that long?

  6. #6
    Samgetsmoney is offline Member
    Join Date
    Feb 2009
    Posts
    32
    Rep Power
    0

    Default

    look at the part where it says pastebin thats what i mean

  7. #7
    MK12's Avatar
    MK12 is offline Senior Member
    Join Date
    Jan 2009
    Posts
    185
    Rep Power
    6

    Default

    The pastebin thing just has the start then end then calculates latency. obviously it will be zero because you're not doing something in between.. Do something that takes a long time in the middle, like printing out 500 pascal's triangles that each have 100 rows:D.
    -MK12
    Tell me if you want a cool Java logo avatar like mine and I'll make you one.

  8. #8
    Samgetsmoney is offline Member
    Join Date
    Feb 2009
    Posts
    32
    Rep Power
    0

    Default

    yea but when the method is running 100's of times every half second the little bit of latency counts..

    And there is code in the middle the commented out stuff was just an example...

    So i read up on benchmarks but dont fully understand them..

  9. #9
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    8

    Default Benchmarking links

    A couple of articles that discuss Java benchmarking that are referenced a lot:

    Robust Java benchmarking, Part 1: Issues
    Robust Java benchmarking, Part 2: Statistics and solutions

    Luck,
    CJSL
    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

Similar Threads

  1. One last quick question
    By jigglywiggly in forum New To Java
    Replies: 7
    Last Post: 01-26-2009, 09:53 AM
  2. Quick Question
    By Graeme in forum New To Java
    Replies: 4
    Last Post: 01-08-2009, 09:01 PM
  3. Quick Question
    By Spenc in forum New To Java
    Replies: 3
    Last Post: 09-22-2008, 03:26 PM
  4. quick easy question
    By jmHoekst in forum New To Java
    Replies: 1
    Last Post: 06-19-2008, 04:28 PM
  5. Quick Stupid Question
    By bluekswing in forum New To Java
    Replies: 7
    Last Post: 01-08-2008, 07:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •