diff --git a/mozilla/tools/trace-malloc/spacetrace.c b/mozilla/tools/trace-malloc/spacetrace.c index 9153504ce9d..5fca0f13d16 100644 --- a/mozilla/tools/trace-malloc/spacetrace.c +++ b/mozilla/tools/trace-malloc/spacetrace.c @@ -2356,7 +2356,7 @@ htmlHeader(STRequest * inRequest, const char *aTitle) PR_fprintf(inRequest->mFD, "\n"); /* class=navigate */ PR_fprintf(inRequest->mFD, - "\n
\n"); + "\n\n
\n\n"); } /* @@ -2368,10 +2368,10 @@ void htmlFooter(STRequest * inRequest) { PR_fprintf(inRequest->mFD, - "
\n" + "
\n\n" "
\n" "SpaceTrace\n" - "
\n" "\n" "\n"); + "\n\n" "\n" "\n"); } /* @@ -2388,19 +2388,27 @@ htmlNotFound(STRequest * inRequest) } void -htmlStartTable(STRequest* inRequest, const char* table_class, const char * const headers[], PRUint32 header_length) +htmlStartTable(STRequest* inRequest, + const char* table_class, + const char* id, + const char* caption, + const char * const headers[], PRUint32 header_length) { PRUint32 i; PR_fprintf(inRequest->mFD, - "\n" - " \n", table_class ? table_class : ""); + "
\n" + " " + " \n" + " \n", id, + table_class ? table_class : "", + caption); for (i=0; i< header_length; i++) PR_fprintf(inRequest->mFD, - " \n", headers[i]); + " \n", headers[i]); - PR_fprintf(inRequest->mFD, "\n"); + PR_fprintf(inRequest->mFD, " \n"); } /* @@ -2691,7 +2699,9 @@ getDataString(const FormData * aGetData, const char *aCheckFor, int inIndex, ** Returns !0 on failure. */ int -displayTopAllocations(STRequest * inRequest, STRun * aRun, int aWantCallsite) +displayTopAllocations(STRequest * inRequest, STRun * aRun, + const char* caption, + int aWantCallsite) { int retval = 0; @@ -2711,10 +2721,13 @@ displayTopAllocations(STRequest * inRequest, STRun * aRun, int aWantCallsite) }; if (aWantCallsite) - htmlStartTable(inRequest, NULL, headers_callsite, + htmlStartTable(inRequest, NULL, "top-allocations", + caption, + headers_callsite, sizeof(headers_callsite) / sizeof(headers_callsite[0])); else - htmlStartTable(inRequest, NULL, headers, + htmlStartTable(inRequest, NULL, "top-allocations", caption, + headers, sizeof(headers) / sizeof(headers[0])); /* ** Loop over the items, up to some limit or until the end. @@ -2795,7 +2808,7 @@ displayTopAllocations(STRequest * inRequest, STRun * aRun, int aWantCallsite) } } - PR_fprintf(inRequest->mFD, "
%s
%s%s
\n"); + PR_fprintf(inRequest->mFD, "\n\n\n"); } } else { @@ -2829,7 +2842,7 @@ displayMemoryLeaks(STRequest * inRequest, STRun * aRun) "Weight", "Heap Op (sec)", "Origin Callsite" }; - htmlStartTable(inRequest, NULL, headers, + htmlStartTable(inRequest, NULL, "memory-leaks", "Memory Leaks", headers, sizeof(headers) / sizeof(headers[0])); /* @@ -2923,7 +2936,7 @@ displayMemoryLeaks(STRequest * inRequest, STRun * aRun) } } - PR_fprintf(inRequest->mFD, "\n"); + PR_fprintf(inRequest->mFD, "\n\n"); } else { retval = __LINE__; @@ -2943,7 +2956,9 @@ displayMemoryLeaks(STRequest * inRequest, STRun * aRun) */ int displayCallsites(STRequest * inRequest, tmcallsite * aCallsite, int aFollow, - PRUint32 aStamp, int aRealNames) + PRUint32 aStamp, + const char* caption, + int aRealNames) { int retval = 0; @@ -2973,7 +2988,6 @@ displayCallsites(STRequest * inRequest, tmcallsite * aCallsite, int aFollow, ** We got a header? */ if (0 == headerDisplayed) { - headerDisplayed = __LINE__; static const char* const headers[] = { "Callsite", @@ -2983,7 +2997,8 @@ displayCallsites(STRequest * inRequest, tmcallsite * aCallsite, int aFollow, "H.O. Count", "C.H. Operation (sec)" }; - htmlStartTable(inRequest, NULL, headers, + headerDisplayed = __LINE__; + htmlStartTable(inRequest, NULL, "callsites", caption, headers, sizeof(headers)/sizeof(headers[0])); } @@ -3078,7 +3093,7 @@ displayCallsites(STRequest * inRequest, tmcallsite * aCallsite, int aFollow, ** Terminate the table if we should. */ if (0 != headerDisplayed) { - PR_fprintf(inRequest->mFD, "\n"); + PR_fprintf(inRequest->mFD, "\n\n"); } } else { @@ -3117,10 +3132,10 @@ displayAllocationDetails(STRequest * inRequest, STAllocation * aAllocation) LL_UI2L(timeval64, timeval); LL_MUL(weight64, bytesize64, timeval64); - PR_fprintf(inRequest->mFD, "Allocation %u Details:

\n", + PR_fprintf(inRequest->mFD, "

Allocation %u Details:

\n", aAllocation->mRunIndex); - PR_fprintf(inRequest->mFD, "\n"); + PR_fprintf(inRequest->mFD, "
\n"); PR_fprintf(inRequest->mFD, "\n", bytesize); @@ -3135,22 +3150,24 @@ displayAllocationDetails(STRequest * inRequest, STAllocation * aAllocation) "\n", ST_MICROVAL_PRINTABLE(heapCost)); - PR_fprintf(inRequest->mFD, "
Final Size:%u
Heap Operation Seconds:" ST_MICROVAL_FORMAT "

\n"); + PR_fprintf(inRequest->mFD, "\n"); /* ** The events. */ - PR_fprintf(inRequest->mFD, "%u Life Event(s):
\n", - aAllocation->mEventCount); - PR_fprintf(inRequest->mFD, "\n"); - PR_fprintf(inRequest->mFD, "\n"); - PR_fprintf(inRequest->mFD, "\n"); - PR_fprintf(inRequest->mFD, "\n"); - PR_fprintf(inRequest->mFD, "\n"); - PR_fprintf(inRequest->mFD, "\n"); - PR_fprintf(inRequest->mFD, "\n"); - PR_fprintf(inRequest->mFD, "\n"); + + { + static const char* const headers[] = { + "Operation", "Size", "Seconds", "" + }; + char caption[100]; + PR_snprintf(caption, sizeof(caption), "%u Life Event(s):
\n", + aAllocation->mEventCount); + htmlStartTable(inRequest, NULL, "allocation-details", caption, headers, + sizeof(headers) / sizeof(headers[0])); + } + for (traverse = 0; traverse < aAllocation->mEventCount && traverse < inRequest->mOptions.mListItemMax; traverse++) { @@ -3211,7 +3228,7 @@ displayAllocationDetails(STRequest * inRequest, STAllocation * aAllocation) displayRes = displayCallsites(inRequest, aAllocation->mEvents[traverse].mCallsite, - ST_FOLLOW_PARENTS, 0, __LINE__); + ST_FOLLOW_PARENTS, 0, "(?? fill me in ??)", __LINE__); if (0 != displayRes) { retval = __LINE__; REPORT_ERROR(__LINE__, displayCallsite); @@ -3221,7 +3238,7 @@ displayAllocationDetails(STRequest * inRequest, STAllocation * aAllocation) PR_fprintf(inRequest->mFD, "\n"); } - PR_fprintf(inRequest->mFD, "
OperationSizeSeconds

\n"); + PR_fprintf(inRequest->mFD, "\n"); } else { retval = __LINE__; @@ -3374,7 +3391,9 @@ compareCallsites(const void *aSite1, const void *aSite2, void *aContext) */ int displayTopCallsites(STRequest * inRequest, tmcallsite ** aCallsites, - PRUint32 aCallsiteCount, PRUint32 aStamp, int aRealName) + PRUint32 aCallsiteCount, PRUint32 aStamp, + const char* caption, + int aRealName) { int retval = 0; @@ -3417,19 +3436,19 @@ displayTopCallsites(STRequest * inRequest, tmcallsite ** aCallsites, ** We got a header yet? */ if (0 == headerDisplayed) { + static const char* const headers[] = { + "Rank", + "Callsite", + "Size", + "Seconds", + "Weight", + "Object Count", + "C.H. Operation (sec)" + }; headerDisplayed = __LINE__; - PR_fprintf(inRequest->mFD, - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "\n"); + htmlStartTable(inRequest, NULL, "top-callsites", caption, headers, + sizeof(headers) / sizeof(headers[0])); } displayed++; @@ -3512,7 +3531,7 @@ displayTopCallsites(STRequest * inRequest, tmcallsite ** aCallsites, ** We need to terminate anything? */ if (0 != headerDisplayed) { - PR_fprintf(inRequest->mFD, "
RankCallsiteC. SizeC. SecondsC. WeightH.O. CountC.H. Operation (sec)
\n"); + PR_fprintf(inRequest->mFD, "\n"); } } else { @@ -3543,24 +3562,26 @@ displayCallsiteDetails(STRequest * inRequest, tmcallsite * aCallsite) const char *sourceFile = NULL; sourceFile = resolveSourceFile(aCallsite->method); - if (NULL != sourceFile) { + + PR_fprintf(inRequest->mFD, "

\n"); + if (sourceFile) { PR_fprintf(inRequest->mFD, "%s", tmmethodnode_name(aCallsite->method)); PR_fprintf(inRequest->mFD, - "(%s:%u)", + " [%s:%u]", aCallsite->method->sourcefile, aCallsite->method->linenumber, sourceFile, aCallsite->method->linenumber); - PR_fprintf(inRequest->mFD, " Callsite Details:

\n"); } else { PR_fprintf(inRequest->mFD, - "%s+%u(%u) Callsite Details:

\n", + "

%s+%u(%u) Callsite Details:

\n", tmmethodnode_name(aCallsite->method), aCallsite->offset, (PRUint32) aCallsite->entry.key); } - PR_fprintf(inRequest->mFD, "\n"); + PR_fprintf(inRequest->mFD, "\n\n"); + PR_fprintf(inRequest->mFD, "
\n"); PR_fprintf(inRequest->mFD, "\n", thisRun->mStats[inRequest->mContext->mIndex].mSize); @@ -3583,7 +3604,7 @@ displayCallsiteDetails(STRequest * inRequest, tmcallsite * aCallsite) ST_MICROVAL_PRINTABLE(thisRun-> mStats[inRequest->mContext->mIndex]. mHeapRuntimeCost)); - PR_fprintf(inRequest->mFD, "
Composite Byte Size:%u
\n

\n"); + PR_fprintf(inRequest->mFD, "

\n\n"); /* ** Kids (callsites we call): @@ -3604,16 +3625,14 @@ displayCallsiteDetails(STRequest * inRequest, tmcallsite * aCallsite) /* ** Got something to show. */ - PR_fprintf(inRequest->mFD, "Children Callsites:
\n"); - displayRes = displayTopCallsites(inRequest, sites, siteCount, 0, + "Children Callsites", __LINE__); if (0 != displayRes) { retval = __LINE__; REPORT_ERROR(__LINE__, displayTopCallsites); } - PR_fprintf(inRequest->mFD, "

\n"); /* ** Done with array. @@ -3629,15 +3648,14 @@ displayCallsiteDetails(STRequest * inRequest, tmcallsite * aCallsite) if (NULL != aCallsite->parent && NULL != aCallsite->parent->method) { int displayRes = 0; - PR_fprintf(inRequest->mFD, "Parent Callsites:
\n"); displayRes = displayCallsites(inRequest, aCallsite->parent, - ST_FOLLOW_PARENTS, 0, __LINE__); + ST_FOLLOW_PARENTS, 0, "Caller stack", + __LINE__); if (0 != displayRes) { retval = __LINE__; REPORT_ERROR(__LINE__, displayCallsites); } - PR_fprintf(inRequest->mFD, "

\n"); } /* @@ -3659,14 +3677,14 @@ displayCallsiteDetails(STRequest * inRequest, tmcallsite * aCallsite) if (0 == sortRes) { int displayRes = 0; - PR_fprintf(inRequest->mFD, "Allocations:
\n"); displayRes = - displayTopAllocations(inRequest, sortedRun, 0); + displayTopAllocations(inRequest, sortedRun, + "Allocations", + 0); if (0 != displayRes) { retval = __LINE__; REPORT_ERROR(__LINE__, displayTopAllocations); } - PR_fprintf(inRequest->mFD, "

\n"); } else { retval = __LINE__; @@ -5366,7 +5384,9 @@ handleRequest(tmreader * aTMR, PRFileDesc * aFD, htmlHeader(&request, "SpaceTrace Top Allocations Report"); displayRes = displayTopAllocations(&request, - request.mContext->mSortedRun, 1); + request.mContext->mSortedRun, + "SpaceTrace Top Allocations Report", + 1); if (0 != displayRes) { retval = __LINE__; REPORT_ERROR(__LINE__, displayTopAllocations); @@ -5392,7 +5412,9 @@ handleRequest(tmreader * aTMR, PRFileDesc * aFD, if (0 != arrayCount && NULL != array) { displayRes = displayTopCallsites(&request, array, arrayCount, - 0, 0); + 0, + "Top Callsites Report", + 0); if (0 != displayRes) { retval = __LINE__; REPORT_ERROR(__LINE__, displayTopCallsites); @@ -5500,7 +5522,9 @@ handleRequest(tmreader * aTMR, PRFileDesc * aFD, htmlHeader(&request, "SpaceTrace Root Callsites"); displayRes = displayCallsites(&request, aTMR->calltree_root.kids, - ST_FOLLOW_SIBLINGS, 0, __LINE__); + ST_FOLLOW_SIBLINGS, 0, + "SpaceTrace Root Callsites", + __LINE__); if (0 != displayRes) { retval = __LINE__; REPORT_ERROR(__LINE__, displayCallsites); @@ -5742,7 +5766,7 @@ handleClient(void *inArg) */ PR_fprintf(aFD, "HTTP/1.1 200 OK%s", crlf); PR_fprintf(aFD, "Server: %s%s", - "$Id: spacetrace.c,v 1.46 2003-06-17 23:01:45 alecf%flett.org Exp $", + "$Id: spacetrace.c,v 1.47 2003-06-18 02:02:01 alecf%flett.org Exp $", crlf); PR_fprintf(aFD, "Content-type: "); if (NULL != strstr(start, ".png")) { diff --git a/mozilla/tools/trace-malloc/spacetrace.css b/mozilla/tools/trace-malloc/spacetrace.css index 9a3acc59502..8b08dd1be8a 100644 --- a/mozilla/tools/trace-malloc/spacetrace.css +++ b/mozilla/tools/trace-malloc/spacetrace.css @@ -51,10 +51,12 @@ body { /* footer stuff */ .footer-separator { border: 1px inset; + display: none; } .footer { text-align: right; + display: none; } .footer-text { @@ -88,8 +90,42 @@ body { border: thin inset; } +.callsite-header { + padding: 10px; +} /* data tables */ +#callsite-details { + position: absolute; + right: 1px; + top: 40px; + width: 20%; +} +#top-callsites { + width: 75%; + height: 40%; + overflow: scroll; +} + +#callsites { + height: 45%; + width: 75%; + overflow: scroll; + padding-top: 5px; +} + +#top-allocations { + position: absolute; + right: 1px; + bottom: 1px; + height: 40%; + width: 20%; + overflow: scroll; +} + +#top-allocations tbody { +/* overflow: scroll; */ +} /* headers at the top of specific call site pages */ table.summary { @@ -129,4 +165,5 @@ th.callsite { a.source, a.callsite { text-decoration: none; -} \ No newline at end of file +} +