Merge
authormullan
Wed, 13 Jan 2016 10:25:41 -0500
changeset 34957 4a0926942b53
parent 34956 cfa4105ed600 (current diff)
parent 34955 16d569b075fb (diff)
child 34958 82de431119cd
Merge
jdk/src/java.base/share/classes/sun/misc/CEFormatException.java
jdk/src/java.base/share/classes/sun/misc/CEStreamExhausted.java
jdk/src/java.base/share/classes/sun/misc/JarFilter.java
jdk/src/java.base/share/classes/sun/misc/Perf.java
jdk/src/java.base/share/classes/sun/misc/PerfCounter.java
jdk/src/java.base/share/classes/sun/misc/PerformanceLogger.java
--- a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java	Wed Jan 13 09:39:26 2016 -0500
+++ b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java	Wed Jan 13 10:25:41 2016 -0500
@@ -50,6 +50,8 @@
 import java.util.Hashtable;
 import java.util.WeakHashMap;
 import java.util.concurrent.ConcurrentHashMap;
+
+import jdk.internal.perf.PerfCounter;
 import sun.misc.Resource;
 import sun.misc.URLClassPath;
 import sun.reflect.CallerSensitive;
@@ -423,9 +425,9 @@
                     c = findClass(name);
 
                     // this is the defining class loader; record the stats
-                    sun.misc.PerfCounter.getParentDelegationTime().addTime(t1 - t0);
-                    sun.misc.PerfCounter.getFindClassTime().addElapsedTimeFrom(t1);
-                    sun.misc.PerfCounter.getFindClasses().increment();
+                    PerfCounter.getParentDelegationTime().addTime(t1 - t0);
+                    PerfCounter.getFindClassTime().addElapsedTimeFrom(t1);
+                    PerfCounter.getFindClasses().increment();
                 }
             }
             if (resolve) {
--- a/jdk/src/java.base/share/classes/java/net/URLClassLoader.java	Wed Jan 13 09:39:26 2016 -0500
+++ b/jdk/src/java.base/share/classes/java/net/URLClassLoader.java	Wed Jan 13 10:25:41 2016 -0500
@@ -52,6 +52,7 @@
 
 import jdk.internal.misc.JavaNetAccess;
 import jdk.internal.misc.SharedSecrets;
+import jdk.internal.perf.PerfCounter;
 import sun.misc.Resource;
 import sun.misc.URLClassPath;
 import sun.net.www.ParseUtil;
@@ -459,14 +460,14 @@
             // Use (direct) ByteBuffer:
             CodeSigner[] signers = res.getCodeSigners();
             CodeSource cs = new CodeSource(url, signers);
-            sun.misc.PerfCounter.getReadClassBytesTime().addElapsedTimeFrom(t0);
+            PerfCounter.getReadClassBytesTime().addElapsedTimeFrom(t0);
             return defineClass(name, bb, cs);
         } else {
             byte[] b = res.getBytes();
             // must read certificates AFTER reading bytes.
             CodeSigner[] signers = res.getCodeSigners();
             CodeSource cs = new CodeSource(url, signers);
-            sun.misc.PerfCounter.getReadClassBytesTime().addElapsedTimeFrom(t0);
+            PerfCounter.getReadClassBytesTime().addElapsedTimeFrom(t0);
             return defineClass(name, b, 0, b.length, cs);
         }
     }
--- a/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java	Wed Jan 13 09:39:26 2016 -0500
+++ b/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java	Wed Jan 13 10:25:41 2016 -0500
@@ -54,6 +54,7 @@
 import java.util.stream.StreamSupport;
 import jdk.internal.misc.JavaUtilZipFileAccess;
 import jdk.internal.misc.SharedSecrets;
+import jdk.internal.perf.PerfCounter;
 
 import static java.util.zip.ZipConstants.*;
 import static java.util.zip.ZipConstants64.*;
@@ -210,8 +211,8 @@
         this.name = name;
         long t0 = System.nanoTime();
         this.zsrc = Source.get(file, (mode & OPEN_DELETE) != 0);
