Some sun.misc internal APIs are deprectaed in JDK 9 and will be encapsulated or removed in a future release.
public SunHighResTimer() { ticksPerSecond = perf.highResFrequency(); }
public SunHighResTimer() { ticksPerSecond = perf.highResFrequency(); }
SunPerfProvider() { perf = (sun.misc.Perf) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return sun.misc.Perf.getPerf(); } }); // trying to avoid BOTH overflow and rounding errors long numerator = 1000000000; long denominator = perf.highResFrequency(); long gcd = gcd(numerator, denominator); this.multiplier = numerator / gcd; this.divisor = denominator / gcd; } public long nanoTime() {
SunPerfProvider() { perf = (sun.misc.Perf) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return sun.misc.Perf.getPerf(); } }); // trying to avoid BOTH overflow and rounding errors long numerator = 1000000000; long denominator = perf.highResFrequency(); long gcd = gcd(numerator, denominator); this.multiplier = numerator / gcd; this.divisor = denominator / gcd; } public long nanoTime() {
SunPerfProvider() { perf = (sun.misc.Perf) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return sun.misc.Perf.getPerf(); } }); // trying to avoid BOTH overflow and rounding errors long numerator = 1000000000; long denominator = perf.highResFrequency(); long gcd = gcd(numerator, denominator); this.multiplier = numerator / gcd; this.divisor = denominator / gcd; } public long nanoTime() {
public PerfTimer () { _timer = Perf.getPerf(); init(_timer.highResFrequency() / 1000, _timer.highResFrequency() / 1000000); }
public PerfTimer () { _timer = Perf.getPerf(); init(_timer.highResFrequency() / 1000, _timer.highResFrequency() / 1000000); }
/** * Returns a RelativeTime instance based on sun.misc.Perf precision. * * @throws RuntimeException if failed to access to sun.misc.perf */ public RelativeTime() { _perf = AccessController.doPrivileged(new PrivilegedAction<sun.misc.Perf>() { public sun.misc.Perf run() { return sun.misc.Perf.getPerf(); } }); /* * Verify limitations as specified in the class javadoc. */ if (_perf == null) throw new RuntimeException("Limitation - unable to load sun.misc.Perf provider; " + "\n\t The undocumented sun.misc.Perf class provides high resolution access " + "to the system clock. @since Sun JDK1.4.2\n"); if (!System.getProperty("file.separator").equals("\\")) throw new RuntimeException("Limitation - Relative Time is currently limited to Windows OS."); TICKS_PER_SECOND = _perf.highResFrequency(); }