aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAndy McFadden <fadden@android.com>2010-08-25 12:05:44 -0700
committerAndy McFadden <fadden@android.com>2010-08-25 14:55:19 -0700
commitfe1d6d586614fa51d82857e09128d6671be21d56 (patch)
treeca47b8e3b43d9914f9cc14c8836cf22d095c72ab /tools
parent9e02e4b1fa08cebefa0f79cd407f4a88611cf473 (diff)
Add option for specifying wall-clock in method profiling.
Normally you want to use the per-thread CPU clock rather than the wall clock, because (a) it's more useful and (b) traceview goes a little nuts if you don't. However, it's useful for some performance testing. The command-line option allows you to switch modes like this: % adb shell stop % adb shell setprop dalvik.vm.extra-opts -Xprofile:wallclock % adb shell start This also changes the somewhat nebulous "clock=global" trace header line to "clock=wall". Nothing looks at this anyway so I'm not worried about breaking compatibility. While I was in here, I fixed a couple of problems caused by failure to initialize data structures that made dmtracedump crash (yay valgrind). Bug 2943229. (cherry-pick from dalvik-dev) Change-Id: I2f6657f7abe02f2a17784588d922b88397639a47
Diffstat (limited to 'tools')
-rw-r--r--tools/dmtracedump/TraceDump.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/tools/dmtracedump/TraceDump.c b/tools/dmtracedump/TraceDump.c
index 02cdf9856..3f8006489 100644
--- a/tools/dmtracedump/TraceDump.c
+++ b/tools/dmtracedump/TraceDump.c
@@ -1060,9 +1060,6 @@ DataKeys* parseKeys(FILE *fp, int verbose)
if (offset < 0)
goto fail;
- /* Reduce our allocation now that we know where the end of the key section is. */
- pKeys->fileData = (char *)realloc(pKeys->fileData, offset);
- pKeys->fileLen = offset;
/* Leave fp pointing to the beginning of the data section. */
fseek(fp, offset, SEEK_SET);
@@ -1174,7 +1171,7 @@ MethodEntry* lookupMethod(DataKeys* pKeys, unsigned int methodId)
/* Create cache if it doesn't already exist */
if (pKeys->methodCache == NULL) {
- pKeys->methodCache = (int*) malloc(sizeof(int) * METHOD_CACHE_SIZE);
+ pKeys->methodCache = (int*) calloc(METHOD_CACHE_SIZE, sizeof(int));
}
// ids are multiples of 4, so shift
@@ -3602,6 +3599,7 @@ int main(int argc, char** argv)
}
TraceData data1;
+ memset(&data1, 0, sizeof(data1));
DataKeys* dataKeys = parseDataKeys(&data1, gOptions.traceFileName,
&sumThreadTime, filters);
if (dataKeys == NULL) {