aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorCarl Shapiro <cshapiro@google.com>2010-06-08 16:37:12 -0700
committerCarl Shapiro <cshapiro@google.com>2010-06-08 17:04:11 -0700
commitde75089fb7216d19e9c22cce4dc62a49513477d3 (patch)
tree8c4035cc05218ddb7595e9a5c5997b53e58c2572 /tools
parent52ec072cc4dd215ff541a0b0842e91ea529a6e5d (diff)
Remove trailing whitespace.
Change-Id: I95534bb2b88eaf48f2329282041118cd034c812b
Diffstat (limited to 'tools')
-rwxr-xr-xtools/deadcode.py28
-rw-r--r--tools/dmtracedump/Android.mk2
-rw-r--r--tools/dmtracedump/CreateTestTrace.c18
-rw-r--r--tools/dmtracedump/TraceDump.c164
-rwxr-xr-xtools/dmtracedump/dmtracedump.pl2
-rw-r--r--tools/gdbjithelper/README.txt2
-rw-r--r--tools/gdbjithelper/gdbjithelper.c2
7 files changed, 109 insertions, 109 deletions
diff --git a/tools/deadcode.py b/tools/deadcode.py
index eb71b7c24..2ef8c70dc 100755
--- a/tools/deadcode.py
+++ b/tools/deadcode.py
@@ -9,7 +9,7 @@ def SplitSections(buffer):
When found, the name of the section is extracted. The entire contents
of that section is added to a result hashmap with the section name
as the key"""
-
+
# Match lines like
# |section_name:
# capturing section_name
@@ -19,11 +19,11 @@ def SplitSections(buffer):
start = 0
anchor = -1
sectionName = ''
-
+
while True:
# Look for a section header
result = headerPattern.search(buffer, start)
-
+
# If there are no more, add a section from the last header to EOF
if result is None:
if anchor is not -1:
@@ -34,17 +34,17 @@ def SplitSections(buffer):
# map indexed by the section name
if anchor is not -1:
sections[sectionName] = buffer[anchor:result.start()]
-
+
sectionName = result.group(1)
start = result.end()
anchor = start
-
+
return sections
def FindMethods(section):
"""Spin through the 'method code index' section and extract all
method signatures. When found, they are added to a result list."""
-
+
# Match lines like:
# |[abcd] com/example/app/Class.method:(args)return
# capturing the method signature
@@ -56,7 +56,7 @@ def FindMethods(section):
while True:
# Look for a method name
result = methodPattern.search(section, start)
-
+
if result is None:
return methods
@@ -68,16 +68,16 @@ def CallsMethod(codes, method):
"""Spin through all the input method signatures. For each one, return
whether or not there is method invokation line in the codes section that
lists the method as the target."""
-
+
start = 0
-
+
while True:
# Find the next reference to the method signature
match = codes.find(method, start)
-
+
if match is -1:
break;
-
+
# Find the beginning of the line the method reference is on
startOfLine = codes.rfind("\n", 0, match) + 1
@@ -86,9 +86,9 @@ def CallsMethod(codes, method):
# than the beginning of the code section for that method.
if codes.find("invoke", startOfLine, match) is not -1:
return True
-
+
start = match + len(method)
-
+
return False
@@ -120,7 +120,7 @@ def main():
if not CallsMethod(codes, method):
print "\t", method
count += 1
-
+
if count is 0:
print "\tNone"
diff --git a/tools/dmtracedump/Android.mk b/tools/dmtracedump/Android.mk
index ef9a9c25b..2ba0a68d1 100644
--- a/tools/dmtracedump/Android.mk
+++ b/tools/dmtracedump/Android.mk
@@ -1,4 +1,4 @@
-#
+#
# Copyright 2006 The Android Open Source Project
#
# Java method trace dump tool
diff --git a/tools/dmtracedump/CreateTestTrace.c b/tools/dmtracedump/CreateTestTrace.c
index 9d72b1f4c..0b85d516a 100644
--- a/tools/dmtracedump/CreateTestTrace.c
+++ b/tools/dmtracedump/CreateTestTrace.c
@@ -2,16 +2,16 @@
**
** Copyright 2006, The Android Open Source Project
**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
**
-** http://www.apache.org/licenses/LICENSE-2.0
+** http://www.apache.org/licenses/LICENSE-2.0
**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
** limitations under the License.
*/
@@ -214,7 +214,7 @@ void parseInputFile(const char *inputFileName)
save_cp = cp;
while (*cp != '\n')
cp += 1;
-
+
/* Remove trailing spaces */
cp -= 1;
while (isspace(*cp))
diff --git a/tools/dmtracedump/TraceDump.c b/tools/dmtracedump/TraceDump.c
index 3dc18938e..02cdf9856 100644
--- a/tools/dmtracedump/TraceDump.c
+++ b/tools/dmtracedump/TraceDump.c
@@ -2,16 +2,16 @@
**
** Copyright 2006, The Android Open Source Project
**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
**
-** http://www.apache.org/licenses/LICENSE-2.0
+** http://www.apache.org/licenses/LICENSE-2.0
**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
** limitations under the License.
*/
@@ -59,7 +59,7 @@ int versionNumber;
#define DEFAULT_ACTIVE_THREADS 8
-char *htmlHeader =
+char *htmlHeader =
"<html>\n<head>\n<script type=\"text/javascript\" src=\"%ssortable.js\"></script>\n"
"<script langugage=\"javascript\">\n"
"function toggle(item) {\n"
@@ -100,10 +100,10 @@ char *htmlHeader =
"</head><body>\n\n";
char *htmlFooter = "\n</body>\n</html>\n";
-char *profileSeparator =
+char *profileSeparator =
"======================================================================";
-
-const char* tableHeader =
+
+const char* tableHeader =
"<table class='sortable' id='%s'><tr>\n"
"<th>Method</th>\n"
"<th>Run 1 (us)</th>\n"
@@ -112,18 +112,18 @@ const char* tableHeader =
"<th>Diff (%%)</th>\n"
"<th>1: # calls</th>\n"
"<th>2: # calls</th>\n"
- "</tr>\n";
-
-const char* tableHeaderMissing =
+ "</tr>\n";
+
+const char* tableHeaderMissing =
"<table class='sortable' id='%s'>\n"
"<th>Method</th>\n"
"<th>Exclusive</th>\n"
"<th>Inclusive</th>\n"
"<th># calls</th>\n";
-
-#define GRAPH_LABEL_VISITED 0x0001
+
+#define GRAPH_LABEL_VISITED 0x0001
#define GRAPH_NODE_VISITED 0x0002
-
+
/*
* Values from the header of the data file.
*/
@@ -1227,7 +1227,7 @@ int readDataRecord(FILE *dataFp, int *threadId, unsigned int *methodVal,
if (id == EOF)
return 1;
*threadId = id;
-
+
*methodVal = read4LE(dataFp);
*elapsedTime = read4LE(dataFp);
if (feof(dataFp)) {
@@ -1465,7 +1465,7 @@ TimedMethod *sortTimedMethodList(TimedMethod *list, int *num)
for (ii = 0; ii < num_entries - 1; ++ii)
sorted[ii].next = &sorted[ii + 1];
sorted[num_entries - 1].next = NULL;
-
+
return sorted;
}
@@ -1488,7 +1488,7 @@ void printInclusiveMethod(MethodEntry *method, TimedMethod *list, int numCalls,
char *className, *methodName, *signature;
char classBuf[HTML_BUFSIZE], methodBuf[HTML_BUFSIZE];
char signatureBuf[HTML_BUFSIZE];
-
+
anchor_close = "";
if (gOptions.outputHtml)
anchor_close = "</a>";
@@ -1690,7 +1690,7 @@ void printExclusiveProfile(MethodEntry **pMethods, int numMethods,
}
/* check to make sure that the child method meets the threshold of the parent */
-int checkThreshold(MethodEntry* parent, MethodEntry* child)
+int checkThreshold(MethodEntry* parent, MethodEntry* child)
{
double parentTime = parent->elapsedInclusive;
double childTime = child->elapsedInclusive;
@@ -1700,18 +1700,18 @@ int checkThreshold(MethodEntry* parent, MethodEntry* child)
void createLabels(FILE* file, MethodEntry* method)
{
- fprintf(file, "node%d[label = \"[%d] %s.%s (%llu, %llu, %d)\"]\n",
- method->index, method->index, method->className, method->methodName,
+ fprintf(file, "node%d[label = \"[%d] %s.%s (%llu, %llu, %d)\"]\n",
+ method->index, method->index, method->className, method->methodName,
method->elapsedInclusive / 1000,
method->elapsedExclusive / 1000,
method->numCalls[0]);
- method->graphState = GRAPH_LABEL_VISITED;
+ method->graphState = GRAPH_LABEL_VISITED;
TimedMethod* child;
for (child = method->children[0] ; child ; child = child->next) {
MethodEntry* childMethod = child->method;
-
+
if ((childMethod->graphState & GRAPH_LABEL_VISITED) == 0 && checkThreshold(method, childMethod)) {
createLabels(file, child->method);
}
@@ -1721,7 +1721,7 @@ void createLabels(FILE* file, MethodEntry* method)
void createLinks(FILE* file, MethodEntry* method)
{
method->graphState |= GRAPH_NODE_VISITED;
-
+
TimedMethod* child;
for (child = method->children[0] ; child ; child = child->next) {
MethodEntry* childMethod = child->method;
@@ -1746,19 +1746,19 @@ void createInclusiveProfileGraphNew(DataKeys* dataKeys)
}
FILE* file = fopen(path, "w+");
-
+
fprintf(file, "digraph g {\nnode [shape = record,height=.1];\n");
-
+
createLabels(file, dataKeys->methods);
createLinks(file, dataKeys->methods);
-
+
fprintf(file, "}");
fclose(file);
-
+
// now that we have the dot file generate the image
char command[1024];
snprintf(command, 1024, "dot -Tpng -o '%s' '%s'", gOptions.graphFileName, path);
-
+
system(command);
if (! gOptions.keepDotFile) {
@@ -2931,7 +2931,7 @@ bail:
*/
DataKeys* parseDataKeys(TraceData* traceData, const char* traceFileName,
uint64_t* threadTime, Filter** filters)
-{
+{
DataKeys* dataKeys = NULL;
MethodEntry **pMethods = NULL;
MethodEntry* method;
@@ -2940,7 +2940,7 @@ DataKeys* parseDataKeys(TraceData* traceData, const char* traceFileName,
int ii, jj, numThreads;
uint64_t currentTime;
MethodEntry* caller;
-
+
dataFp = fopen(traceFileName, "r");
if (dataFp == NULL)
goto bail;
@@ -3178,7 +3178,7 @@ DataKeys* parseDataKeys(TraceData* traceData, const char* traceFileName,
}
caller = &dataKeys->methods[TOPLEVEL_INDEX];
caller->elapsedInclusive = sumThreadTime;
-
+
#if 0
fclose(dumpStream);
#endif
@@ -3190,7 +3190,7 @@ DataKeys* parseDataKeys(TraceData* traceData, const char* traceFileName,
bail:
if (dataFp != NULL)
fclose(dataFp);
-
+
return dataKeys;
}
@@ -3207,7 +3207,7 @@ MethodEntry** parseMethodEntries(DataKeys* dataKeys)
MethodEntry* entry = &dataKeys->methods[ii];
pMethods[ii] = entry;
}
-
+
return pMethods;
}
@@ -3253,7 +3253,7 @@ int compareMethodNamesForDiff(const void *a, const void *b)
if (result == 0) {
result = strcmp(methodA->signature, methodB->signature);
if (result == 0) {
- return strcmp(methodA->className, methodB->className);
+ return strcmp(methodA->className, methodB->className);
}
}
return result;
@@ -3262,21 +3262,21 @@ int compareMethodNamesForDiff(const void *a, const void *b)
int findMatch(MethodEntry** methods, int size, MethodEntry* matchThis)
{
int i;
-
+
for (i = 0 ; i < size ; i++) {
MethodEntry* method = methods[i];
-
+
if (method != NULL && !compareMethodNamesForDiff(&method, &matchThis)) {
-// printf("%s.%s == %s.%s<br>\n", matchThis->className, matchThis->methodName,
+// printf("%s.%s == %s.%s<br>\n", matchThis->className, matchThis->methodName,
// method->className, method->methodName);
-
+
return i;
/* if (!compareMethodNames(&method, &matchThis)) {
return i;
}
*/ }
}
-
+
return -1;
}
@@ -3286,13 +3286,13 @@ int compareDiffEntriesExculsive(const void *a, const void *b)
const DiffEntry* entryA = (const DiffEntry*)a;
const DiffEntry* entryB = (const DiffEntry*)b;
-
+
if (entryA->differenceExclusive < entryB->differenceExclusive) {
return 1;
} else if (entryA->differenceExclusive > entryB->differenceExclusive) {
return -1;
}
-
+
return 0;
}
@@ -3302,37 +3302,37 @@ int compareDiffEntriesInculsive(const void *a, const void *b)
const DiffEntry* entryA = (const DiffEntry*)a;
const DiffEntry* entryB = (const DiffEntry*)b;
-
+
if (entryA->differenceInclusive < entryB->differenceInclusive) {
return 1;
} else if (entryA->differenceInclusive > entryB->differenceInclusive) {
return -1;
}
-
+
return 0;
}
-void printMissingMethod(MethodEntry* method)
+void printMissingMethod(MethodEntry* method)
{
char classBuf[HTML_BUFSIZE];
char methodBuf[HTML_BUFSIZE];
char* className;
char* methodName;
-
+
className = htmlEscape(method->className, classBuf, HTML_BUFSIZE);
methodName = htmlEscape(method->methodName, methodBuf, HTML_BUFSIZE);
-
- if (gOptions.outputHtml) printf("<tr><td>\n");
-
+
+ if (gOptions.outputHtml) printf("<tr><td>\n");
+
printf("%s.%s ", className, methodName);
if (gOptions.outputHtml) printf("</td><td>");
-
+
printf("%lld ", method->elapsedExclusive);
if (gOptions.outputHtml) printf("</td><td>");
-
+
printf("%lld ", method->elapsedInclusive);
if (gOptions.outputHtml) printf("</td><td>");
-
+
printf("%d\n", method->numCalls[0]);
if (gOptions.outputHtml) printf("</td><td>\n");
}
@@ -3342,8 +3342,8 @@ void createDiff(DataKeys* d1, uint64_t sum1, DataKeys* d2, uint64_t sum2)
{
MethodEntry** methods1 = parseMethodEntries(d1);
MethodEntry** methods2 = parseMethodEntries(d2);
-
- // sort and assign the indicies
+
+ // sort and assign the indicies
int i;
qsort(methods1, d1->numMethods, sizeof(MethodEntry*), compareElapsedInclusive);
for (i = 0; i < d1->numMethods; ++i) {
@@ -3354,17 +3354,17 @@ void createDiff(DataKeys* d1, uint64_t sum1, DataKeys* d2, uint64_t sum2)
for (i = 0; i < d2->numMethods; ++i) {
methods2[i]->index = i;
}
-
+
int max = (d1->numMethods < d2->numMethods) ? d2->numMethods : d1->numMethods;
max++;
DiffEntry* diffs = (DiffEntry*)malloc(max * sizeof(DiffEntry));
memset(diffs, 0, max * sizeof(DiffEntry));
DiffEntry* ptr = diffs;
-
+
// printf("<br>d1->numMethods: %d d1->numMethods: %d<br>\n", d1->numMethods, d2->numMethods);
-
+
int matches = 0;
-
+
for (i = 0 ; i < d1->numMethods ; i++) {
int match = findMatch(methods2, d2->numMethods, methods1[i]);
if (match >= 0) {
@@ -3384,13 +3384,13 @@ void createDiff(DataKeys* d1, uint64_t sum1, DataKeys* d2, uint64_t sum2)
ptr->differenceInclusive = i2 - i1;
ptr->differenceInclusivePercentage = ((double)i2 / (double)i1) * 100.0;
}
-
+
// clear these out so we don't find them again and we know which ones
// we have left over
methods1[i] = NULL;
methods2[match] = NULL;
ptr++;
-
+
matches++;
}
}
@@ -3399,7 +3399,7 @@ void createDiff(DataKeys* d1, uint64_t sum1, DataKeys* d2, uint64_t sum2)
qsort(diffs, matches, sizeof(DiffEntry), compareDiffEntriesExculsive);
ptr = diffs;
-
+
if (gOptions.outputHtml) {
printf(htmlHeader, gOptions.sortableUrl);
printf("<h3>Table of Contents</h3>\n");
@@ -3412,12 +3412,12 @@ void createDiff(DataKeys* d1, uint64_t sum1, DataKeys* d2, uint64_t sum2)
printf("<a name=\"exclusive\"></a><h3 id=\"exclusive\">Exclusive</h3>\n");
printf(tableHeader, "exclusive_table");
}
-
+
char classBuf[HTML_BUFSIZE];
char methodBuf[HTML_BUFSIZE];
char* className;
char* methodName;
-
+
while (ptr->method1 != NULL && ptr->method2 != NULL) {
if (gOptions.outputHtml) printf("<tr><td>\n");
@@ -3426,16 +3426,16 @@ void createDiff(DataKeys* d1, uint64_t sum1, DataKeys* d2, uint64_t sum2)
printf("%s.%s ", className, methodName);
if (gOptions.outputHtml) printf("</td><td>");
-
+
printf("%lld ", ptr->method1->elapsedExclusive);
if (gOptions.outputHtml) printf("</td><td>");
-
+
printf("%llu ", ptr->method2->elapsedExclusive);
if (gOptions.outputHtml) printf("</td><td>");
-
+
printf("%lld ", ptr->differenceExclusive);
if (gOptions.outputHtml) printf("</td><td>");
-
+
printf("%.2f\n", ptr->differenceExclusivePercentage);
if (gOptions.outputHtml) printf("</td><td>\n");
@@ -3444,12 +3444,12 @@ void createDiff(DataKeys* d1, uint64_t sum1, DataKeys* d2, uint64_t sum2)
printf("%d\n", ptr->method2->numCalls[0]);
if (gOptions.outputHtml) printf("</td></tr>\n");
-
+
ptr++;
}
-
+
if (gOptions.outputHtml) printf("</table>\n");
-
+
if (gOptions.outputHtml) {
printf(htmlHeader, gOptions.sortableUrl);
printf("Run 1: %s<br>\n", gOptions.diffFileName);
@@ -3457,10 +3457,10 @@ void createDiff(DataKeys* d1, uint64_t sum1, DataKeys* d2, uint64_t sum2)
printf("<a name=\"inclusive\"></a><h3 id=\"inculisve\">Inclusive</h3>\n");
printf(tableHeader, "inclusive_table");
}
-
+
qsort(diffs, matches, sizeof(DiffEntry), compareDiffEntriesInculsive);
ptr = diffs;
-
+
while (ptr->method1 != NULL && ptr->method2 != NULL) {
if (gOptions.outputHtml) printf("<tr><td>\n");
@@ -3496,25 +3496,25 @@ void createDiff(DataKeys* d1, uint64_t sum1, DataKeys* d2, uint64_t sum2)
printf("<h3>Run 1 methods not found in Run 2</h3>");
printf(tableHeaderMissing);
}
-
+
for (i = 0; i < d1->numMethods; ++i) {
if (methods1[i] != NULL) {
printMissingMethod(methods1[i]);
}
}
-
+
if (gOptions.outputHtml) {
printf("</table>\n");
printf("<h3>Run 2 methods not found in Run 1</h3>");
printf(tableHeaderMissing);
}
-
+
for (i = 0; i < d2->numMethods; ++i) {
if (methods2[i] != NULL) {
printMissingMethod(methods2[i]);
}
}
-
+
if (gOptions.outputHtml) printf("</body></html\n");
}
@@ -3613,9 +3613,9 @@ int main(int argc, char** argv)
uint64_t sum2;
TraceData data2;
DataKeys* d2 = parseDataKeys(&data2, gOptions.diffFileName, &sum2, filters);
-
+
createDiff(d2, sum2, dataKeys, sumThreadTime);
-
+
freeDataKeys(d2);
} else {
MethodEntry** methods = parseMethodEntries(dataKeys);
@@ -3626,7 +3626,7 @@ int main(int argc, char** argv)
}
free(methods);
}
-
+
freeDataKeys(dataKeys);
return 0;
diff --git a/tools/dmtracedump/dmtracedump.pl b/tools/dmtracedump/dmtracedump.pl
index fbd00acf8..9c3f40e05 100755
--- a/tools/dmtracedump/dmtracedump.pl
+++ b/tools/dmtracedump/dmtracedump.pl
@@ -12,7 +12,7 @@ foreach (@traces)
print("dmtracedump -h -p $input > $output\n");
system("dmtracedump -h -p '$input' > '$output'");
-
+
}
closedir DIR;
diff --git a/tools/gdbjithelper/README.txt b/tools/gdbjithelper/README.txt
index 032b24471..f34cb7c94 100644
--- a/tools/gdbjithelper/README.txt
+++ b/tools/gdbjithelper/README.txt
@@ -26,7 +26,7 @@ code around lr:
Step 2
-
+
Push $OUT/EXECUTABLES/gdbjithelper_intermediates/LINKED/gdbjithelper to
/system/bin on the device or emulator
diff --git a/tools/gdbjithelper/gdbjithelper.c b/tools/gdbjithelper/gdbjithelper.c
index 862fcae2f..817d5a41e 100644
--- a/tools/gdbjithelper/gdbjithelper.c
+++ b/tools/gdbjithelper/gdbjithelper.c
@@ -40,7 +40,7 @@ volatile int done;
* 463ba204 4191debc 01010000 4284aa74 68b00054
* 463ba214 045cf205 cc016468 0718f2a5 d0102800
* 463ba224 4c13c701 a20aa108 efb0f775 e008e010
- *
+ *
* code around lr:
* 463ba1a8 42e19e58 f2050050 cc01045c 0718f2a5
* 463ba1b8 d00f2800 4c13c701 a20aa108 efe4f775