minor warnings cleanup, make a htmlStartTable() method to consolidate some code

not part of the build


git-svn-id: svn://10.0.0.236/trunk@143823 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
alecf%flett.org
2003-06-17 23:01:46 +00:00
parent d351d2077b
commit 797c2fddf2
3 changed files with 54 additions and 35 deletions

View File

@@ -55,6 +55,7 @@ extern int optind;
#include "prlog.h"
#include "prprf.h"
#include "plhash.h"
#include "pldhash.h"
#include "nsTraceMalloc.h"
#include "tmreader.h"

View File

@@ -2387,6 +2387,22 @@ htmlNotFound(STRequest * inRequest)
htmlFooter(inRequest);
}
void
htmlStartTable(STRequest* inRequest, const char* table_class, const char * const headers[], PRUint32 header_length)
{
PRUint32 i;
PR_fprintf(inRequest->mFD,
"<table class=\"data %s\">\n"
" <tr class=\"row-header\">\n", table_class ? table_class : "");
for (i=0; i< header_length; i++)
PR_fprintf(inRequest->mFD,
" <th>%s</th>\n", headers[i]);
PR_fprintf(inRequest->mFD, "</tr>\n");
}
/*
** callsiteArrayFromCallsite
**
@@ -2684,19 +2700,22 @@ displayTopAllocations(STRequest * inRequest, STRun * aRun, int aWantCallsite)
PRUint32 loop = 0;
STAllocation *current = NULL;
PR_fprintf(inRequest->mFD, "<table class=\"data\">\n");
PR_fprintf(inRequest->mFD, "<tr class=\"row-header\">\n");
PR_fprintf(inRequest->mFD, "<th>Rank</th>\n");
PR_fprintf(inRequest->mFD, "<th>Index</th>\n");
PR_fprintf(inRequest->mFD, "<th>Byte Size</th>\n");
PR_fprintf(inRequest->mFD, "<th>Lifespan Seconds</th>\n");
PR_fprintf(inRequest->mFD, "<th>Weight</th>\n");
PR_fprintf(inRequest->mFD, "<th>Heap Operation Seconds</th>\n");
if (0 != aWantCallsite) {
PR_fprintf(inRequest->mFD, "<th>Origin Callsite</th>\n");
}
PR_fprintf(inRequest->mFD, "</tr>\n");
static const char* const headers[] = {
"Rank", "Index", "Byte Size", "Lifespan (sec)",
"Weight", "Heap Op (sec)"
};
static const char* const headers_callsite[] = {
"Rank", "Index", "Byte Size", "Lifespan (sec)",
"Weight", "Heap Op (sec)", "Origin Callsite"
};
if (aWantCallsite)
htmlStartTable(inRequest, NULL, headers_callsite,
sizeof(headers_callsite) / sizeof(headers_callsite[0]));
else
htmlStartTable(inRequest, NULL, headers,
sizeof(headers) / sizeof(headers[0]));
/*
** Loop over the items, up to some limit or until the end.
*/
@@ -2805,16 +2824,13 @@ displayMemoryLeaks(STRequest * inRequest, STRun * aRun)
PRUint32 displayed = 0;
STAllocation *current = NULL;
PR_fprintf(inRequest->mFD, "<table class=\"data\">\n");
PR_fprintf(inRequest->mFD, "<tr class=\"row-header\">\n");
PR_fprintf(inRequest->mFD, "<th>Rank</th>\n");
PR_fprintf(inRequest->mFD, "<th>Index</th>\n");
PR_fprintf(inRequest->mFD, "<th>Byte Size</th>\n");
PR_fprintf(inRequest->mFD, "<th>Lifespan Seconds</th>\n");
PR_fprintf(inRequest->mFD, "<th>Weight</th>\n");
PR_fprintf(inRequest->mFD, "<th>Heap Operation Seconds</th>\n");
PR_fprintf(inRequest->mFD, "<th>Origin Callsite</th>\n");
PR_fprintf(inRequest->mFD, "</tr>\n");
static const char * headers[] = {
"Rank", "Index", "Byte Size", "Lifespan (sec)",
"Weight", "Heap Op (sec)", "Origin Callsite"
};
htmlStartTable(inRequest, NULL, headers,
sizeof(headers) / sizeof(headers[0]));
/*
** Loop over all of the items, or until we've displayed enough.
@@ -2959,16 +2975,16 @@ displayCallsites(STRequest * inRequest, tmcallsite * aCallsite, int aFollow,
if (0 == headerDisplayed) {
headerDisplayed = __LINE__;
PR_fprintf(inRequest->mFD,
"<table class=\"data\">\n"
"<tr class=\"row-header\">\n"
"<th class=\"callsite\">Callsite</th>\n"
"<th><abbr title=\"Composite Size\">C. Size</abbr></th>\n"
"<th><abbr title=\"Composite Seconds\">C. Seconds</abbr></th>\n"
"<th><abbr title=\"Composite Weight\">C. Weight</abbr></th>\n"
"<th><abbr title=\"Heap Object Count\">H.O. Count</abbr></th>\n"
"<th><abbr title=\"Composite Heap Operation Seconds\">C.H. Operation (sec)</abbr></th>\n"
"</tr>\n");
static const char* const headers[] = {
"Callsite",
"<abbr title=\"Composite Size\">C. Size</abbr>",
"<abbr title=\"Composite Seconds\">C. Seconds</abbr>",
"<abbr title=\"Composite Weight\">C. Weight</abbr>",
"<abbr title=\"Heap Object Count\">H.O. Count</abbr>",
"<abbr title=\"Composite Heap Operation Seconds\">C.H. Operation (sec)</abbr>"
};
htmlStartTable(inRequest, NULL, headers,
sizeof(headers)/sizeof(headers[0]));
}
/*
@@ -5726,7 +5742,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.45 2003-06-17 21:10:48 alecf%flett.org Exp $",
"$Id: spacetrace.c,v 1.46 2003-06-17 23:01:45 alecf%flett.org Exp $",
crlf);
PR_fprintf(aFD, "Content-type: ");
if (NULL != strstr(start, ".png")) {

View File

@@ -307,7 +307,7 @@ static PLHashEntry *callsite_allocentry(void *pool, const void *key)
return (PLHashEntry*)arena_alloc(pool, sizeof(tmcallsite));
}
static init_graphnode(tmgraphnode* node)
static void init_graphnode(tmgraphnode* node)
{
node->in = node->out = NULL;
node->up = node->down = node->next = NULL;
@@ -639,6 +639,8 @@ int tmreader_eventloop(tmreader *tmr, const char *filename,
hash = hash_serial(key);
hep = PL_HashTableRawLookup(tmr->callsites, hash, key);
he = *hep;
/* there should not be an entry here! */
PR_ASSERT(!he);
if (he) exit(2);
@@ -684,7 +686,7 @@ int tmreader_eventloop(tmreader *tmr, const char *filename,
case TM_EVENT_REALLOC: {
tmcallsite *site;
uint32 size, oldsize;
double delta, sqdelta, sqszdelta;
double delta, sqdelta, sqszdelta = 0;
tmgraphnode *comp, *lib;
tmmethodnode *meth;