-        sun.misc.PerfCounter.getZipFileOpenTime().addElapsedTimeFrom(t0);
-        sun.misc.PerfCounter.getZipFileCount().increment();
+        PerfCounter.getZipFileOpenTime().addElapsedTimeFrom(t0);
+        PerfCounter.getZipFileCount().increment();
     }
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/perf/Perf.java	Wed Jan 13 10:25:41 2016 -0500
@@ -0,0 +1,547 @@
+/*
+ * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.internal.perf;
+
+import java.nio.ByteBuffer;
+import java.security.Permission;
+import java.security.PrivilegedAction;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import jdk.internal.ref.CleanerFactory;
+
+/**
+ * The Perf class provides the ability to attach to an instrumentation
+ * buffer maintained by a Java virtual machine. The instrumentation
+ * buffer may be for the Java virtual machine running the methods of
+ * this class or it may be for another Java virtual machine on the
+ * same system.
+ * <p>
+ * In addition, this class provides methods to create instrumentation
+ * objects in the instrumentation buffer for the Java virtual machine
+ * that is running these methods. It also contains methods for acquiring
+ * the value of a platform specific high resolution clock for time
+ * stamp and interval measurement purposes.
+ *
+ * @author   Brian Doherty
+ * @since    1.4.2
+ * @see      #getPerf
+ * @see      jdk.internal.perf.Perf.GetPerfAction
+ * @see      java.nio.ByteBuffer
+ */
+public final class Perf {
+
+    private static Perf instance;
+
+    private static final int PERF_MODE_RO = 0;
+    private static final int PERF_MODE_RW = 1;
+
+    private Perf() { }    // prevent instantiation
+
+    /**
+     * The GetPerfAction class is a convenience class for acquiring access
+     * to the singleton Perf instance using the
+     * <code>AccessController.doPrivileged()</code> method.
+     * <p>
+     * An instance of this class can be used as the argument to
+     * <code>AccessController.doPrivileged(PrivilegedAction)</code>.
+     * <p> Here is a suggested idiom for use of this class:
+     *
+     * <blockquote><pre>{@code
+     * class MyTrustedClass {
+     *   private static final Perf perf =
+     *       AccessController.doPrivileged(new Perf.GetPerfAction<Perf>());
+     *   ...
+     * }
+     * }</pre></blockquote>
+     * <p>
+     * In the presence of a security manager, the <code>MyTrustedClass</code>
+     * class in the above example will need to be granted the
+     * <em>"sun.misc.Perf.getPerf"</em> <code>RuntimePermission</code>
+     * permission in order to successfully acquire the singleton Perf instance.
+     * <p>
+     * Please note that the <em>"sun.misc.Perf.getPerf"</em> permission
+     * is not a JDK specified permission.
+     *
+     * @see  java.security.AccessController#doPrivileged(PrivilegedAction)
+     * @see  java.lang.RuntimePermission
+     */
+    public static class GetPerfAction implements PrivilegedAction<Perf>
+    {
+        /**
+         * Run the <code>Perf.getPerf()</code> method in a privileged context.
+         *
+         * @see #getPerf
+         */
+        public Perf run() {
+            return getPerf();
+        }
+    }
+
+    /**
+     * Return a reference to the singleton Perf instance.
+     * <p>
+     * The getPerf() method returns the singleton instance of the Perf
+     * class. The returned object provides the caller with the capability
+     * for accessing the instrumentation buffer for this or another local
+     * Java virtual machine.
+     * <p>
+     * If a security manager is installed, its <code>checkPermission</code>
+     * method is called with a <code>RuntimePermission</code> with a target
+     * of <em>"sun.misc.Perf.getPerf"</em>. A security exception will result
+     * if the caller has not been granted this permission.
+     * <p>
+     * Access to the returned <code>Perf</code> object should be protected
+     * by its caller and not passed on to untrusted code. This object can
+     * be used to attach to the instrumentation buffer provided by this Java
+     * virtual machine or for those of other Java virtual machines running
+     * on the same system. The instrumentation buffer may contain senstitive
+     * information. API's built on top of this interface may want to provide
+     * finer grained access control to the contents of individual
+     * instrumentation objects contained within the buffer.
+     * <p>
+     * Please note that the <em>"sun.misc.Perf.getPerf"</em> permission
+     * is not a JDK specified permission.
+     *
+     * @return  A reference to the singleton Perf instance.
+     * @throws SecurityException  if a security manager exists and its
+     *         <code>checkPermission</code> method doesn't allow access
+     *         to the <em>"jdk.internal.perf.Perf.getPerf""</em> target.
+     * @see  java.lang.RuntimePermission
+     * @see  #attach
+     */
+    public static Perf getPerf()
+    {
+        SecurityManager security = System.getSecurityManager();
+        if (security != null) {
+            Permission perm = new RuntimePermission("jdk.internal.perf.Perf.getPerf");
+            security.checkPermission(perm);
+        }
+
+        return instance;
+    }
+
+    /**
+     * Attach to the instrumentation buffer for the specified Java virtual
+     * machine.
+     * <p>
+     * This method will attach to the instrumentation buffer for the
+     * specified virtual machine. It returns a <code>ByteBuffer</code> object
+     * that is initialized to access the instrumentation buffer for the
+     * indicated Java virtual machine. The <code>lvmid</code> parameter is
+     * a integer value that uniquely identifies the target local Java virtual
+     * machine. It is typically, but not necessarily, the process id of
+     * the target Java virtual machine.
+     * <p>
+     * If the <code>lvmid</code> identifies a Java virtual machine different
+     * from the one running this method, then the coherency characteristics
+     * of the buffer are implementation dependent. Implementations that do
+     * not support named, coherent, shared memory may return a
+     * <code>ByteBuffer</code> object that contains only a snap shot of the
+     * data in the instrumentation buffer. Implementations that support named,
+     * coherent, shared memory, may return a <code>ByteBuffer</code> object
+     * that will be changing dynamically over time as the target Java virtual
+     * machine updates its mapping of this buffer.
+     * <p>
+     * If the <code>lvmid</code> is 0 or equal to the actual <code>lvmid</code>
+     * for the Java virtual machine running this method, then the returned
+     * <code>ByteBuffer</code> object will always be coherent and dynamically
+     * changing.
+     * <p>
+     * The attach mode specifies the access permissions requested for the
+     * instrumentation buffer of the target virtual machine. The permitted
+     * access permissions are:
+     * <ul>
+     * <li>"r"  - Read only access. This Java virtual machine has only
+     * read access to the instrumentation buffer for the target Java
+     * virtual machine.
+     * <li>"rw"  - Read/Write access. This Java virtual machine has read and
+     * write access to the instrumentation buffer for the target Java virtual
+     * machine. This mode is currently not supported and is reserved for
+     * future enhancements.
+     * </ul>
+     *
+     * @param   lvmid            an integer that uniquely identifies the
+     *                           target local Java virtual machine.
+     * @param   mode             a string indicating the attach mode.
+     * @return  ByteBuffer       a direct allocated byte buffer
+     * @throws  IllegalArgumentException  The lvmid or mode was invalid.
+     * @throws  IOException      An I/O error occurred while trying to acquire
+     *                           the instrumentation buffer.
+     * @throws  OutOfMemoryError The instrumentation buffer could not be mapped
+     *                           into the virtual machine's address space.
+     * @see     java.nio.ByteBuffer
+     */
+    public ByteBuffer attach(int lvmid, String mode)
+           throws IllegalArgumentException, IOException
+    {
+        if (mode.compareTo("r") == 0) {
+            return attachImpl(null, lvmid, PERF_MODE_RO);
+        }
+        else if (mode.compareTo("rw") == 0) {
+            return attachImpl(null, lvmid, PERF_MODE_RW);
+        }
+        else {
+            throw new IllegalArgumentException("unknown mode");
+        }
+    }
+
+    /**
+     * Attach to the instrumentation buffer for the specified Java virtual
+     * machine owned by the given user.
+     * <p>
+     * This method behaves just as the <code>attach(int lvmid, String mode)
+     * </code> method, except that it only searches for Java virtual machines
+     * owned by the specified user.
+     *
+     * @param   user             A <code>String</code> object containing the
+     *                           name of the user that owns the target Java
+     *                           virtual machine.
+     * @param   lvmid            an integer that uniquely identifies the
+     *                           target local Java virtual machine.
+     * @param   mode             a string indicating the attach mode.
+     * @return  ByteBuffer       a direct allocated byte buffer
+     * @throws  IllegalArgumentException  The lvmid or mode was invalid.
+     * @throws  IOException      An I/O error occurred while trying to acquire
+     *                           the instrumentation buffer.
+     * @throws  OutOfMemoryError The instrumentation buffer could not be mapped
+     *                           into the virtual machine's address space.
+     * @see     java.nio.ByteBuffer
+     */
+    public ByteBuffer attach(String user, int lvmid, String mode)
+           throws IllegalArgumentException, IOException
+    {
+        if (mode.compareTo("r") == 0) {
+            return attachImpl(user, lvmid, PERF_MODE_RO);
+        }
+        else if (mode.compareTo("rw") == 0) {
+            return attachImpl(user, lvmid, PERF_MODE_RW);
+        }
+        else {
+            throw new IllegalArgumentException("unknown mode");
+        }
+    }
+
+    /**
+     * Call the implementation specific attach method.
+     * <p>
+     * This method calls into the Java virtual machine to perform the platform
+     * specific attach method. Buffers returned from this method are
+     * internally managed as <code>PhantomRefereces</code> to provide for
+     * guaranteed, secure release of the native resources.
+     *
+     * @param   user             A <code>String</code> object containing the
+     *                           name of the user that owns the target Java
+     *                           virtual machine.
+     * @param   lvmid            an integer that uniquely identifies the
+     *                           target local Java virtual machine.
+     * @param   mode             a string indicating the attach mode.
+     * @return  ByteBuffer       a direct allocated byte buffer
+     * @throws  IllegalArgumentException  The lvmid or mode was invalid.
+     * @throws  IOException      An I/O error occurred while trying to acquire
+     *                           the instrumentation buffer.
+     * @throws  OutOfMemoryError The instrumentation buffer could not be mapped
+     *                           into the virtual machine's address space.
+     */
+    private ByteBuffer attachImpl(String user, int lvmid, int mode)
+            throws IllegalArgumentException, IOException
+    {
+        final ByteBuffer b = attach(user, lvmid, mode);
+
+        if (lvmid == 0) {
+            // The native instrumentation buffer for this Java virtual
+            // machine is never unmapped.
+            return b;
+        }
+        else {
+            // This is an instrumentation buffer for another Java virtual
+            // machine with native resources that need to be managed. We
+            // create a duplicate of the native ByteBuffer and manage it
+            // with a Cleaner. When the duplicate becomes phantom reachable,
+            // the native resources will be released.
+
+            final ByteBuffer dup = b.duplicate();
+
+            CleanerFactory.cleaner()
+                          .register(dup, new CleanerAction(instance, b));
+            return dup;
+        }
+    }
+
+    private static class CleanerAction implements Runnable {
+        private final ByteBuffer bb;
+        private final Perf perf;
+        CleanerAction(Perf perf, ByteBuffer bb) {
+            this.perf = perf;
+            this.bb = bb;
+        }
+        public void run() {
+            try {
+                perf.detach(bb);
+            } catch (Throwable th) {
+                // avoid crashing the reference handler thread,
+                // but provide for some diagnosability
+                assert false : th.toString();
+            }
+        }
+    }
+
+    /**
+     * Native method to perform the implementation specific attach mechanism.
+     * <p>
+     * The implementation of this method may return distinct or identical
+     * <code>ByteBuffer</code> objects for two distinct calls requesting
+     * attachment to the same Java virtual machine.
+     * <p>
+     * For the Sun HotSpot JVM, two distinct calls to attach to the same
+     * target Java virtual machine will result in two distinct ByteBuffer
+     * objects returned by this method. This may change in a future release.
+     *
+     * @param   user             A <code>String</code> object containing the
+     *                           name of the user that owns the target Java
+     *                           virtual machine.
+     * @param   lvmid            an integer that uniquely identifies the
+     *                           target local Java virtual machine.
+     * @param   mode             a string indicating the attach mode.
+     * @return  ByteBuffer       a direct allocated byte buffer
+     * @throws  IllegalArgumentException  The lvmid or mode was invalid.
+     * @throws  IOException      An I/O error occurred while trying to acquire
+     *                           the instrumentation buffer.
+     * @throws  OutOfMemoryError The instrumentation buffer could not be mapped
+     *                           into the virtual machine's address space.
+     */
+    private native ByteBuffer attach(String user, int lvmid, int mode)
+                   throws IllegalArgumentException, IOException;
+
+    /**
+     * Native method to perform the implementation specific detach mechanism.
+     * <p>
+     * If this method is passed a <code>ByteBuffer</code> object that is
+     * not created by the <code>attach</code> method, then the results of
+     * this method are undefined, with unpredictable and potentially damaging
+     * effects to the Java virtual machine. To prevent accidental or malicious
+     * use of this method, all native ByteBuffer created by the <code>
+     * attach</code> method are managed internally as PhantomReferences
+     * and resources are freed by the system.
+     * <p>
+     * If this method is passed a <code>ByteBuffer</code> object created
+     * by the <code>attach</code> method with a lvmid for the Java virtual
+     * machine running this method (lvmid=0, for example), then the detach
+     * request is silently ignored.
+     *
+     * @param bb  A direct allocated byte buffer created by the
+     *                    <code>attach</code> method.
+     * @see   java.nio.ByteBuffer
+     * @see   #attach
+     */
+    private native void detach(ByteBuffer bb);
+
+    /**
+     * Create a <code>long</code> scalar entry in the instrumentation buffer
+     * with the given variability characteristic, units, and initial value.
+     * <p>
+     * Access to the instrument is provided through the returned <code>
+     * ByteBuffer</code> object. Typically, this object should be wrapped
+     * with <code>LongBuffer</code> view object.
+     *
+     * @param   variability the variability characteristic for this entry.
+     * @param   units       the units for this entry.
+     * @param   name        the name of this entry.
+     * @param   value       the initial value for this entry.
+     * @return  ByteBuffer  a direct allocated ByteBuffer object that
+     *                      allows write access to a native memory location
+     *                      containing a <code>long</code> value.
+     *
+     * see sun.misc.perf.Variability
+     * see sun.misc.perf.Units
+     * @see java.nio.ByteBuffer
+     */
+    public native ByteBuffer createLong(String name, int variability,
+                                        int units, long value);
+
+    /**
+     * Create a <code>String</code> entry in the instrumentation buffer with
+     * the given variability characteristic, units, and initial value.
+     * <p>
+     * The maximum length of the <code>String</code> stored in this string
+     * instrument is given in by <code>maxLength</code> parameter. Updates
+     * to this instrument with <code>String</code> values with lengths greater
+     * than <code>maxLength</code> will be truncated to <code>maxLength</code>.
+     * The truncated value will be terminated by a null character.
+     * <p>
+     * The underlying implementation may further limit the length of the
+     * value, but will continue to preserve the null terminator.
+     * <p>
+     * Access to the instrument is provided through the returned <code>
+     * ByteBuffer</code> object.
+     *
+     * @param   variability the variability characteristic for this entry.
+     * @param   units       the units for this entry.
+     * @param   name        the name of this entry.
+     * @param   value       the initial value for this entry.
+     * @param   maxLength   the maximum string length for this string
+     *                      instrument.
+     * @return  ByteBuffer  a direct allocated ByteBuffer that allows
+     *                      write access to a native memory location
+     *                      containing a <code>long</code> value.
+     *
+     * see sun.misc.perf.Variability
+     * see sun.misc.perf.Units
+     * @see java.nio.ByteBuffer
+     */
+    public ByteBuffer createString(String name, int variability,
+                                   int units, String value, int maxLength)
+    {
+        byte[] v = getBytes(value);
+        byte[] v1 = new byte[v.length+1];
+        System.arraycopy(v, 0, v1, 0, v.length);
+        v1[v.length] = '\0';
+        return createByteArray(name, variability, units, v1, Math.max(v1.length, maxLength));
+    }
+
+    /**
+     * Create a <code>String</code> entry in the instrumentation buffer with
+     * the given variability characteristic, units, and initial value.
+     * <p>
+     * The maximum length of the <code>String</code> stored in this string
+     * instrument is implied by the length of the <code>value</code> parameter.
+     * Subsequent updates to the value of this instrument will be truncated
+     * to this implied maximum length. The truncated value will be terminated
+     * by a null character.
+     * <p>
+     * The underlying implementation may further limit the length of the
+     * initial or subsequent value, but will continue to preserve the null
+     * terminator.
+     * <p>
+     * Access to the instrument is provided through the returned <code>
+     * ByteBuffer</code> object.
+     *
+     * @param   variability the variability characteristic for this entry.
+     * @param   units       the units for this entry.
+     * @param   name        the name of this entry.
+     * @param   value       the initial value for this entry.
+     * @return  ByteBuffer  a direct allocated ByteBuffer that allows
+     *                      write access to a native memory location
+     *                      containing a <code>long</code> value.
+     *
+     * see sun.misc.perf.Variability
+     * see sun.misc.perf.Units
+     * @see java.nio.ByteBuffer
+     */
+    public ByteBuffer createString(String name, int variability,
+                                   int units, String value)
+    {
+        byte[] v = getBytes(value);
+        byte[] v1 = new byte[v.length+1];
+        System.arraycopy(v, 0, v1, 0, v.length);
+        v1[v.length] = '\0';
+        return createByteArray(name, variability, units, v1, v1.length);
+    }
+
+    /**
+     * Create a <code>byte</code> vector entry in the instrumentation buffer
+     * with the given variability characteristic, units, and initial value.
+     * <p>
+     * The <code>maxLength</code> parameter limits the size of the byte
+     * array instrument such that the initial or subsequent updates beyond
+     * this length are silently ignored. No special handling of truncated
+     * updates is provided.
+     * <p>
+     * The underlying implementation may further limit the length of the
+     * length of the initial or subsequent value.
+     * <p>
+     * Access to the instrument is provided through the returned <code>
+     * ByteBuffer</code> object.
+     *
+     * @param   variability the variability characteristic for this entry.
+     * @param   units       the units for this entry.
+     * @param   name        the name of this entry.
+     * @param   value       the initial value for this entry.
+     * @param   maxLength   the maximum length of this byte array.
+     * @return  ByteBuffer  a direct allocated byte buffer that allows
+     *                      write access to a native memory location
+     *                      containing a <code>long</code> value.
+     *
+     * see sun.misc.perf.Variability
+     * see sun.misc.perf.Units
+     * @see java.nio.ByteBuffer
+     */
+    public native ByteBuffer createByteArray(String name, int variability,
+                                             int units, byte[] value,
+                                             int maxLength);
+
+
+    /**
+     * convert string to an array of UTF-8 bytes
+     */
+    private static byte[] getBytes(String s)
+    {
+        byte[] bytes = null;
+
+        try {
+            bytes = s.getBytes("UTF-8");
+        }
+        catch (UnsupportedEncodingException e) {
+            // ignore, UTF-8 encoding is always known
+        }
+
+        return bytes;
+    }
+
+    /**
+     * Return the value of the High Resolution Counter.
+     *
+     * The High Resolution Counter returns the number of ticks since
+     * since the start of the Java virtual machine. The resolution of
+     * the counter is machine dependent and can be determined from the
+     * value return by the {@link #highResFrequency} method.
+     *
+     * @return  the number of ticks of machine dependent resolution since
+     *          the start of the Java virtual machine.
+     *
+     * @see #highResFrequency
+     * @see java.lang.System#currentTimeMillis()
+     */
+    public native long highResCounter();
+
+    /**
+     * Returns the frequency of the High Resolution Counter, in ticks per
+     * second.
+     *
+     * This value can be used to convert the value of the High Resolution
+     * Counter, as returned from a call to the {@link #highResCounter} method,
+     * into the number of seconds since the start of the Java virtual machine.
+     *
+     * @return  the frequency of the High Resolution Counter.
+     * @see #highResCounter
+     */
+    public native long highResFrequency();
+
+    private static native void registerNatives();
+
+    static {
+        registerNatives();
+        instance = new Perf();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/perf/PerfCounter.java	Wed Jan 13 10:25:41 2016 -0500
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.perf;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.LongBuffer;
+import java.security.AccessController;
+
+/**
+ * Performance counter support for internal JRE classes.
+ * This class defines a fixed list of counters for the platform
+ * to use as an interim solution until RFE# 6209222 is implemented.
+ * The perf counters will be created in the jvmstat perf buffer
+ * that the HotSpot VM creates. The default size is 32K and thus
+ * the number of counters is bounded.  You can alter the size
+ * with {@code -XX:PerfDataMemorySize=<bytes>} option. If there is
+ * insufficient memory in the jvmstat perf buffer, the C heap memory
+ * will be used and thus the application will continue to run if
+ * the counters added exceeds the buffer size but the counters
+ * will be missing.
+ *
+ * See HotSpot jvmstat implementation for certain circumstances
+ * that the jvmstat perf buffer is not supported.
+ *
+ */
+public class PerfCounter {
+    private static final Perf perf =
+        AccessController.doPrivileged(new Perf.GetPerfAction());
+
+    // Must match values defined in hotspot/src/share/vm/runtime/perfdata.hpp
+    private static final int V_Constant  = 1;
+    private static final int V_Monotonic = 2;
+    private static final int V_Variable  = 3;
+    private static final int U_None      = 1;
+
+    private final String name;
+    private final LongBuffer lb;
+
+    private PerfCounter(String name, int type) {
+        this.name = name;
+        ByteBuffer bb = perf.createLong(name, type, U_None, 0L);
+        bb.order(ByteOrder.nativeOrder());
+        this.lb = bb.asLongBuffer();
+    }
+
+    static PerfCounter newPerfCounter(String name) {
+        return new PerfCounter(name, V_Variable);
+    }
+
+    static PerfCounter newConstantPerfCounter(String name) {
+        PerfCounter c = new PerfCounter(name, V_Constant);
+        return c;
+    }
+
+    /**
+     * Returns the current value of the perf counter.
+     */
+    public synchronized long get() {
+        return lb.get(0);
+    }
+
+    /**
+     * Sets the value of the perf counter to the given newValue.
+     */
+    public synchronized void set(long newValue) {
+        lb.put(0, newValue);
+    }
+
+    /**
+     * Adds the given value to the perf counter.
+     */
+    public synchronized void add(long value) {
+        long res = get() + value;
+        lb.put(0, res);
+    }
+
+    /**
+     * Increments the perf counter with 1.
+     */
+    public void increment() {
+        add(1);
+    }
+
+    /**
+     * Adds the given interval to the perf counter.
+     */
+    public void addTime(long interval) {
+        add(interval);
+    }
+
+    /**
+     * Adds the elapsed time from the given start time (ns) to the perf counter.
+     */
+    public void addElapsedTimeFrom(long startTime) {
+        add(System.nanoTime() - startTime);
+    }
+
+    @Override
+    public String toString() {
+        return name + " = " + get();
+    }
+
+    static class CoreCounters {
+        static final PerfCounter pdt   = newPerfCounter("sun.classloader.parentDelegationTime");
+        static final PerfCounter lc    = newPerfCounter("sun.classloader.findClasses");
+        static final PerfCounter lct   = newPerfCounter("sun.classloader.findClassTime");
+        static final PerfCounter rcbt  = newPerfCounter("sun.urlClassLoader.readClassBytesTime");
+        static final PerfCounter zfc   = newPerfCounter("sun.zip.zipFiles");
+        static final PerfCounter zfot  = newPerfCounter("sun.zip.zipFile.openTime");
+    }
+
+    static class WindowsClientCounters {
+        static final PerfCounter d3dAvailable = newConstantPerfCounter("sun.java2d.d3d.available");
+    }
+
+    /**
+     * Number of findClass calls
+     */
+    public static PerfCounter getFindClasses() {
+        return CoreCounters.lc;
+    }
+
+    /**
+     * Time (ns) spent in finding classes that includes
+     * lookup and read class bytes and defineClass
+     */
+    public static PerfCounter getFindClassTime() {
+        return CoreCounters.lct;
+    }
+
+    /**
+     * Time (ns) spent in finding classes
+     */
+    public static PerfCounter getReadClassBytesTime() {
+        return CoreCounters.rcbt;
+    }
+
+    /**
+     * Time (ns) spent in the parent delegation to
+     * the parent of the defining class loader
+     */
+    public static PerfCounter getParentDelegationTime() {
+        return CoreCounters.pdt;
+    }
+
+    /**
+     * Number of zip files opened.
+     */
+    public static PerfCounter getZipFileCount() {
+        return CoreCounters.zfc;
+    }
+
+    /**
+     * Time (ns) spent in opening the zip files that
+     * includes building the entries hash table
+     */
+    public static PerfCounter getZipFileOpenTime() {
+        return CoreCounters.zfot;
+    }
+
+    /**
+     * D3D graphic pipeline available
+     */
+    public static PerfCounter getD3DAvailable() {
+        return WindowsClientCounters.d3dAvailable;
+    }
+}
--- a/jdk/src/java.base/share/classes/sun/misc/CEFormatException.java	Wed Jan 13 09:39:26 2016 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.misc;
-
-import java.io.IOException;
-
-public class CEFormatException extends IOException {
-    static final long serialVersionUID = -7139121221067081482L;
-    public CEFormatException(String s) {
-        super(s);
-    }
-}
-
--- a/jdk/src/java.base/share/classes/sun/misc/CEStreamExhausted.java	Wed Jan 13 09:39:26 2016 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.misc;
-
-import java.io.IOException;
-
-/** This exception is thrown when EOF is reached */
-public class CEStreamExhausted extends IOException {
-    static final long serialVersionUID = -5889118049525891904L;
-}
-
--- a/jdk/src/java.base/share/classes/sun/misc/JarFilter.java	Wed Jan 13 09:39:26 2016 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.misc;
-
-import java.io.File;
-import java.io.FilenameFilter;
-
-/**
- * This class checks that only jar and zip files are included in the file list.
- * This class is used in extension installation support (ExtensionDependency).
- *
- * @deprecated this class will be removed in a future release.
- * @author  Michael Colburn
- */
-@Deprecated
-public class JarFilter implements FilenameFilter {
-
-    public boolean accept(File dir, String name) {
-        String lower = name.toLowerCase();
-        return lower.endsWith(".jar") || lower.endsWith(".zip");
-    }
-}
--- a/jdk/src/java.base/share/classes/sun/misc/Perf.java	Wed Jan 13 09:39:26 2016 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,538 +0,0 @@
-/*
- * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.misc;
-
-import java.nio.ByteBuffer;
-import java.security.Permission;
-import java.security.PrivilegedAction;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-
-/**
- * The Perf class provides the ability to attach to an instrumentation
- * buffer maintained by a Java virtual machine. The instrumentation
- * buffer may be for the Java virtual machine running the methods of
- * this class or it may be for another Java virtual machine on the
- * same system.
- * <p>
- * In addition, this class provides methods to create instrumentation
- * objects in the instrumentation buffer for the Java virtual machine
- * that is running these methods. It also contains methods for acquiring
- * the value of a platform specific high resolution clock for time
- * stamp and interval measurement purposes.
- *
- * @author   Brian Doherty
- * @since    1.4.2
- * @see      #getPerf
- * @see      sun.misc.Perf$GetPerfAction
- * @see      java.nio.ByteBuffer
- */
-public final class Perf {
-
-    private static Perf instance;
-
-    private static final int PERF_MODE_RO = 0;
-    private static final int PERF_MODE_RW = 1;
-
-    private Perf() { }    // prevent instantiation
-
-    /**
-     * The GetPerfAction class is a convenience class for acquiring access
-     * to the singleton Perf instance using the
-     * <code>AccessController.doPrivileged()</code> method.
-     * <p>
-     * An instance of this class can be used as the argument to
-     * <code>AccessController.doPrivileged(PrivilegedAction)</code>.
-     * <p> Here is a suggested idiom for use of this class:
-     *
-     * <blockquote><pre>{@code
-     * class MyTrustedClass {
-     *   private static final Perf perf =
-     *       AccessController.doPrivileged(new Perf.GetPerfAction<Perf>());
-     *   ...
-     * }
-     * }</pre></blockquote>
-     * <p>
-     * In the presence of a security manager, the <code>MyTrustedClass</code>
-     * class in the above example will need to be granted the
-     * <em>"sun.misc.Perf.getPerf"</em> <code>RuntimePermission</code>
-     * permission in order to successfully acquire the singleton Perf instance.
-     * <p>
-     * Please note that the <em>"sun.misc.Perf.getPerf"</em> permission
-     * is not a JDK specified permission.
-     *
-     * @see  java.security.AccessController#doPrivileged(PrivilegedAction)
-     * @see  java.lang.RuntimePermission
-     */
-    public static class GetPerfAction implements PrivilegedAction<Perf>
-    {
-        /**
-         * Run the <code>Perf.getPerf()</code> method in a privileged context.
-         *
-         * @see #getPerf
-         */
-        public Perf run() {
-            return getPerf();
-        }
-    }
-
-    /**
-     * Return a reference to the singleton Perf instance.
-     * <p>
-     * The getPerf() method returns the singleton instance of the Perf
-     * class. The returned object provides the caller with the capability
-     * for accessing the instrumentation buffer for this or another local
-     * Java virtual machine.
-     * <p>
-     * If a security manager is installed, its <code>checkPermission</code>
-     * method is called with a <code>RuntimePermission</code> with a target
-     * of <em>"sun.misc.Perf.getPerf"</em>. A security exception will result
-     * if the caller has not been granted this permission.
-     * <p>
-     * Access to the returned <code>Perf</code> object should be protected
-     * by its caller and not passed on to untrusted code. This object can
-     * be used to attach to the instrumentation buffer provided by this Java
-     * virtual machine or for those of other Java virtual machines running
-     * on the same system. The instrumentation buffer may contain senstitive
-     * information. API's built on top of this interface may want to provide
-     * finer grained access control to the contents of individual
-     * instrumentation objects contained within the buffer.
-     * <p>
-     * Please note that the <em>"sun.misc.Perf.getPerf"</em> permission
-     * is not a JDK specified permission.
-     *
-     * @return       A reference to the singleton Perf instance.
-     * @throws AccessControlException  if a security manager exists and
-     *               its <code>checkPermission</code> method doesn't allow
-     *               access to the <em>"sun.misc.Perf.getPerf"</em> target.
-     * @see  java.lang.RuntimePermission
-     * @see  #attach
-     */
-    public static Perf getPerf()
-    {
-        SecurityManager security = System.getSecurityManager();
-        if (security != null) {
-            Permission perm = new RuntimePermission("sun.misc.Perf.getPerf");
-            security.checkPermission(perm);
-        }
-
-        return instance;
-    }
-
-    /**
-     * Attach to the instrumentation buffer for the specified Java virtual
-     * machine.
-     * <p>
-     * This method will attach to the instrumentation buffer for the
-     * specified virtual machine. It returns a <code>ByteBuffer</code> object
-     * that is initialized to access the instrumentation buffer for the
-     * indicated Java virtual machine. The <code>lvmid</code> parameter is
-     * a integer value that uniquely identifies the target local Java virtual
-     * machine. It is typically, but not necessarily, the process id of
-     * the target Java virtual machine.
-     * <p>
-     * If the <code>lvmid</code> identifies a Java virtual machine different
-     * from the one running this method, then the coherency characteristics
-     * of the buffer are implementation dependent. Implementations that do
-     * not support named, coherent, shared memory may return a
-     * <code>ByteBuffer</code> object that contains only a snap shot of the
-     * data in the instrumentation buffer. Implementations that support named,
-     * coherent, shared memory, may return a <code>ByteBuffer</code> object
-     * that will be changing dynamically over time as the target Java virtual
-     * machine updates its mapping of this buffer.
-     * <p>
-     * If the <code>lvmid</code> is 0 or equal to the actual <code>lvmid</code>
-     * for the Java virtual machine running this method, then the returned
-     * <code>ByteBuffer</code> object will always be coherent and dynamically
-     * changing.
-     * <p>
-     * The attach mode specifies the access permissions requested for the
-     * instrumentation buffer of the target virtual machine. The permitted
-     * access permissions are:
-     * <ul>
-     * <li>"r"  - Read only access. This Java virtual machine has only
-     * read access to the instrumentation buffer for the target Java
-     * virtual machine.
-     * <li>"rw"  - Read/Write access. This Java virtual machine has read and
-     * write access to the instrumentation buffer for the target Java virtual
-     * machine. This mode is currently not supported and is reserved for
-     * future enhancements.
-     * </ul>
-     *
-     * @param   lvmid            an integer that uniquely identifies the
-     *                           target local Java virtual machine.
-     * @param   mode             a string indicating the attach mode.
-     * @return  ByteBuffer       a direct allocated byte buffer
-     * @throws  IllegalArgumentException  The lvmid or mode was invalid.
-     * @throws  IOException      An I/O error occurred while trying to acquire
-     *                           the instrumentation buffer.
-     * @throws  OutOfMemoryError The instrumentation buffer could not be mapped
-     *                           into the virtual machine's address space.
-     * @see     java.nio.ByteBuffer
-     */
-    public ByteBuffer attach(int lvmid, String mode)
-           throws IllegalArgumentException, IOException
-    {
-        if (mode.compareTo("r") == 0) {
-            return attachImpl(null, lvmid, PERF_MODE_RO);
-        }
-        else if (mode.compareTo("rw") == 0) {
-            return attachImpl(null, lvmid, PERF_MODE_RW);
-        }
-        else {
-            throw new IllegalArgumentException("unknown mode");
-        }
-    }
-
-    /**
-     * Attach to the instrumentation buffer for the specified Java virtual
-     * machine owned by the given user.
-     * <p>
-     * This method behaves just as the <code>attach(int lvmid, String mode)
-     * </code> method, except that it only searches for Java virtual machines
-     * owned by the specified user.
-     *
-     * @param   user             A <code>String</code> object containing the
-     *                           name of the user that owns the target Java
-     *                           virtual machine.
-     * @param   lvmid            an integer that uniquely identifies the
-     *                           target local Java virtual machine.
-     * @param   mode             a string indicating the attach mode.
-     * @return  ByteBuffer       a direct allocated byte buffer
-     * @throws  IllegalArgumentException  The lvmid or mode was invalid.
-     * @throws  IOException      An I/O error occurred while trying to acquire
-     *                           the instrumentation buffer.
-     * @throws  OutOfMemoryError The instrumentation buffer could not be mapped
-     *                           into the virtual machine's address space.
-     * @see     java.nio.ByteBuffer
-     */
-    public ByteBuffer attach(String user, int lvmid, String mode)
-           throws IllegalArgumentException, IOException
-    {
-        if (mode.compareTo("r") == 0) {
-            return attachImpl(user, lvmid, PERF_MODE_RO);
-        }
-        else if (mode.compareTo("rw") == 0) {
-            return attachImpl(user, lvmid, PERF_MODE_RW);
-        }
-        else {
-            throw new IllegalArgumentException("unknown mode");
-        }
-    }
-
-    /**
-     * Call the implementation specific attach method.
-     * <p>
-     * This method calls into the Java virtual machine to perform the platform
-     * specific attach method. Buffers returned from this method are
-     * internally managed as <code>PhantomRefereces</code> to provide for
-     * guaranteed, secure release of the native resources.
-     *
-     * @param   user             A <code>String</code> object containing the
-     *                           name of the user that owns the target Java
-     *                           virtual machine.
-     * @param   lvmid            an integer that uniquely identifies the
-     *                           target local Java virtual machine.
-     * @param   mode             a string indicating the attach mode.
-     * @return  ByteBuffer       a direct allocated byte buffer
-     * @throws  IllegalArgumentException  The lvmid or mode was invalid.
-     * @throws  IOException      An I/O error occurred while trying to acquire
-     *                           the instrumentation buffer.
-     * @throws  OutOfMemoryError The instrumentation buffer could not be mapped
-     *                           into the virtual machine's address space.
-     */
-    private ByteBuffer attachImpl(String user, int lvmid, int mode)
-            throws IllegalArgumentException, IOException
-    {
-        final ByteBuffer b = attach(user, lvmid, mode);
-
-        if (lvmid == 0) {
-            // The native instrumentation buffer for this Java virtual
-            // machine is never unmapped.
-            return b;
-        }
-        else {
-            // This is an instrumentation buffer for another Java virtual
-            // machine with native resources that need to be managed. We
-            // create a duplicate of the native ByteBuffer and manage it
-            // with a Cleaner object (PhantomReference). When the duplicate
-            // becomes only phantomly reachable, the native resources will
-            // be released.
-
-            final ByteBuffer dup = b.duplicate();
-            Cleaner.create(dup, new Runnable() {
-                    public void run() {
-                        try {
-                            instance.detach(b);
-                        }
-                        catch (Throwable th) {
-                            // avoid crashing the reference handler thread,
-                            // but provide for some diagnosability
-                            assert false : th.toString();
-                        }
-                    }
-                });
-            return dup;
-        }
-    }
-
-    /**
-     * Native method to perform the implementation specific attach mechanism.
-     * <p>
-     * The implementation of this method may return distinct or identical
-     * <code>ByteBuffer</code> objects for two distinct calls requesting
-     * attachment to the same Java virtual machine.
-     * <p>
-     * For the Sun HotSpot JVM, two distinct calls to attach to the same
-     * target Java virtual machine will result in two distinct ByteBuffer
-     * objects returned by this method. This may change in a future release.
-     *
-     * @param   user             A <code>String</code> object containing the
-     *                           name of the user that owns the target Java
-     *                           virtual machine.
-     * @param   lvmid            an integer that uniquely identifies the
-     *                           target local Java virtual machine.
-     * @param   mode             a string indicating the attach mode.
-     * @return  ByteBuffer       a direct allocated byte buffer
-     * @throws  IllegalArgumentException  The lvmid or mode was invalid.
-     * @throws  IOException      An I/O error occurred while trying to acquire
-     *                           the instrumentation buffer.
-     * @throws  OutOfMemoryError The instrumentation buffer could not be mapped
-     *                           into the virtual machine's address space.
-     */
-    private native ByteBuffer attach(String user, int lvmid, int mode)
-                   throws IllegalArgumentException, IOException;
-
-    /**
-     * Native method to perform the implementation specific detach mechanism.
-     * <p>
-     * If this method is passed a <code>ByteBuffer</code> object that is
-     * not created by the <code>attach</code> method, then the results of
-     * this method are undefined, with unpredictable and potentially damaging
-     * effects to the Java virtual machine. To prevent accidental or malicious
-     * use of this method, all native ByteBuffer created by the <code>
-     * attach</code> method are managed internally as PhantomReferences
-     * and resources are freed by the system.
-     * <p>
-     * If this method is passed a <code>ByteBuffer</code> object created
-     * by the <code>attach</code> method with a lvmid for the Java virtual
-     * machine running this method (lvmid=0, for example), then the detach
-     * request is silently ignored.
-     *
-     * @param ByteBuffer  A direct allocated byte buffer created by the
-     *                    <code>attach</code> method.
-     * @see   java.nio.ByteBuffer
-     * @see   #attach
-     */
-    private native void detach(ByteBuffer bb);
-
-    /**
-     * Create a <code>long</code> scalar entry in the instrumentation buffer
-     * with the given variability characteristic, units, and initial value.
-     * <p>
-     * Access to the instrument is provided through the returned <code>
-     * ByteBuffer</code> object. Typically, this object should be wrapped
-     * with <code>LongBuffer</code> view object.
-     *
-     * @param   variability the variability characteristic for this entry.
-     * @param   units       the units for this entry.
-     * @param   name        the name of this entry.
-     * @param   value       the initial value for this entry.
-     * @return  ByteBuffer  a direct allocated ByteBuffer object that
-     *                      allows write access to a native memory location
-     *                      containing a <code>long</code> value.
-     *
-     * see sun.misc.perf.Variability
-     * see sun.misc.perf.Units
-     * @see java.nio.ByteBuffer
-     */
-    public native ByteBuffer createLong(String name, int variability,
-                                        int units, long value);
-
-    /**
-     * Create a <code>String</code> entry in the instrumentation buffer with
-     * the given variability characteristic, units, and initial value.
-     * <p>
-     * The maximum length of the <code>String</code> stored in this string
-     * instrument is given in by <code>maxLength</code> parameter. Updates
-     * to this instrument with <code>String</code> values with lengths greater
-     * than <code>maxLength</code> will be truncated to <code>maxLength</code>.
-     * The truncated value will be terminated by a null character.
-     * <p>
-     * The underlying implementation may further limit the length of the
-     * value, but will continue to preserve the null terminator.
-     * <p>
-     * Access to the instrument is provided through the returned <code>
-     * ByteBuffer</code> object.
-     *
-     * @param   variability the variability characteristic for this entry.
-     * @param   units       the units for this entry.
-     * @param   name        the name of this entry.
-     * @param   value       the initial value for this entry.
-     * @param   maxLength   the maximum string length for this string
-     *                      instrument.
-     * @return  ByteBuffer  a direct allocated ByteBuffer that allows
-     *                      write access to a native memory location
-     *                      containing a <code>long</code> value.
-     *
-     * see sun.misc.perf.Variability
-     * see sun.misc.perf.Units
-     * @see java.nio.ByteBuffer
-     */
-    public ByteBuffer createString(String name, int variability,
-                                   int units, String value, int maxLength)
-    {
-        byte[] v = getBytes(value);
-        byte[] v1 = new byte[v.length+1];
-        System.arraycopy(v, 0, v1, 0, v.length);
-        v1[v.length] = '\0';
-        return createByteArray(name, variability, units, v1, Math.max(v1.length, maxLength));
-    }
-
-    /**
-     * Create a <code>String</code> entry in the instrumentation buffer with
-     * the given variability characteristic, units, and initial value.
-     * <p>
-     * The maximum length of the <code>String</code> stored in this string
-     * instrument is implied by the length of the <code>value</code> parameter.
-     * Subsequent updates to the value of this instrument will be truncated
-     * to this implied maximum length. The truncated value will be terminated
-     * by a null character.
-     * <p>
-     * The underlying implementation may further limit the length of the
-     * initial or subsequent value, but will continue to preserve the null
-     * terminator.
-     * <p>
-     * Access to the instrument is provided through the returned <code>
-     * ByteBuffer</code> object.
-     *
-     * @param   variability the variability characteristic for this entry.
-     * @param   units       the units for this entry.
-     * @param   name        the name of this entry.
-     * @param   value       the initial value for this entry.
-     * @return  ByteBuffer  a direct allocated ByteBuffer that allows
-     *                      write access to a native memory location
-     *                      containing a <code>long</code> value.
-     *
-     * see sun.misc.perf.Variability
-     * see sun.misc.perf.Units
-     * @see java.nio.ByteBuffer
-     */
-    public ByteBuffer createString(String name, int variability,
-                                   int units, String value)
-    {
-        byte[] v = getBytes(value);
-        byte[] v1 = new byte[v.length+1];
-        System.arraycopy(v, 0, v1, 0, v.length);
-        v1[v.length] = '\0';
-        return createByteArray(name, variability, units, v1, v1.length);
-    }
-
-    /**
-     * Create a <code>byte</code> vector entry in the instrumentation buffer
-     * with the given variability characteristic, units, and initial value.
-     * <p>
-     * The <code>maxLength</code> parameter limits the size of the byte
-     * array instrument such that the initial or subsequent updates beyond
-     * this length are silently ignored. No special handling of truncated
-     * updates is provided.
-     * <p>
-     * The underlying implementation may further limit the length of the
-     * length of the initial or subsequent value.
-     * <p>
-     * Access to the instrument is provided through the returned <code>
-     * ByteBuffer</code> object.
-     *
-     * @param   variability the variability characteristic for this entry.
-     * @param   units       the units for this entry.
-     * @param   name        the name of this entry.
-     * @param   value       the initial value for this entry.
-     * @param   maxLength   the maximum length of this byte array.
-     * @return  ByteBuffer  a direct allocated byte buffer that allows
-     *                      write access to a native memory location
-     *                      containing a <code>long</code> value.
-     *
-     * see sun.misc.perf.Variability
-     * see sun.misc.perf.Units
-     * @see java.nio.ByteBuffer
-     */
-    public native ByteBuffer createByteArray(String name, int variability,
-                                             int units, byte[] value,
-                                             int maxLength);
-
-
-    /**
-     * convert string to an array of UTF-8 bytes
-     */
-    private static byte[] getBytes(String s)
-    {
-        byte[] bytes = null;
-
-        try {
-            bytes = s.getBytes("UTF-8");
-        }
-        catch (UnsupportedEncodingException e) {
-            // ignore, UTF-8 encoding is always known
-        }
-
-        return bytes;
-    }
-
-    /**
-     * Return the value of the High Resolution Counter.
-     *
-     * The High Resolution Counter returns the number of ticks since
-     * since the start of the Java virtual machine. The resolution of
-     * the counter is machine dependent and can be determined from the
-     * value return by the {@link #highResFrequency} method.
-     *
-     * @return  the number of ticks of machine dependent resolution since
-     *          the start of the Java virtual machine.
-     *
-     * @see #highResFrequency
-     * @see java.lang.System#currentTimeMillis()
-     */
-    public native long highResCounter();
-
-    /**
-     * Returns the frequency of the High Resolution Counter, in ticks per
-     * second.
-     *
-     * This value can be used to convert the value of the High Resolution
-     * Counter, as returned from a call to the {@link #highResCounter} method,
-     * into the number of seconds since the start of the Java virtual machine.
-     *
-     * @return  the frequency of the High Resolution Counter.
-     * @see #highResCounter
-     */
-    public native long highResFrequency();
-
-    private static native void registerNatives();
-
-    static {
-        registerNatives();
-        instance = new Perf();
-    }
-}
--- a/jdk/src/java.base/share/classes/sun/misc/PerfCounter.java	Wed Jan 13 09:39:26 2016 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,191 +0,0 @@
-/*
- * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.misc;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.nio.LongBuffer;
-import java.security.AccessController;
-
-/**
- * Performance counter support for internal JRE classes.
- * This class defines a fixed list of counters for the platform
- * to use as an interim solution until RFE# 6209222 is implemented.
- * The perf counters will be created in the jvmstat perf buffer
- * that the HotSpot VM creates. The default size is 32K and thus
- * the number of counters is bounded.  You can alter the size
- * with {@code -XX:PerfDataMemorySize=<bytes>} option. If there is
- * insufficient memory in the jvmstat perf buffer, the C heap memory
- * will be used and thus the application will continue to run if
- * the counters added exceeds the buffer size but the counters
- * will be missing.
- *
- * See HotSpot jvmstat implementation for certain circumstances
- * that the jvmstat perf buffer is not supported.
- *
- */
-public class PerfCounter {
-    private static final Perf perf =
-        AccessController.doPrivileged(new Perf.GetPerfAction());
-
-    // Must match values defined in hotspot/src/share/vm/runtime/perfdata.hpp
-    private static final int V_Constant  = 1;
-    private static final int V_Monotonic = 2;
-    private static final int V_Variable  = 3;
-    private static final int U_None      = 1;
-
-    private final String name;
-    private final LongBuffer lb;
-
-    private PerfCounter(String name, int type) {
-        this.name = name;
-        ByteBuffer bb = perf.createLong(name, type, U_None, 0L);
-        bb.order(ByteOrder.nativeOrder());
-        this.lb = bb.asLongBuffer();
-    }
-
-    static PerfCounter newPerfCounter(String name) {
-        return new PerfCounter(name, V_Variable);
-    }
-
-    static PerfCounter newConstantPerfCounter(String name) {
-        PerfCounter c = new PerfCounter(name, V_Constant);
-        return c;
-    }
-
-    /**
-     * Returns the current value of the perf counter.
-     */
-    public synchronized long get() {
-        return lb.get(0);
-    }
-
-    /**
-     * Sets the value of the perf counter to the given newValue.
-     */
-    public synchronized void set(long newValue) {
-        lb.put(0, newValue);
-    }
-
-    /**
-     * Adds the given value to the perf counter.
-     */
-    public synchronized void add(long value) {
-        long res = get() + value;
-        lb.put(0, res);
-    }
-
-    /**
-     * Increments the perf counter with 1.
-     */
-    public void increment() {
-        add(1);
-    }
-
-    /**
-     * Adds the given interval to the perf counter.
-     */
-    public void addTime(long interval) {
-        add(interval);
-    }
-
-    /**
-     * Adds the elapsed time from the given start time (ns) to the perf counter.
-     */
-    public void addElapsedTimeFrom(long startTime) {
-        add(System.nanoTime() - startTime);
-    }
-
-    @Override
-    public String toString() {
-        return name + " = " + get();
-    }
-
-    static class CoreCounters {
-        static final PerfCounter pdt   = newPerfCounter("sun.classloader.parentDelegationTime");
-        static final PerfCounter lc    = newPerfCounter("sun.classloader.findClasses");
-        static final PerfCounter lct   = newPerfCounter("sun.classloader.findClassTime");
-        static final PerfCounter rcbt  = newPerfCounter("sun.urlClassLoader.readClassBytesTime");
-        static final PerfCounter zfc   = newPerfCounter("sun.zip.zipFiles");
-        static final PerfCounter zfot  = newPerfCounter("sun.zip.zipFile.openTime");
-    }
-
-    static class WindowsClientCounters {
-        static final PerfCounter d3dAvailable = newConstantPerfCounter("sun.java2d.d3d.available");
-    }
-
-    /**
-     * Number of findClass calls
-     */
-    public static PerfCounter getFindClasses() {
-        return CoreCounters.lc;
-    }
-
-    /**
-     * Time (ns) spent in finding classes that includes
-     * lookup and read class bytes and defineClass
-     */
-    public static PerfCounter getFindClassTime() {
-        return CoreCounters.lct;
-    }
-
-    /**
-     * Time (ns) spent in finding classes
-     */
-    public static PerfCounter getReadClassBytesTime() {
-        return CoreCounters.rcbt;
-    }
-
-    /**
-     * Time (ns) spent in the parent delegation to
-     * the parent of the defining class loader
-     */
-    public static PerfCounter getParentDelegationTime() {
-        return CoreCounters.pdt;
-    }
-
-    /**
-     * Number of zip files opened.
-     */
-    public static PerfCounter getZipFileCount() {
-        return CoreCounters.zfc;
-    }
-
-    /**
-     * Time (ns) spent in opening the zip files that
-     * includes building the entries hash table
-     */
-    public static PerfCounter getZipFileOpenTime() {
-        return CoreCounters.zfot;
-    }
-
-    /**
-     * D3D graphic pipeline available
-     */
-    public static PerfCounter getD3DAvailable() {
-        return WindowsClientCounters.d3dAvailable;
-    }
-}
--- a/jdk/src/java.base/share/classes/sun/misc/PerformanceLogger.java	Wed Jan 13 09:39:26 2016 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,317 +0,0 @@
-/*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-
-package sun.misc;
-
-import java.util.Vector;
-import java.io.FileWriter;
-import java.io.File;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-
-/**
- * This class is intended to be a central place for the jdk to
- * log timing events of interest.  There is pre-defined event
- * of startTime, as well as a general
- * mechanism of setting arbitrary times in an array.
- * All unreserved times in the array can be used by callers
- * in application-defined situations.  The caller is responsible
- * for setting and getting all times and for doing whatever
- * analysis is interesting; this class is merely a central container
- * for those timing values.
- * Note that, due to the variables in this class being static,
- * use of particular time values by multiple applets will cause
- * confusing results.  For example, if plugin runs two applets
- * simultaneously, the initTime for those applets will collide
- * and the results may be undefined.
- * <P>
- * To automatically track startup performance in an app or applet,
- * use the command-line parameter sun.perflog as follows:<BR>
- * <pre>{@code
- *     -Dsun.perflog[=file:<filename>]
- * }</pre>
- * <BR>
- * where simply using the parameter with no value will enable output
- * to the console and a value of "{@code file:<filename>}" will cause
- * that given filename to be created and used for all output.
- * <P>
- * By default, times are measured using System.currentTimeMillis().  To use
- * System.nanoTime() instead, add the command-line parameter:<BR>
-       -Dsun.perflog.nano=true
- * <BR>
- * <P>
- * <B>Warning: Use at your own risk!</B>
- * This class is intended for internal testing
- * purposes only and may be removed at any time.  More
- * permanent monitoring and profiling APIs are expected to be
- * developed for future releases and this class will cease to
- * exist once those APIs are in place.
- * @author Chet Haase
- */
-public class PerformanceLogger {
-
-    // Timing values of global interest
-    private static final int START_INDEX    = 0;    // VM start
-    private static final int LAST_RESERVED  = START_INDEX;
-
-    private static boolean perfLoggingOn = false;
-    private static boolean useNanoTime = false;
-    private static Vector<TimeData> times;
-    private static String logFileName = null;
-    private static Writer logWriter = null;
-    private static long baseTime;
-
-    static {
-        String perfLoggingProp =
-            java.security.AccessController.doPrivileged(
-            new sun.security.action.GetPropertyAction("sun.perflog"));
-        if (perfLoggingProp != null) {
-            perfLoggingOn = true;
-
-            // Check if we should use nanoTime
-            String perfNanoProp =
-                java.security.AccessController.doPrivileged(
-                new sun.security.action.GetPropertyAction("sun.perflog.nano"));
-            if (perfNanoProp != null) {
-                useNanoTime = true;
-            }
-
-            // Now, figure out what the user wants to do with the data
-            if (perfLoggingProp.regionMatches(true, 0, "file:", 0, 5)) {
-                logFileName = perfLoggingProp.substring(5);
-            }
-            if (logFileName != null) {
-                if (logWriter == null) {
-                    java.security.AccessController.doPrivileged(
-                    new java.security.PrivilegedAction<Void>() {
-                        public Void run() {
-                            try {
-                                File logFile = new File(logFileName);
-                                logFile.createNewFile();
-                                logWriter = new FileWriter(logFile);
-                            } catch (Exception e) {
-                                System.out.println(e + ": Creating logfile " +
-                                                   logFileName +
-                                                   ".  Log to console");
-                            }
-                            return null;
-                        }
-                    });
-                }
-            }
-            if (logWriter == null) {
-                logWriter = new OutputStreamWriter(System.out);
-            }
-        }
-        times = new Vector<TimeData>(10);
-        // Reserve predefined slots
-        for (int i = 0; i <= LAST_RESERVED; ++i) {
-            times.add(new TimeData("Time " + i + " not set", 0));
-        }
-    }
-
-    /**
-     * Returns status of whether logging is enabled or not.  This is
-     * provided as a convenience method so that users do not have to
-     * perform the same GetPropertyAction check as above to determine whether
-     * to enable performance logging.
-     */
-    public static boolean loggingEnabled() {
-        return perfLoggingOn;
-    }
-
-
-    /**
-     * Internal class used to store time/message data together.
-     */
-    static class TimeData {
-        String message;
-        long time;
-
-        TimeData(String message, long time) {
-            this.message = message;
-            this.time = time;
-        }
-
-        String getMessage() {
-            return message;
-        }
-
-        long getTime() {
-            return time;
-        }
-    }
-
-    /**
-     * Return the current time, in millis or nanos as appropriate
-     */
-    private static long getCurrentTime() {
-        if (useNanoTime) {
-            return System.nanoTime();
-        } else {
-            return System.currentTimeMillis();
-        }
-    }
-
-    /**
-     * Sets the start time.  Ideally, this is the earliest time available
-     * during the startup of a Java applet or application.  This time is
-     * later used to analyze the difference between the initial startup
-     * time and other events in the system (such as an applet's init time).
-     */
-    public static void setStartTime(String message) {
-        if (loggingEnabled()) {
-            long nowTime = getCurrentTime();
-            setStartTime(message, nowTime);
-        }
-    }
-
-    /**
-     * Sets the base time, output can then
-     * be displayed as offsets from the base time;.
-     */
-    public static void setBaseTime(long time) {
-        if (loggingEnabled()) {
-            baseTime = time;
-        }
-    }
-
-    /**
-     * Sets the start time.
-     * This version of the method is
-     * given the time to log, instead of expecting this method to
-     * get the time itself.  This is done in case the time was
-     * recorded much earlier than this method was called.
-     */
-    public static void setStartTime(String message, long time) {
-        if (loggingEnabled()) {
-            times.set(START_INDEX, new TimeData(message, time));
-        }
-    }
-
-    /**
-     * Gets the start time, which should be the time when
-     * the java process started, prior to the VM actually being
-     * loaded.
-     */
-    public static long getStartTime() {
-        if (loggingEnabled()) {
-            return times.get(START_INDEX).getTime();
-        } else {
-            return 0;
-        }
-    }
-
-    /**
-     * Sets the value of a given time and returns the index of the
-     * slot that that time was stored in.
-     */
-    public static int setTime(String message) {
-        if (loggingEnabled()) {
-            long nowTime = getCurrentTime();
-            return setTime(message, nowTime);
-        } else {
-            return 0;
-        }
-    }
-
-    /**
-     * Sets the value of a given time and returns the index of the
-     * slot that that time was stored in.
-     * This version of the method is
-     * given the time to log, instead of expecting this method to
-     * get the time itself.  This is done in case the time was
-     * recorded much earlier than this method was called.
-     */
-    public static int setTime(String message, long time) {
-        if (loggingEnabled()) {
-            // times is already synchronized, but we need to ensure that
-            // the size used in times.set() is the same used when returning
-            // the index of that operation.
-            synchronized (times) {
-                times.add(new TimeData(message, time));
-                return (times.size() - 1);
-            }
-        } else {
-            return 0;
-        }
-    }
-
-    /**
-     * Returns time at given index.
-     */
-    public static long getTimeAtIndex(int index) {
-        if (loggingEnabled()) {
-            return times.get(index).getTime();
-        } else {
-            return 0;
-        }
-    }
-
-    /**
-     * Returns message at given index.
-     */
-    public static String getMessageAtIndex(int index) {
-        if (loggingEnabled()) {
-            return times.get(index).getMessage();
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     * Outputs all data to parameter-specified Writer object
-     */
-    public static void outputLog(Writer writer) {
-        if (loggingEnabled()) {
-            try {
-                synchronized(times) {
-                    for (int i = 0; i < times.size(); ++i) {
-                        TimeData td = times.get(i);
-                        if (td != null) {
-                            writer.write(i + " " + td.getMessage() + ": " +
-                                         (td.getTime() - baseTime) + "\n");
-
-                        }
-                    }
-                }
-                writer.flush();
-            } catch (Exception e) {
-                System.out.println(e + ": Writing performance log to " +
-                                   writer);
-            }
-        }
-    }
-
-    /**
-     * Outputs all data to whatever location the user specified
-     * via sun.perflog command-line parameter.
-     */
-    public static void outputLog() {
-        outputLog(logWriter);
-    }
-}
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java	Wed Jan 13 09:39:26 2016 -0500
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java	Wed Jan 13 10:25:41 2016 -0500
@@ -43,8 +43,8 @@
 import sun.awt.AppContext;
 import sun.awt.EmbeddedFrame;
 import sun.awt.SunToolkit;
+import sun.awt.util.PerformanceLogger;
 import sun.misc.ManagedLocalsThread;
-import sun.misc.PerformanceLogger;
 import sun.security.util.SecurityConstants;
 
 /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/awt/util/PerformanceLogger.java	Wed Jan 13 10:25:41 2016 -0500
@@ -0,0 +1,317 @@
+/*
+ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+
+package sun.awt.util;
+
+import java.util.Vector;
+import java.io.FileWriter;
+import java.io.File;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+
+/**
+ * This class is intended to be a central place for the jdk to
+ * log timing events of interest.  There is pre-defined event
+ * of startTime, as well as a general
+ * mechanism of setting arbitrary times in an array.
+ * All unreserved times in the array can be used by callers
+ * in application-defined situations.  The caller is responsible
+ * for setting and getting all times and for doing whatever
+ * analysis is interesting; this class is merely a central container
+ * for those timing values.
+ * Note that, due to the variables in this class being static,
+ * use of particular time values by multiple applets will cause
+ * confusing results.  For example, if plugin runs two applets
+ * simultaneously, the initTime for those applets will collide
+ * and the results may be undefined.
+ * <P>
+ * To automatically track startup performance in an app or applet,
+ * use the command-line parameter sun.perflog as follows:<BR>
+ * <pre>{@code
+ *     -Dsun.perflog[=file:<filename>]
+ * }</pre>
+ * <BR>
+ * where simply using the parameter with no value will enable output
+ * to the console and a value of "{@code file:<filename>}" will cause
+ * that given filename to be created and used for all output.
+ * <P>
+ * By default, times are measured using System.currentTimeMillis().  To use
+ * System.nanoTime() instead, add the command-line parameter:<BR>
+       -Dsun.perflog.nano=true
+ * <BR>
+ * <P>
+ * <B>Warning: Use at your own risk!</B>
+ * This class is intended for internal testing
+ * purposes only and may be removed at any time.  More
+ * permanent monitoring and profiling APIs are expected to be
+ * developed for future releases and this class will cease to
+ * exist once those APIs are in place.
+ * @author Chet Haase
+ */
+public class PerformanceLogger {
+
+    // Timing values of global interest
+    private static final int START_INDEX    = 0;    // VM start
+    private static final int LAST_RESERVED  = START_INDEX;
+
+    private static boolean perfLoggingOn = false;
+    private static boolean useNanoTime = false;
+    private static Vector<TimeData> times;
+    private static String logFileName = null;
+    private static Writer logWriter = null;
+    private static long baseTime;
+
+    static {
+        String perfLoggingProp =
+            java.security.AccessController.doPrivileged(
+            new sun.security.action.GetPropertyAction("sun.perflog"));
+        if (perfLoggingProp != null) {
+            perfLoggingOn = true;
+
+            // Check if we should use nanoTime
+            String perfNanoProp =
+                java.security.AccessController.doPrivileged(
+                new sun.security.action.GetPropertyAction("sun.perflog.nano"));
+            if (perfNanoProp != null) {
+                useNanoTime = true;
+            }
+
+            // Now, figure out what the user wants to do with the data
+            if (perfLoggingProp.regionMatches(true, 0, "file:", 0, 5)) {
+                logFileName = perfLoggingProp.substring(5);
+            }
+            if (logFileName != null) {
+                if (logWriter == null) {
+                    java.security.AccessController.doPrivileged(
+                    new java.security.PrivilegedAction<Void>() {
+                        public Void run() {
+                            try {
+                                File logFile = new File(logFileName);
+                                logFile.createNewFile();
+                                logWriter = new FileWriter(logFile);
+                            } catch (Exception e) {
+                                System.out.println(e + ": Creating logfile " +
+                                                   logFileName +
+                                                   ".  Log to console");
+                            }
+                            return null;
+                        }
+                    });
+                }
+            }
+            if (logWriter == null) {
+                logWriter = new OutputStreamWriter(System.out);
+            }
+        }
+        times = new Vector<TimeData>(10);
+        // Reserve predefined slots
+        for (int i = 0; i <= LAST_RESERVED; ++i) {
+            times.add(new TimeData("Time " + i + " not set", 0));
+        }
+    }
+
+    /**
+     * Returns status of whether logging is enabled or not.  This is
+     * provided as a convenience method so that users do not have to
+     * perform the same GetPropertyAction check as above to determine whether
+     * to enable performance logging.
+     */
+    public static boolean loggingEnabled() {
+        return perfLoggingOn;
+    }
+
+
+    /**
+     * Internal class used to store time/message data together.
+     */
+    static class TimeData {
+        String message;
+        long time;
+
+        TimeData(String message, long time) {
+            this.message = message;
+            this.time = time;
+        }
+
+        String getMessage() {
+            return message;
+        }
+
+        long getTime() {
+            return time;
+        }
+    }
+
+    /**
+     * Return the current time, in millis or nanos as appropriate
+     */
+    private static long getCurrentTime() {
+        if (useNanoTime) {
+            return System.nanoTime();
+        } else {
+            return System.currentTimeMillis();
+        }
+    }
+
+    /**
+     * Sets the start time.  Ideally, this is the earliest time available
+     * during the startup of a Java applet or application.  This time is
+     * later used to analyze the difference between the initial startup
+     * time and other events in the system (such as an applet's init time).
+     */
+    public static void setStartTime(String message) {
+        if (loggingEnabled()) {
+            long nowTime = getCurrentTime();
+            setStartTime(message, nowTime);
+        }
+    }
+
+    /**
+     * Sets the base time, output can then
+     * be displayed as offsets from the base time;.
+     */
+    public static void setBaseTime(long time) {
+        if (loggingEnabled()) {
+            baseTime = time;
+        }
+    }
+
+    /**
+     * Sets the start time.
+     * This version of the method is
+     * given the time to log, instead of expecting this method to
+     * get the time itself.  This is done in case the time was
+     * recorded much earlier than this method was called.
+     */
+    public static void setStartTime(String message, long time) {
+        if (loggingEnabled()) {
+            times.set(START_INDEX, new TimeData(message, time));
+        }
+    }
+
+    /**
+     * Gets the start time, which should be the time when
+     * the java process started, prior to the VM actually being
+     * loaded.
+     */
+    public static long getStartTime() {
+        if (loggingEnabled()) {
+            return times.get(START_INDEX).getTime();
+        } else {
+            return 0;
+        }
+    }
+
+    /**
+     * Sets the value of a given time and returns the index of the
+     * slot that that time was stored in.
+     */
+    public static int setTime(String message) {
+        if (loggingEnabled()) {
+            long nowTime = getCurrentTime();
+            return setTime(message, nowTime);
+        } else {
+            return 0;
+        }
+    }
+
+    /**
+     * Sets the value of a given time and returns the index of the
+     * slot that that time was stored in.
+     * This version of the method is
+     * given the time to log, instead of expecting this method to
+     * get the time itself.  This is done in case the time was
+     * recorded much earlier than this method was called.
+     */
+    public static int setTime(String message, long time) {
+        if (loggingEnabled()) {
+            // times is already synchronized, but we need to ensure that
+            // the size used in times.set() is the same used when returning
+            // the index of that operation.
+            synchronized (times) {
+                times.add(new TimeData(message, time));
+                return (times.size() - 1);
+            }
+        } else {
+            return 0;
+        }
+    }
+
+    /**
+     * Returns time at given index.
+     */
+    public static long getTimeAtIndex(int index) {
+        if (loggingEnabled()) {
+            return times.get(index).getTime();
+        } else {
+            return 0;
+        }
+    }
+
+    /**
+     * Returns message at given index.
+     */
+    public static String getMessageAtIndex(int index) {
+        if (loggingEnabled()) {
+            return times.get(index).getMessage();
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * Outputs all data to parameter-specified Writer object
+     */
+    public static void outputLog(Writer writer) {
+        if (loggingEnabled()) {
+            try {
+                synchronized(times) {
+                    for (int i = 0; i < times.size(); ++i) {
+                        TimeData td = times.get(i);
+                        if (td != null) {
+                            writer.write(i + " " + td.getMessage() + ": " +
+                                         (td.getTime() - baseTime) + "\n");
+
+                        }
+                    }
+                }
+                writer.flush();
+            } catch (Exception e) {
+                System.out.println(e + ": Writing performance log to " +
+                                   writer);
+            }
+        }
+    }
+
+    /**
+     * Outputs all data to whatever location the user specified
+     * via sun.perflog command-line parameter.
+     */
+    public static void outputLog() {
+        outputLog(logWriter);
+    }
+}
--- a/jdk/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java	Wed Jan 13 09:39:26 2016 -0500
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java	Wed Jan 13 10:25:41 2016 -0500
@@ -88,9 +88,9 @@
 import sun.java2d.loops.XORComposite;
 import sun.awt.ConstrainableGraphics;
 import sun.awt.SunHints;
+import sun.awt.util.PerformanceLogger;
 import java.util.Map;
 import java.util.Iterator;
-import sun.misc.PerformanceLogger;
 
 import java.lang.annotation.Native;
 import java.awt.image.MultiResolutionImage;
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java	Wed Jan 13 09:39:26 2016 -0500
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java	Wed Jan 13 10:25:41 2016 -0500
@@ -52,6 +52,7 @@
 import sun.font.FontConfigManager;
 import sun.java2d.SunGraphicsEnvironment;
 import sun.misc.*;
+import sun.awt.util.PerformanceLogger;
 import sun.awt.util.ThreadGroupUtils;
 import sun.print.PrintJob2D;
 import sun.security.action.GetPropertyAction;
--- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java	Wed Jan 13 09:39:26 2016 -0500
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java	Wed Jan 13 10:25:41 2016 -0500
@@ -67,10 +67,10 @@
 import java.util.Map;
 import java.util.Properties;
 
+import sun.awt.util.PerformanceLogger;
 import sun.font.FontManager;
 import sun.font.FontManagerFactory;
 import sun.font.SunFontManager;
-import sun.misc.PerformanceLogger;
 import sun.util.logging.PlatformLogger;
 
 public final class WToolkit extends SunToolkit implements Runnable {
--- a/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java	Wed Jan 13 09:39:26 2016 -0500
+++ b/jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java	Wed Jan 13 10:25:41 2016 -0500
@@ -38,6 +38,7 @@
 import java.awt.peer.WindowPeer;
 import java.util.ArrayList;
 
+import jdk.internal.perf.PerfCounter;
 import sun.awt.AWTAccessor;
 import sun.awt.AWTAccessor.ComponentAccessor;
 import sun.awt.Win32GraphicsDevice;
@@ -69,9 +70,9 @@
         if (d3dAvailable) {
             // we don't use pixel formats for the d3d pipeline
             pfDisabled = true;
-            sun.misc.PerfCounter.getD3DAvailable().set(1);
+            PerfCounter.getD3DAvailable().set(1);
         } else {
-            sun.misc.PerfCounter.getD3DAvailable().set(0);
+            PerfCounter.getD3DAvailable().set(0);
         }
     }
 
--- a/jdk/src/java.management/share/classes/sun/management/ConnectorAddressLink.java	Wed Jan 13 09:39:26 2016 -0500
+++ b/jdk/src/java.management/share/classes/sun/management/ConnectorAddressLink.java	Wed Jan 13 10:25:41 2016 -0500
@@ -34,7 +34,7 @@
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import sun.misc.Perf;
+import jdk.internal.perf.Perf;
 import sun.management.counter.Units;
 import sun.management.counter.Counter;
 import sun.management.counter.perf.PerfInstrumentation;
--- a/jdk/src/java.management/share/classes/sun/management/VMManagementImpl.java	Wed Jan 13 09:39:26 2016 -0500
+++ b/jdk/src/java.management/share/classes/sun/management/VMManagementImpl.java	Wed Jan 13 10:25:41 2016 -0500
@@ -25,7 +25,7 @@
 
 package sun.management;
 
-import sun.misc.Perf;
+import jdk.internal.perf.Perf;
 import sun.management.counter.*;
 import sun.management.counter.perf.*;
 import java.nio.ByteBuffer;
--- a/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/AbstractMonitoredVm.java	Wed Jan 13 09:39:26 2016 -0500
+++ b/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/AbstractMonitoredVm.java	Wed Jan 13 10:25:41 2016 -0500
@@ -95,7 +95,7 @@
     public void detach() {
         /*
          * no default action required because the detach operation for the
-         * native byte buffer is managed by the sun.misc.Perf class.
+         * native byte buffer is managed by the Perf class.
          */
     }
 
--- a/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/AbstractPerfDataBuffer.java	Wed Jan 13 09:39:26 2016 -0500
+++ b/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/AbstractPerfDataBuffer.java	Wed Jan 13 10:25:41 2016 -0500
@@ -25,7 +25,6 @@
 
 package sun.jvmstat.perfdata.monitor;
 
-import sun.misc.Perf;
 import sun.jvmstat.monitor.*;
 import java.util.*;
 import java.io.*;
--- a/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/PerfDataBuffer.java	Wed Jan 13 09:39:26 2016 -0500
+++ b/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/PerfDataBuffer.java	Wed Jan 13 10:25:41 2016 -0500
@@ -25,7 +25,7 @@
 
 package sun.jvmstat.perfdata.monitor.protocol.local;
 
-import sun.misc.Perf;
+import jdk.internal.perf.Perf;
 import sun.jvmstat.monitor.*;
 import sun.jvmstat.perfdata.monitor.*;
 import java.util.*;