当前位置: 首页>>代码示例>>Java>>正文


Java JavaClass类代码示例

本文整理汇总了Java中com.sun.tools.hat.internal.model.JavaClass的典型用法代码示例。如果您正苦于以下问题:Java JavaClass类的具体用法?Java JavaClass怎么用?Java JavaClass使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JavaClass类属于com.sun.tools.hat.internal.model包,在下文中一共展示了JavaClass类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: AllocationKey

import com.sun.tools.hat.internal.model.JavaClass; //导入依赖的package包/类
public AllocationKey(StackFrame frame, JavaClass cls) {
    this.thisFrame = frame;
    this.cls = cls;
    if (frame == null) return;
    this.hash = frame.getClassName().hashCode();
    this.hash *= 31;
    this.hash += frame.getMethodName().hashCode();
    this.hash *= 31;
    this.hash += frame.getMethodSignature().hashCode();
    this.hash *= 31;
    this.hash += frame.getLineNumber().hashCode();
    this.hash *= 31;
    this.hash += cls.getId();
}
 
开发者ID:plast-lab,项目名称:HeapDL,代码行数:15,代码来源:AllocationKey.java

示例2: isPlatformClass

import com.sun.tools.hat.internal.model.JavaClass; //导入依赖的package包/类
public static boolean isPlatformClass(JavaClass clazz) {
    // all classes loaded by bootstrap loader are considered
    // platform classes. In addition, the older name based filtering
    // is also done for compatibility.
    if (clazz.isBootstrap()) {
        return true;
    }

    String name = clazz.getName();
    // skip even the array classes of the skipped classes.
    if (name.startsWith("[")) {
        int index = name.lastIndexOf('[');
        if (index != -1) {
            if (name.charAt(index + 1) != 'L') {
                // some primitive array.
                return true;
            }
            // skip upto 'L' after the last '['.
            name = name.substring(index + 2);
        }
    }
    String[] nms = getNames();
    for (int i = 0; i < nms.length; i++) {
        if (name.startsWith(nms[i])) {
            return true;
        }
    }
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:PlatformClasses.java

示例3: DynamicClassHeapObject

import com.sun.tools.hat.internal.model.JavaClass; //导入依赖的package包/类
public DynamicClassHeapObject(JavaClass className) {
    this.representation = FactEncoders.encodeClass(className);
}
 
开发者ID:plast-lab,项目名称:HeapDL,代码行数:4,代码来源:DynamicClassHeapObject.java

示例4: encodeClass

import com.sun.tools.hat.internal.model.JavaClass; //导入依赖的package包/类
public static String encodeClass(JavaClass obj) {
    return "<class " + obj.getName() + ">";
}
 
开发者ID:plast-lab,项目名称:HeapDL,代码行数:4,代码来源:FactEncoders.java

示例5: run

import com.sun.tools.hat.internal.model.JavaClass; //导入依赖的package包/类
public void run() {
    JavaClass[] classes = snapshot.getClassesArray();
    Comparator<JavaClass> comparator;
    if (query.equals("count")) {
        comparator = new Comparator<JavaClass>() {
            public int compare(JavaClass first, JavaClass second) {
                long diff = (second.getInstancesCount(false) -
                         first.getInstancesCount(false));
                return (diff == 0)? 0: ((diff < 0)? -1 : + 1);
            }
        };
    } else if (query.equals("class")) {
        comparator = new Comparator<JavaClass>() {
            public int compare(JavaClass first, JavaClass second) {
                return first.getName().compareTo(second.getName());
            }
        };
    } else {
        // default sort is by total size
        comparator = new Comparator<JavaClass>() {
            public int compare(JavaClass first, JavaClass second) {
                long diff = (second.getTotalInstanceSize() -
                         first.getTotalInstanceSize());
                return (diff == 0)? 0: ((diff < 0)? -1 : + 1);
            }
        };
    }
    Arrays.sort(classes, comparator);

    startHtml("Heap Histogram");

    out.println("<p align='center'>");
    out.println("<b><a href='/'>All Classes (excluding platform)</a></b>");
    out.println("</p>");

    out.println("<table align=center border=1>");
    out.println("<tr><th><a href='/histo/class'>Class</a></th>");
    out.println("<th><a href='/histo/count'>Instance Count</a></th>");
    out.println("<th><a href='/histo/size'>Total Size</a></th></tr>");
    for (int i = 0; i < classes.length; i++) {
        JavaClass clazz = classes[i];
        out.println("<tr><td>");
        printClass(clazz);
        out.println("</td>");
        out.println("<td>");
        out.println(clazz.getInstancesCount(false));
        out.println("</td>");
        out.println("<td>");
        out.println(clazz.getTotalInstanceSize());
        out.println("</td></tr>");
    }
    out.println("</table>");

    endHtml();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:56,代码来源:HistogramQuery.java


注:本文中的com.sun.tools.hat.internal.model.JavaClass类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。