Examples of CountingVisitor


Examples of org.netbeans.insane.scanner.CountingVisitor

     * @param o the object to measure
     * @param maxMemoryUsage the maximum desired memory usage for the Callable,
     *          in bytes
     */
    private static void assertMaxMemoryUsage(String description, Object o, int maxMemoryUsage) throws Exception {
        CountingVisitor v = new CountingVisitor();
        ScannerUtils.scan(null, v, Collections.singleton(o), false);
        long memoryUsage = v.getTotalSize();
        String message = description + " consume " + memoryUsage + " bytes of memory on average, " + (memoryUsage - maxMemoryUsage) + " bytes more than the specified limit of " + maxMemoryUsage + " bytes";
        assertTrue(message, memoryUsage <= maxMemoryUsage);
        System.out.println(description + " consume " + memoryUsage + "/" + maxMemoryUsage + " bytes of memory");
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.