diff options
author | Sven Gothel <[email protected]> | 2023-03-06 22:28:47 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-03-06 22:28:47 +0100 |
commit | b773048aee7ebfb00b7ae7b45ef9f49e88ebc5a4 (patch) | |
tree | f0fd56e5e40a97a0bd49d241d58f6445b0dc0fe6 /src/java/com | |
parent | 0836295b52aaad1dce10a31a13cb544802d7de03 (diff) |
Clock: Rename currentTimeNanos() -> currentNanos() as it represents the duration since module startup and not time.
Diffstat (limited to 'src/java/com')
-rw-r--r-- | src/java/com/jogamp/common/os/Clock.java | 40 | ||||
-rw-r--r-- | src/java/com/jogamp/common/util/PerfCounterCtrl.java | 2 |
2 files changed, 25 insertions, 17 deletions
diff --git a/src/java/com/jogamp/common/os/Clock.java b/src/java/com/jogamp/common/os/Clock.java index 466b3fc..03a0040 100644 --- a/src/java/com/jogamp/common/os/Clock.java +++ b/src/java/com/jogamp/common/os/Clock.java @@ -47,13 +47,13 @@ public class Clock { * since the underlying OS shall support fast calls. * </p> * <p> - * Note that {@link #currentTimeNanos()} and {@link #getMonotonicNanos()} + * Note that {@link #currentNanos()} and {@link #getMonotonicNanos()} * perform much better than this method, since they only return one long nanosecond value * since module startup. <br/> * The implementation of this method needs to write two long values into an array. * </p> * @see #getMonotonicStartupTime() - * @see #currentTimeNanos() + * @see #currentNanos() * @see #getMonotonicNanos() * @see #getWallClockTime() */ @@ -74,7 +74,7 @@ public class Clock { * since the underlying OS unlikely supports fast calls. * </p> * @see #getMonotonicStartupTime() - * @see #currentTimeNanos() + * @see #currentNanos() * @see #getMonotonicNanos() * @see #getMonotonicTime() */ @@ -86,43 +86,51 @@ public class Clock { private static native void getWallClockTimeImpl(final long[/*2*/] val); /** - * Returns the monotonic startup time since module startup as used in {@link #currentTimeNanos()} and {@link #getMonotonicNanos()}. - * @see #currentTimeNanos() + * Returns the monotonic startup time since module startup as used in {@link #currentNanos()} and {@link #getMonotonicNanos()}. + * @see #currentNanos() * @see #getMonotonicNanos() */ public static Instant getMonotonicStartupTime() { return t0; } private static native void getMonotonicStartupTimeImpl(final long[/*2*/] val); /** - * Returns current monotonic time in nanoseconds since start of this application. + * Returns current monotonic nanoseconds since start of this application. * <p> * Monotonic time shall be used for high-performance measurements of durations, * since the underlying OS shall support fast calls. * </p> * <p> - * Since the returned nanoseconds are counted not from Unix Epoch but start of this application, - * it lasts for 9'223'372'036 seconds or 292 years using the 64-bit type `long`. + * The returned nanoseconds are counted not from Unix Epoch but start of this module, + * hence it lasts for 9'223'372'036 seconds or 292 years using the 64-bit type `long`. + * </p> + * <p> + * Method name doesn't include the term `Time` intentionally, + * since the returned value represent the nanoseconds duration since module start. * </p> * @see #getMonotonicStartupTime() * @see #getMonotonicNanos() */ - public static native long currentTimeNanos(); + public static native long currentNanos(); /** - * Returns the Instant presentation of monotonic {@link #currentTimeNanos()}. + * Returns the Instant presentation of monotonic {@link #currentNanos()}. * <p> * Monotonic time shall be used for high-performance measurements of durations, * since the underlying OS shall support fast calls. * </p> * <p> - * Note that the represented time is not from Unix epoch as claimed, - * but monotonic module startup time. + * The returned nanoseconds are counted not from Unix Epoch but start of this module, + * hence it lasts for 9'223'372'036 seconds or 292 years using the 64-bit type `long`. + * </p> + * <p> + * Method name doesn't include the term `Time` intentionally, + * since the returned value represent the nanoseconds duration since module start. * </p> * @see #getMonotonicStartupTime() - * @see #currentTimeNanos() + * @see #currentNanos() */ public static Instant getMonotonicNanos() { - final long nanos = currentTimeNanos(); + final long nanos = currentNanos(); return Instant.ofEpochSecond(nanos/1000000000L, nanos%1000000000L); } @@ -130,7 +138,7 @@ public class Clock { * Returns current monotonic time in milliseconds. * * @see #getMonotonicStartupTime() - * @see #currentTimeNanos() + * @see #currentNanos() * @see #getMonotonicNanos() */ public static native long currentTimeMillis(); @@ -141,7 +149,7 @@ public class Clock { * * @see #getWallClockTime() * @see #getMonotonicTime() - * @see #currentTimeNanos() + * @see #currentNanos() * @see #getMonotonicNanos() */ public static native long wallClockSeconds(); diff --git a/src/java/com/jogamp/common/util/PerfCounterCtrl.java b/src/java/com/jogamp/common/util/PerfCounterCtrl.java index 30290f8..2c79a2d 100644 --- a/src/java/com/jogamp/common/util/PerfCounterCtrl.java +++ b/src/java/com/jogamp/common/util/PerfCounterCtrl.java @@ -32,7 +32,7 @@ import com.jogamp.common.os.Clock; * Simple performance counter controller. * <p> * Implementation is expected to utilize nanosecond counter since module start, - * e.g. {@link Clock#currentTimeNanos()}. + * e.g. {@link Clock#currentNanos()}. * </p> */ public interface PerfCounterCtrl { |