本文整理汇总了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();
}
示例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;
}
示例3: DynamicClassHeapObject
import com.sun.tools.hat.internal.model.JavaClass; //导入依赖的package包/类
public DynamicClassHeapObject(JavaClass className) {
this.representation = FactEncoders.encodeClass(className);
}
示例4: encodeClass
import com.sun.tools.hat.internal.model.JavaClass; //导入依赖的package包/类
public static String encodeClass(JavaClass obj) {
return "<class " + obj.getName() + ">";
}
示例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();
}