use of com.android.tools.perflib.heap.Snapshot in project android_frameworks_base by DirtyUnicorns.
the class Hprof method analyzeHprof.
/**
* Return a map of class names to class-loader names derived from the hprof dump.
*
* @param hprofLocalFile
*/
public static Map<String, String> analyzeHprof(File hprofLocalFile) throws Exception {
Snapshot snapshot = Snapshot.createSnapshot(new MemoryMappedFileBuffer(hprofLocalFile));
Map<String, Set<ClassObj>> classes = Queries.classes(snapshot, null);
Map<String, String> retValue = new HashMap<String, String>();
for (Map.Entry<String, Set<ClassObj>> e : classes.entrySet()) {
for (ClassObj c : e.getValue()) {
String cl = c.getClassLoader() == null ? null : c.getClassLoader().toString();
String cName = c.getClassName();
int aDepth = 0;
while (cName.endsWith("[]")) {
cName = cName.substring(0, cName.length() - 2);
aDepth++;
}
String newName = transformPrimitiveClass(cName);
if (aDepth > 0) {
// Need to use kind-a descriptor syntax. If it was transformed, it is primitive.
if (newName.equals(cName)) {
newName = "L" + newName + ";";
}
for (int i = 0; i < aDepth; i++) {
newName = "[" + newName;
}
}
retValue.put(newName, cl);
}
}
// Free up memory.
snapshot.dispose();
return retValue;
}
use of com.android.tools.perflib.heap.Snapshot in project platform_frameworks_base by android.
the class Hprof method analyzeHprof.
/**
* Return a map of class names to class-loader names derived from the hprof dump.
*
* @param hprofLocalFile
*/
public static Map<String, String> analyzeHprof(File hprofLocalFile) throws Exception {
Snapshot snapshot = Snapshot.createSnapshot(new MemoryMappedFileBuffer(hprofLocalFile));
Map<String, Set<ClassObj>> classes = Queries.classes(snapshot, null);
Map<String, String> retValue = new HashMap<String, String>();
for (Map.Entry<String, Set<ClassObj>> e : classes.entrySet()) {
for (ClassObj c : e.getValue()) {
String cl = c.getClassLoader() == null ? null : c.getClassLoader().toString();
String cName = c.getClassName();
int aDepth = 0;
while (cName.endsWith("[]")) {
cName = cName.substring(0, cName.length() - 2);
aDepth++;
}
String newName = transformPrimitiveClass(cName);
if (aDepth > 0) {
// Need to use kind-a descriptor syntax. If it was transformed, it is primitive.
if (newName.equals(cName)) {
newName = "L" + newName + ";";
}
for (int i = 0; i < aDepth; i++) {
newName = "[" + newName;
}
}
retValue.put(newName, cl);
}
}
// Free up memory.
snapshot.dispose();
return retValue;
}
use of com.android.tools.perflib.heap.Snapshot in project android_frameworks_base by AOSPA.
the class Hprof method analyzeHprof.
/**
* Return a map of class names to class-loader names derived from the hprof dump.
*
* @param hprofLocalFile
*/
public static Map<String, String> analyzeHprof(File hprofLocalFile) throws Exception {
Snapshot snapshot = Snapshot.createSnapshot(new MemoryMappedFileBuffer(hprofLocalFile));
Map<String, Set<ClassObj>> classes = Queries.classes(snapshot, null);
Map<String, String> retValue = new HashMap<String, String>();
for (Map.Entry<String, Set<ClassObj>> e : classes.entrySet()) {
for (ClassObj c : e.getValue()) {
String cl = c.getClassLoader() == null ? null : c.getClassLoader().toString();
String cName = c.getClassName();
int aDepth = 0;
while (cName.endsWith("[]")) {
cName = cName.substring(0, cName.length() - 2);
aDepth++;
}
String newName = transformPrimitiveClass(cName);
if (aDepth > 0) {
// Need to use kind-a descriptor syntax. If it was transformed, it is primitive.
if (newName.equals(cName)) {
newName = "L" + newName + ";";
}
for (int i = 0; i < aDepth; i++) {
newName = "[" + newName;
}
}
retValue.put(newName, cl);
}
}
// Free up memory.
snapshot.dispose();
return retValue;
}
use of com.android.tools.perflib.heap.Snapshot in project android_frameworks_base by ResurrectionRemix.
the class Hprof method analyzeHprof.
/**
* Return a map of class names to class-loader names derived from the hprof dump.
*
* @param hprofLocalFile
*/
public static Map<String, String> analyzeHprof(File hprofLocalFile) throws Exception {
Snapshot snapshot = Snapshot.createSnapshot(new MemoryMappedFileBuffer(hprofLocalFile));
Map<String, Set<ClassObj>> classes = Queries.classes(snapshot, null);
Map<String, String> retValue = new HashMap<String, String>();
for (Map.Entry<String, Set<ClassObj>> e : classes.entrySet()) {
for (ClassObj c : e.getValue()) {
String cl = c.getClassLoader() == null ? null : c.getClassLoader().toString();
String cName = c.getClassName();
int aDepth = 0;
while (cName.endsWith("[]")) {
cName = cName.substring(0, cName.length() - 2);
aDepth++;
}
String newName = transformPrimitiveClass(cName);
if (aDepth > 0) {
// Need to use kind-a descriptor syntax. If it was transformed, it is primitive.
if (newName.equals(cName)) {
newName = "L" + newName + ";";
}
for (int i = 0; i < aDepth; i++) {
newName = "[" + newName;
}
}
retValue.put(newName, cl);
}
}
// Free up memory.
snapshot.dispose();
return retValue;
}
use of com.android.tools.perflib.heap.Snapshot in project android_frameworks_base by crdroidandroid.
the class Hprof method analyzeHprof.
/**
* Return a map of class names to class-loader names derived from the hprof dump.
*
* @param hprofLocalFile
*/
public static Map<String, String> analyzeHprof(File hprofLocalFile) throws Exception {
Snapshot snapshot = Snapshot.createSnapshot(new MemoryMappedFileBuffer(hprofLocalFile));
Map<String, Set<ClassObj>> classes = Queries.classes(snapshot, null);
Map<String, String> retValue = new HashMap<String, String>();
for (Map.Entry<String, Set<ClassObj>> e : classes.entrySet()) {
for (ClassObj c : e.getValue()) {
String cl = c.getClassLoader() == null ? null : c.getClassLoader().toString();
String cName = c.getClassName();
int aDepth = 0;
while (cName.endsWith("[]")) {
cName = cName.substring(0, cName.length() - 2);
aDepth++;
}
String newName = transformPrimitiveClass(cName);
if (aDepth > 0) {
// Need to use kind-a descriptor syntax. If it was transformed, it is primitive.
if (newName.equals(cName)) {
newName = "L" + newName + ";";
}
for (int i = 0; i < aDepth; i++) {
newName = "[" + newName;
}
}
retValue.put(newName, cl);
}
}
// Free up memory.
snapshot.dispose();
return retValue;
}