Quantcast
Channel: Is System.currentTimeMillis() the best measure of time performance in Java? - Stack Overflow
Browsing latest articles
Browse All 7 View Live

Answer by Sonson123 for Is System.currentTimeMillis() the best measure of...

You may use Stopwatch from Google Guava which makes measuring time super-easy.

View Article



Answer by KarlU for Is System.currentTimeMillis() the best measure of time...

If you need monotonic time measurements, System.nanoTime is a better choice. System.currentTimeMillis is subject to UTC timing variations -- leap seconds, NTP updates and jitter, as well as users...

View Article

Answer by dfa for Is System.currentTimeMillis() the best measure of time...

besides System.nanoTime(), JMX is probably the best viable option:java.lang.management.ManagementFactory.getThreadMXBean()you can query current thread cpu time (measured in nano seconds but not with...

View Article

Answer by jwoolard for Is System.currentTimeMillis() the best measure of time...

One gotcha is that this measures real time elapsed, not CPU time - so it is very dependent on system load. This is fine if your on an otherwise free machine, but can sometimes produce interesting...

View Article

Answer by raupach for Is System.currentTimeMillis() the best measure of time...

Before Java 1.5 there was only System.currentTimeMillis. However the granularity of the value depends on the underlying operating system and may be large. On Windows XP I sometimes ended up with gaps...

View Article


Answer by David Johnstone for Is System.currentTimeMillis() the best measure...

I hope not - it's what I use when i don't use nanoTime().

View Article

Is System.currentTimeMillis() the best measure of time performance in Java?

Is System.currentTimeMillis() the best measure of time performance in Java? Are there any gotcha's when using this to compare the time before action is taken to the time after the action is taken? Is...

View Article
Browsing latest articles
Browse All 7 View Live




Latest Images