summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2011-06-20 11:53:41 -0700
committerElliott Hughes <enh@google.com>2011-06-20 11:53:41 -0700
commit7c08071765cb134e4c0b18bf8fd6a7060e145212 (patch)
treec9cf26865322ea8638e872e543a9d470c797ad2c
parente1e7b718196f3c1012eb24aa83766d7c54e3db40 (diff)
downloadandroid_dalvik-7c08071765cb134e4c0b18bf8fd6a7060e145212.tar.gz
android_dalvik-7c08071765cb134e4c0b18bf8fd6a7060e145212.tar.bz2
android_dalvik-7c08071765cb134e4c0b18bf8fd6a7060e145212.zip
Don't be too specific in reference table summaries.
Implying that the examplar Class' specific type was true of all the classes was misleading; we should just say "Class" in the summary: W/dalvikvm( 801): JNI local reference table summary (23 entries): W/dalvikvm( 801): 20 of java.lang.Class (19 unique instances) W/dalvikvm( 801): 2 of java.lang.String (2 unique instances) W/dalvikvm( 801): 1 of java.lang.String[] (2 elements) Change-Id: Ia961cfc689aa390c84ecbc96e44bdd64448ac051
-rw-r--r--vm/ReferenceTable.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/vm/ReferenceTable.cpp b/vm/ReferenceTable.cpp
index 393a0c9b2..65a38c8af 100644
--- a/vm/ReferenceTable.cpp
+++ b/vm/ReferenceTable.cpp
@@ -202,22 +202,21 @@ static int compareObject(const void* vobj1, const void* vobj2)
* array object), and the number of additional objects that are identical
* or equivalent to the original.
*/
-static void logObject(const Object* obj, size_t elems, int identical, int equiv)
+static void logSummaryLine(const Object* obj, size_t elems, int identical, int equiv)
{
if (obj == NULL) {
LOGW(" NULL reference (count=%d)", equiv);
return;
}
- std::string className;
- if (obj->clazz == NULL) {
- /* handle "raw" dvmMalloc case */
- className = "(raw)";
- } else {
- className = dvmHumanReadableType(obj);
- if (elems != 0) {
- StringAppendF(&className, " (%zd elements)", elems);
- }
+ std::string className(dvmHumanReadableType(obj));
+ if (obj->clazz == gDvm.classJavaLangClass) {
+ // We're summarizing multiple instances, so using the exemplar
+ // Class' type parameter here would be misleading.
+ className = "java.lang.Class";
+ }
+ if (elems != 0) {
+ StringAppendF(&className, " (%zd elements)", elems);
}
size_t total = identical + equiv + 1;
@@ -336,14 +335,14 @@ void dvmDumpReferenceTableContents(Object* const* refs, size_t count,
equiv++;
} else {
/* different class */
- logObject(refs[idx-1], elems, identical, equiv);
+ logSummaryLine(refs[idx-1], elems, identical, equiv);
equiv = identical = 0;
}
}
/* handle the last entry (everything above outputs refs[i-1]) */
elems = getElementCount(refs[idx-1]);
- logObject(refs[count-1], elems, identical, equiv);
+ logSummaryLine(refs[count-1], elems, identical, equiv);
free(tableCopy);
}