PR_fprintf(globals.mRequest.mFD, "There are 3 choices:<br>\n"); PR_fprintf(globals.mRequest.mFD, "<ul><li>0 is by weight (byte size * seconds).<li>1 is by byte size.<li>2 is by seconds (lifetime).</ul><p>\n");
PR_fprintf(globals.mRequest.mFD, "There are several choices:<br>\n"); PR_fprintf(globals.mRequest.mFD, "<ul><li>0 is by weight (byte size * seconds).<li>1 is by byte size.<li>2 is by seconds (lifetime).<li>3 is by allocation object count.<li>4 is by heap operation runtime cost.</ul><p>\n");
int displaySettings(void){    int retval = 0;    PRUint32 cached = 0;    /*    ** If we've got get data, we need to attempt to enact the changes.    ** That way, when we show the page, it will have the new changes.    */    if(NULL != globals.mRequest.mGetData && '\0' != *globals.mRequest.mGetData)    {        int getRes = 0;        int changedSet = 0;        int changedOrder = 0;        int changedGraph = 0;        int changedDontCare = 0;        getRes += getDataPRUint32(globals.mRequest.mGetData, "mListItemMax", &globals.mOptions.mListItemMax, &changedDontCare, 1);        getRes += getDataPRUint32(globals.mRequest.mGetData, "mTimevalMin", &globals.mOptions.mTimevalMin, &changedSet, ST_TIMEVAL_RESOLUTION);        getRes += getDataPRUint32(globals.mRequest.mGetData, "mTimevalMax", &globals.mOptions.mTimevalMax, &changedSet, ST_TIMEVAL_RESOLUTION);        getRes += getDataPRUint32(globals.mRequest.mGetData, "mAllocationTimevalMin", &globals.mOptions.mAllocationTimevalMin, &changedSet, ST_TIMEVAL_RESOLUTION);        getRes += getDataPRUint32(globals.mRequest.mGetData, "mAllocationTimevalMax", &globals.mOptions.mAllocationTimevalMax, &changedSet, ST_TIMEVAL_RESOLUTION);#if WANT_GRAPHS        getRes += getDataPRUint32(globals.mRequest.mGetData, "mGraphTimevalMin", &globals.mOptions.mGraphTimevalMin, &changedGraph, ST_TIMEVAL_RESOLUTION);        getRes += getDataPRUint32(globals.mRequest.mGetData, "mGraphTimevalMax", &globals.mOptions.mGraphTimevalMax, &changedGraph, ST_TIMEVAL_RESOLUTION);#endif /* WANT_GRAPHS */        getRes += getDataPRUint32(globals.mRequest.mGetData, "mSizeMin", &globals.mOptions.mSizeMin, &changedSet, 1);        getRes += getDataPRUint32(globals.mRequest.mGetData, "mSizeMax", &globals.mOptions.mSizeMax, &changedSet, 1);        getRes += getDataPRUint32(globals.mRequest.mGetData, "mAlignBy", &globals.mOptions.mAlignBy, &changedSet, 1);        getRes += getDataPRUint32(globals.mRequest.mGetData, "mOrderBy", &globals.mOptions.mOrderBy, &changedOrder, 1);        getRes += getDataPRUint32(globals.mRequest.mGetData, "mLifetimeMin", &globals.mOptions.mLifetimeMin, &changedSet, ST_TIMEVAL_RESOLUTION);        getRes += getDataPRUint32(globals.mRequest.mGetData, "mLifetimeMax", &globals.mOptions.mLifetimeMax, &changedSet, ST_TIMEVAL_RESOLUTION);        getRes += getDataPRUint64(globals.mRequest.mGetData, "mWeightMin", &globals.mOptions.mWeightMin64, &changedSet);        getRes += getDataPRUint64(globals.mRequest.mGetData, "mWeightMax", &globals.mOptions.mWeightMax64, &changedSet);        getRes += getDataString(globals.mRequest.mGetData, "mRestrictText", &globals.mOptions.mRestrictText, &changedSet);        /*        ** Resort the global based on new prefs if needed.        */        if(0 != changedSet || 0 != changedOrder)        {            if(NULL != globals.mCache.mSortedRun)            {                freeRun(globals.mCache.mSortedRun);            }            globals.mCache.mSortedRun = createRunFromGlobal();            if(NULL == globals.mCache.mSortedRun)            {                retval = __LINE__;                REPORT_ERROR(__LINE__, createRunFromGlobal);            }        }#if WANT_GRAPHS        /*        ** If any of the set was changed, we need to throw away all our        **  cached graphs.        */        if(0 != changedSet || 0 != changedGraph)        {            /*            ** Automove the graph timeval if required.            */            if((globals.mMaxTimeval - globals.mMinTimeval) < globals.mOptions.mGraphTimevalMax)            {                globals.mOptions.mGraphTimevalMax = (globals.mMaxTimeval - globals.mMinTimeval);            }            globals.mCache.mFootprintCached = 0;            globals.mCache.mTimevalCached = 0;            globals.mCache.mLifespanCached = 0;            globals.mCache.mWeightCached = 0;        }#endif /* WANT_GRAPHS */        /*        ** Report on the operation.        */        if(0 != getRes)        {            retval = __LINE__;            REPORT_ERROR(__LINE__, getDataPRUint32);            PR_fprintf(globals.mRequest.mFD, "<blink><b>%u: There was a problem.  Some changes may have been applied.</b></blink><br><hr>\n", PR_IntervalNow());        }        else        {            PR_fprintf(globals.mRequest.mFD, "<b>%u: Your changes have been applied.</b><br><hr>\n", PR_IntervalNow());        }    }    /*    ** A small blurb regarding the options.    */    PR_fprintf(globals.mRequest.mFD, "NOTES:<p>\n");    cached = globals.mMaxTimeval - globals.mMinTimeval;    PR_fprintf(globals.mRequest.mFD, "The total seconds in this run is: 0 to " ST_TIMEVAL_FORMAT "<br>\n", ST_TIMEVAL_PRINTABLE(cached));    PR_fprintf(globals.mRequest.mFD, "All options should have command line equivalents to support batch mode.<br>\n");    PR_fprintf(globals.mRequest.mFD, "Changes to the options take effect immediately.<br>\n");    PR_fprintf(globals.mRequest.mFD, "<hr>\n");    /*    ** We've got a form to create.    */    PR_fprintf(globals.mRequest.mFD, "<form method=get action=\"./options.html\">\n");    PR_fprintf(globals.mRequest.mFD, "Maximum number of items to display in a list?<br>\n");    PR_fprintf(globals.mRequest.mFD, "This option exists to control how much information you are willing to accept.<p>\n");    PR_fprintf(globals.mRequest.mFD, "<input type=text name=\"mListItemMax\" value=\"%u\"><br>\n", globals.mOptions.mListItemMax);    PR_fprintf(globals.mRequest.mFD, "<hr>\n");    PR_fprintf(globals.mRequest.mFD, "This option controls the sort order of the lists presented.<br>\n");    PR_fprintf(globals.mRequest.mFD, "There are 3 choices:<br>\n");    PR_fprintf(globals.mRequest.mFD, "<ul><li>0 is by weight (byte size * seconds).<li>1 is by byte size.<li>2 is by seconds (lifetime).</ul><p>\n");    PR_fprintf(globals.mRequest.mFD, "Desired sort order?<br>\n");    PR_fprintf(globals.mRequest.mFD, "<input type=text name=\"mOrderBy\" value=\"%u\"><br>\n", globals.mOptions.mOrderBy);    PR_fprintf(globals.mRequest.mFD, "<hr>\n");#if WANT_GRAPHS    PR_fprintf(globals.mRequest.mFD, "Modify the seconds for which the graphs cover;<br>\n");    PR_fprintf(globals.mRequest.mFD, "meaning that a narrower range will produce a more detailed graph for that timespan.<p>\n");    PR_fprintf(globals.mRequest.mFD, "Minimum graph second?<br>\n");    PR_fprintf(globals.mRequest.mFD, "<input type=text name=\"mGraphTimevalMin\" value=\"%u\"><br>\n", globals.mOptions.mGraphTimevalMin / ST_TIMEVAL_RESOLUTION);    PR_fprintf(globals.mRequest.mFD, "Maximum graph second?<br>\n");    PR_fprintf(globals.mRequest.mFD, "<input type=text name=\"mGraphTimevalMax\" value=\"%u\"><br>\n", globals.mOptions.mGraphTimevalMax / ST_TIMEVAL_RESOLUTION);    PR_fprintf(globals.mRequest.mFD, "<hr>\n");#endif /* WANT_GRAPHS */    PR_fprintf(globals.mRequest.mFD, "Modify the secondss to target allocations created during a particular timespan;<br>\n");    PR_fprintf(globals.mRequest.mFD, "meaning that the allocations created only within the timespan are of interest.<p>\n");    PR_fprintf(globals.mRequest.mFD, "Minimum allocation second?<br>\n");    PR_fprintf(globals.mRequest.mFD, "<input type=text name=\"mAllocationTimevalMin\" value=\"%u\"><br>\n", globals.mOptions.mAllocationTimevalMin / ST_TIMEVAL_RESOLUTION);    PR_fprintf(globals.mRequest.mFD, "Maximum allocation second?<br>\n");    PR_fprintf(globals.mRequest.mFD, "<input type=text name=\"mAllocationTimevalMax\" value=\"%u\"><br>\n", globals.mOptions.mAllocationTimevalMax / ST_TIMEVAL_RESOLUTION);    PR_fprintf(globals.mRequest.mFD, "<hr>\n");    PR_fprintf(globals.mRequest.mFD, "Modify the byte sizes to target allocations of a particular byte size.<p>\n");    PR_fprintf(globals.mRequest.mFD, "Minimum byte size?<br>\n");    PR_fprintf(globals.mRequest.mFD, "<input type=text name=\"mSizeMin\" value=\"%u\"><br>\n", globals.mOptions.mSizeMin);    PR_fprintf(globals.mRequest.mFD, "Maximum byte size?<br>\n");    PR_fprintf(globals.mRequest.mFD, "<input type=text name=\"mSizeMax\" value=\"%u\"><br>\n", globals.mOptions.mSizeMax);    PR_fprintf(globals.mRequest.mFD, "<hr>\n");    PR_fprintf(globals.mRequest.mFD, "Modify the alignment boundry of allocations to see the actual impact an allocation has on a heap;<br>\n");    PR_fprintf(globals.mRequest.mFD, "meaning that normally an allocation of 1 bytes actually costs more bytes depending on your heap implementation.<p>\n");    PR_fprintf(globals.mRequest.mFD, "Align by?<br>\n");    PR_fprintf(globals.mRequest.mFD, "<input type=text name=\"mAlignBy\" value=\"%u\"><br>\n", globals.mOptions.mAlignBy);    PR_fprintf(globals.mRequest.mFD, "<hr>\n");    PR_fprintf(globals.mRequest.mFD, "Modify the seconds to target allocations of a particular lifespan/duration;<br>\n");    PR_fprintf(globals.mRequest.mFD, "meaning that the allocations existed at least or at most the specified span of time.<p>\n");    PR_fprintf(globals.mRequest.mFD, "Minimum lifetime?<br>\n");    PR_fprintf(globals.mRequest.mFD, "<input type=text name=\"mLifetimeMin\" value=\"%u\"><br>\n", globals.mOptions.mLifetimeMin / ST_TIMEVAL_RESOLUTION);    PR_fprintf(globals.mRequest.mFD, "Maximum lifetime?<br>\n");    PR_fprintf(globals.mRequest.mFD, "<input type=text name=\"mLifetimeMax\" value=\"%u\"><br>\n", globals.mOptions.mLifetimeMax / ST_TIMEVAL_RESOLUTION);    PR_fprintf(globals.mRequest.mFD, "<hr>\n");    PR_fprintf(globals.mRequest.mFD, "Modify the numbers to target allocations of particular weights;<br>\n");    PR_fprintf(globals.mRequest.mFD, "the weight of an allocation is the byte size multiplied by the lifespan.<p>\n");    PR_fprintf(globals.mRequest.mFD, "Minimum weight?<br>\n");    PR_fprintf(globals.mRequest.mFD, "<input type=text name=\"mWeightMin\" value=\"%llu\"><br>\n", globals.mOptions.mWeightMin64);    PR_fprintf(globals.mRequest.mFD, "Maximum weight?<br>\n");    PR_fprintf(globals.mRequest.mFD, "<input type=text name=\"mWeightMax\" value=\"%llu\"><br>\n", globals.mOptions.mWeightMax64);    PR_fprintf(globals.mRequest.mFD, "<hr>\n");    PR_fprintf(globals.mRequest.mFD, "By manipulating the time range, you narrow or widen the set of live allocations evaluated.  Allocations existing solely before the minimum or solely after the maximum will not be considered.<p>\n");    PR_fprintf(globals.mRequest.mFD, "Minimum second?<br>\n");    PR_fprintf(globals.mRequest.mFD, "<input type=text name=\"mTimevalMin\" value=\"%u\"><br>\n", globals.mOptions.mTimevalMin / ST_TIMEVAL_RESOLUTION);    PR_fprintf(globals.mRequest.mFD, "Maximum timeval?<br>\n");    PR_fprintf(globals.mRequest.mFD, "<input type=text name=\"mTimevalMax\" value=\"%u\"><br>\n", globals.mOptions.mTimevalMax / ST_TIMEVAL_RESOLUTION);    PR_fprintf(globals.mRequest.mFD, "<hr>\n");    PR_fprintf(globals.mRequest.mFD, "Restrict callsite backtraces to thost only containing the specified text.\n");    PR_fprintf(globals.mRequest.mFD, "This allows targeting of specific creation functions.<br>\n");    PR_fprintf(globals.mRequest.mFD, "<input type=text name=\"mRestrictText\" value=\"%s\"><br>\n", NULL == globals.mOptions.mRestrictText ? "" : globals.mOptions.mRestrictText);    PR_fprintf(globals.mRequest.mFD, "<hr>\n");    /*    ** And last but not least, the submission button.    */    PR_fprintf(globals.mRequest.mFD, "<input type=submit value=\"Submit Changes\"><input type=reset value=\"Obligatory Reset Button\"><br>\n");    PR_fprintf(globals.mRequest.mFD, "</form>\n");    return retval;}