зеркало из https://github.com/mozilla/pjs.git
Not part of a normal build.
Change it such that all options come from framework. Basically, a very large whack in regards to processing.
This commit is contained in:
Родитель
610948ea7d
Коммит
b8c567b4d7
|
@ -38,6 +38,7 @@ SIMPLE_PROGRAMS = $(SIMPLECSRCS:.c=$(BIN_SUFFIX))
|
|||
CSRCS = \
|
||||
spacetrace.c \
|
||||
spacecategory.c \
|
||||
formdata.c \
|
||||
$(NULL)
|
||||
|
||||
PROGRAM = spacetrace$(BIN_SUFFIX)
|
||||
|
|
|
@ -0,0 +1,232 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (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.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is formdata.c code, released
|
||||
* May 9, 2002.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2002 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Garrett Arch Blythe, 09-May-2002
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the
|
||||
* terms of the GNU Public License (the "GPL"), in which case the
|
||||
* provisions of the GPL are applicable instead of those above.
|
||||
* If you wish to allow use of your version of this file only
|
||||
* under the terms of the GPL and not to allow others to use your
|
||||
* version of this file under the MPL, indicate your decision by
|
||||
* deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this
|
||||
* file under either the MPL or the GPL.
|
||||
*/
|
||||
|
||||
/*
|
||||
** formdata.c
|
||||
**
|
||||
** Play utility to parse up form get data into name value pairs.
|
||||
*/
|
||||
|
||||
#include "formdata.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
static void unhexcape(char* inPlace)
|
||||
/*
|
||||
** Real low tech unhexcaper....
|
||||
**
|
||||
** inPlace string to decode, in place as it were.
|
||||
*/
|
||||
{
|
||||
if(NULL != inPlace)
|
||||
{
|
||||
int index1 = 0;
|
||||
int index2 = 0;
|
||||
int theLen = strlen(inPlace);
|
||||
|
||||
for(; index1 <= theLen; index1++)
|
||||
{
|
||||
if('%' == inPlace[index1] && '\0' != inPlace[index1 + 1] && '\0' != inPlace[index1 + 2])
|
||||
{
|
||||
int unhex = 0;
|
||||
|
||||
if('9' >= inPlace[index1 + 1])
|
||||
{
|
||||
unhex |= ((inPlace[index1 + 1] - '0') << 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
unhex |= ((toupper(inPlace[index1 + 1]) - 'A' + 10) << 4);
|
||||
}
|
||||
|
||||
if('9' >= inPlace[index1 + 2])
|
||||
{
|
||||
unhex |= (inPlace[index1 + 2] - '0');
|
||||
}
|
||||
else
|
||||
{
|
||||
unhex |= (toupper(inPlace[index1 + 2]) - 'A' + 10);
|
||||
}
|
||||
|
||||
index1 += 2;
|
||||
inPlace[index1] = unhex;
|
||||
}
|
||||
|
||||
inPlace[index2++] = inPlace[index1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FormData* FormData_Create(const char* inFormData)
|
||||
{
|
||||
FormData* retval = NULL;
|
||||
|
||||
if(NULL != inFormData)
|
||||
{
|
||||
FormData* container = NULL;
|
||||
|
||||
/*
|
||||
** Allocate form data container.
|
||||
*/
|
||||
container = (FormData*)calloc(1, sizeof(FormData));
|
||||
if(NULL != container)
|
||||
{
|
||||
/*
|
||||
** Dup the incoming form data.
|
||||
*/
|
||||
container->mStorage = strdup(inFormData);
|
||||
if(NULL != container->mStorage)
|
||||
{
|
||||
char* traverse = NULL;
|
||||
unsigned nvpairs = 1;
|
||||
unsigned storeLen = 0;
|
||||
|
||||
/*
|
||||
** Count the number of pairs we are going to have.
|
||||
** We do this by counting '&' + 1.
|
||||
*/
|
||||
for(traverse = container->mStorage; '\0' != *traverse; traverse++)
|
||||
{
|
||||
if('&' == *traverse)
|
||||
{
|
||||
nvpairs++;
|
||||
}
|
||||
}
|
||||
storeLen = (unsigned)(traverse - container->mStorage);
|
||||
|
||||
/*
|
||||
** Allocate space for our names and values.
|
||||
*/
|
||||
container->mNArray = (char**)calloc(nvpairs * 2, sizeof(char*));
|
||||
if(NULL != container->mNArray)
|
||||
{
|
||||
char* amp = NULL;
|
||||
char* equ = NULL;
|
||||
|
||||
container->mVArray = &container->mNArray[nvpairs];
|
||||
|
||||
/*
|
||||
** Go back over the storage.
|
||||
** Fill in the names and values as we go.
|
||||
** Terminate on dividing '=' and '&' characters.
|
||||
** Increase the count of items as we go.
|
||||
*/
|
||||
for(traverse = container->mStorage; NULL != traverse; container->mNVCount++)
|
||||
{
|
||||
container->mNArray[container->mNVCount] = traverse;
|
||||
|
||||
amp = strchr(traverse, '&');
|
||||
equ = strchr(traverse, '=');
|
||||
traverse = NULL;
|
||||
|
||||
if(NULL != equ && (NULL == amp || equ < amp))
|
||||
{
|
||||
*equ++ = '\0';
|
||||
|
||||
container->mVArray[container->mNVCount] = equ;
|
||||
}
|
||||
else
|
||||
{
|
||||
container->mVArray[container->mNVCount] = (container->mStorage + storeLen);
|
||||
}
|
||||
|
||||
if(NULL != amp)
|
||||
{
|
||||
*amp++ = '\0';
|
||||
|
||||
traverse = amp;
|
||||
}
|
||||
|
||||
unhexcape(container->mNArray[container->mNVCount]);
|
||||
unhexcape(container->mVArray[container->mNVCount]);
|
||||
}
|
||||
|
||||
retval = container;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** If we failed, cleanup.
|
||||
*/
|
||||
if(NULL == retval)
|
||||
{
|
||||
FormData_Destroy(container);
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
void FormData_Destroy(FormData* inDestroy)
|
||||
{
|
||||
if(NULL != inDestroy)
|
||||
{
|
||||
unsigned traverse = 0;
|
||||
|
||||
for(traverse = 0; traverse < inDestroy->mNVCount; traverse++)
|
||||
{
|
||||
if(NULL != inDestroy->mNArray)
|
||||
{
|
||||
inDestroy->mNArray[traverse] = NULL;
|
||||
}
|
||||
if(NULL != inDestroy->mVArray)
|
||||
{
|
||||
inDestroy->mVArray[traverse] = NULL;
|
||||
}
|
||||
}
|
||||
inDestroy->mNVCount = 0;
|
||||
|
||||
if(NULL != inDestroy->mStorage)
|
||||
{
|
||||
free(inDestroy->mStorage);
|
||||
inDestroy->mStorage = NULL;
|
||||
}
|
||||
|
||||
if(NULL != inDestroy->mNArray)
|
||||
{
|
||||
free(inDestroy->mNArray);
|
||||
inDestroy->mNArray = NULL;
|
||||
inDestroy->mVArray = NULL;
|
||||
}
|
||||
|
||||
free(inDestroy);
|
||||
inDestroy = NULL;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (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.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is formdata.h code, released
|
||||
* May 9, 2002.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2002 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Garrett Arch Blythe, 09-May-2002
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the
|
||||
* terms of the GNU Public License (the "GPL"), in which case the
|
||||
* provisions of the GPL are applicable instead of those above.
|
||||
* If you wish to allow use of your version of this file only
|
||||
* under the terms of the GPL and not to allow others to use your
|
||||
* version of this file under the MPL, indicate your decision by
|
||||
* deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this
|
||||
* file under either the MPL or the GPL.
|
||||
*/
|
||||
|
||||
#if !defined(__formdata_H__)
|
||||
#define __formdata_H__
|
||||
|
||||
/*
|
||||
** formdata.h
|
||||
**
|
||||
** Play (quick and dirty) utility API to parse up form get data into
|
||||
** name value pairs.
|
||||
*/
|
||||
|
||||
typedef struct __struct_FormData
|
||||
/*
|
||||
** Structure to hold the breakdown of any form data.
|
||||
**
|
||||
** mNArray Each form datum is a name value pair.
|
||||
** This array holds the names.
|
||||
** You can find the corresponding value at the same index in
|
||||
** mVArray.
|
||||
** Never NULL, but perhpas an empty string.
|
||||
** mVArray Each form datum is a name value pair.
|
||||
** This array holds the values.
|
||||
** You can find the corresponding name at the same index in
|
||||
** mNArray.
|
||||
** Never NULL, but perhpas an empty string.
|
||||
** mNVCount Count of array items in both mNArray and mVArray.
|
||||
** mStorage Should be ignored by users of this API.
|
||||
** In reality holds the duped and decoded form data.
|
||||
*/
|
||||
{
|
||||
char** mNArray;
|
||||
char** mVArray;
|
||||
unsigned mNVCount;
|
||||
char* mStorage;
|
||||
}
|
||||
FormData;
|
||||
|
||||
FormData* FormData_Create(const char* inFormData)
|
||||
/*
|
||||
** Take a contiguous string of form data, possibly hex encoded, and return
|
||||
** the name value pairs parsed up and decoded.
|
||||
** A caller of this routine should call FormData_Destroy at some point.
|
||||
**
|
||||
** inFormData The form data to parse up and decode.
|
||||
** returns FormData* The result of our effort.
|
||||
** This should be passed to FormData_Destroy at some
|
||||
** point of the memory will be leaked.
|
||||
*/
|
||||
;
|
||||
|
||||
void FormData_Destroy(FormData* inDestroy)
|
||||
/*
|
||||
** Release to the heap the structure previously created via FormData_Create.
|
||||
**
|
||||
** inDestroy The object to free off.
|
||||
*/
|
||||
;
|
||||
|
||||
#endif /* __formdata_H__ */
|
|
@ -34,7 +34,7 @@ LIB1 = .\$(OBJDIR)\tmreader.lib
|
|||
|
||||
PROGRAMS = $(PROG1) $(PROG2) $(PROG3)
|
||||
|
||||
C_OBJS=.\$(OBJDIR)\spacecategory.obj
|
||||
C_OBJS=.\$(OBJDIR)\spacecategory.obj .\$(OBJDIR)\formdata.obj
|
||||
CPP_OBJS=.\$(OBJDIR)\tmreader.obj
|
||||
|
||||
LINCS= $(LINCS) \
|
||||
|
|
|
@ -822,7 +822,7 @@ PRBool displayCategoryNodeProcessor(STRequest* inRequest, void* clientData, STCa
|
|||
STCategoryNode* root = (STCategoryNode *) clientData;
|
||||
PRUint32 byteSize = 0, heapCost = 0, count = 0;
|
||||
double percent = 0;
|
||||
char buf[256];
|
||||
STOptions customOps;
|
||||
|
||||
if (node->run)
|
||||
{
|
||||
|
@ -853,9 +853,12 @@ PRBool displayCategoryNodeProcessor(STRequest* inRequest, void* clientData, STCa
|
|||
PR_fprintf(inRequest->mFD,
|
||||
" <tr>\n"
|
||||
" <td>");
|
||||
|
||||
/* a link to topcallsites report with focus on category */
|
||||
PR_snprintf(buf, sizeof(buf), "top_callsites.html?mCategory=%s", node->categoryName);
|
||||
htmlAnchor(inRequest, buf, node->categoryName, NULL);
|
||||
memcpy(&customOps, &inRequest->mOptions, sizeof(customOps));
|
||||
PR_snprintf(customOps.mCategoryName, sizeof(customOps.mCategoryName), "%s", node->categoryName);
|
||||
|
||||
htmlAnchor(inRequest, "top_callsites.html", node->categoryName, NULL, &customOps);
|
||||
PR_fprintf(inRequest->mFD,
|
||||
"</td>\n"
|
||||
" <td align=right>%u</td>\n"
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -50,6 +50,7 @@
|
|||
#include "nspr.h"
|
||||
#include "nsTraceMalloc.h"
|
||||
#include "tmreader.h"
|
||||
#include "formdata.h"
|
||||
|
||||
/*
|
||||
** Turn on to attempt adding support for graphs on your platform.
|
||||
|
@ -402,6 +403,29 @@ typedef struct __struct_STCategoryMapEntry {
|
|||
const char * categoryName;
|
||||
} STCategoryMapEntry;
|
||||
|
||||
/*
|
||||
** Option genres.
|
||||
**
|
||||
** This helps to determine what functionality each option effects.
|
||||
** In specific, this will help use determine when and when not to
|
||||
** totally recaclulate the sorted run and categories.
|
||||
*/
|
||||
typedef enum __enum_STOptionGenre
|
||||
{
|
||||
CategoryGenre = 0,
|
||||
DataSortGenre,
|
||||
DataSetGenre,
|
||||
DataSizeGenre,
|
||||
UIGenre,
|
||||
ServerGenre,
|
||||
BatchModeGenre,
|
||||
|
||||
/*
|
||||
** Last one please.
|
||||
*/
|
||||
MaxGenres
|
||||
}
|
||||
STOptionGenre;
|
||||
|
||||
/*
|
||||
** STOptions
|
||||
|
@ -410,12 +434,12 @@ typedef struct __struct_STCategoryMapEntry {
|
|||
** The definition of these options exists in a different file.
|
||||
** We access that definition via macros to inline our structure definition.
|
||||
*/
|
||||
#define ST_CMD_OPTION_BOOL(option_name, option_help) PRBool m##option_name;
|
||||
#define ST_CMD_OPTION_STRING(option_name, default_value, option_help) char m##option_name[ST_OPTION_STRING_MAX];
|
||||
#define ST_CMD_OPTION_STRING_ARRAY(option_name, array_size, option_help) char m##option_name[array_size][ST_OPTION_STRING_MAX];
|
||||
#define ST_CMD_OPTION_STRING_PTR_ARRAY(option_name, option_help) const char** m##option_name; PRUint32 m##option_name##Count;
|
||||
#define ST_CMD_OPTION_UINT32(option_name, default_value, multiplier, option_help) PRUint32 m##option_name;
|
||||
#define ST_CMD_OPTION_UINT64(option_name, default_value, multiplier, option_help) PRUint64 m##option_name##64;
|
||||
#define ST_CMD_OPTION_BOOL(option_name, option_genre, option_help) PRBool m##option_name;
|
||||
#define ST_CMD_OPTION_STRING(option_name, option_genre, default_value, option_help) char m##option_name[ST_OPTION_STRING_MAX];
|
||||
#define ST_CMD_OPTION_STRING_ARRAY(option_name, option_genre, array_size, option_help) char m##option_name[array_size][ST_OPTION_STRING_MAX];
|
||||
#define ST_CMD_OPTION_STRING_PTR_ARRAY(option_name, option_genre, option_help) const char** m##option_name; PRUint32 m##option_name##Count;
|
||||
#define ST_CMD_OPTION_UINT32(option_name, option_genre, default_value, multiplier, option_help) PRUint32 m##option_name;
|
||||
#define ST_CMD_OPTION_UINT64(option_name, option_genre, default_value, multiplier, option_help) PRUint64 m##option_name##64;
|
||||
|
||||
typedef struct __struct_STOptions
|
||||
{
|
||||
|
@ -423,21 +447,6 @@ typedef struct __struct_STOptions
|
|||
}
|
||||
STOptions;
|
||||
|
||||
/*
|
||||
** STOptionChange
|
||||
**
|
||||
** Generalized way to determine what options changed.
|
||||
** Useful for flushing caches, et. al.
|
||||
*/
|
||||
typedef struct __struct_STOptionChange
|
||||
{
|
||||
int mSet;
|
||||
int mOrder;
|
||||
int mGraph;
|
||||
int mCategory;
|
||||
}
|
||||
STOptionChange;
|
||||
|
||||
/*
|
||||
** STRequest
|
||||
**
|
||||
|
@ -456,9 +465,9 @@ typedef struct __struct_STRequest
|
|||
const char* mGetFileName;
|
||||
|
||||
/*
|
||||
** The GET form data, if any.
|
||||
** The GET form data, if any.
|
||||
*/
|
||||
const char* mGetData;
|
||||
const FormData* mGetData;
|
||||
|
||||
/*
|
||||
** Options specific to this request.
|
||||
|
@ -475,39 +484,39 @@ typedef struct __struct_STRequest
|
|||
*/
|
||||
typedef struct __struct_STCache
|
||||
{
|
||||
/*
|
||||
** Pre sorted run.
|
||||
*/
|
||||
STRun* mSortedRun;
|
||||
|
||||
/*
|
||||
** Category the mSortedRun belongs to. NULL if not to any category.
|
||||
*/
|
||||
char mCategoryName[ST_OPTION_STRING_MAX];
|
||||
|
||||
/*
|
||||
** Footprint graph cache.
|
||||
*/
|
||||
int mFootprintCached;
|
||||
PRUint32 mFootprintYData[STGD_SPACE_X];
|
||||
|
||||
/*
|
||||
** Timeval graph cache.
|
||||
*/
|
||||
int mTimevalCached;
|
||||
PRUint32 mTimevalYData[STGD_SPACE_X];
|
||||
|
||||
/*
|
||||
** Lifespan graph cache.
|
||||
*/
|
||||
int mLifespanCached;
|
||||
PRUint32 mLifespanYData[STGD_SPACE_X];
|
||||
|
||||
/*
|
||||
** Weight graph cache.
|
||||
*/
|
||||
int mWeightCached;
|
||||
PRUint64 mWeightYData64[STGD_SPACE_X];
|
||||
/*
|
||||
** Pre sorted run.
|
||||
*/
|
||||
STRun* mSortedRun;
|
||||
|
||||
/*
|
||||
** Category the mSortedRun belongs to. NULL if not to any category.
|
||||
*/
|
||||
char mCategoryName[ST_OPTION_STRING_MAX];
|
||||
|
||||
/*
|
||||
** Footprint graph cache.
|
||||
*/
|
||||
int mFootprintCached;
|
||||
PRUint32 mFootprintYData[STGD_SPACE_X];
|
||||
|
||||
/*
|
||||
** Timeval graph cache.
|
||||
*/
|
||||
int mTimevalCached;
|
||||
PRUint32 mTimevalYData[STGD_SPACE_X];
|
||||
|
||||
/*
|
||||
** Lifespan graph cache.
|
||||
*/
|
||||
int mLifespanCached;
|
||||
PRUint32 mLifespanYData[STGD_SPACE_X];
|
||||
|
||||
/*
|
||||
** Weight graph cache.
|
||||
*/
|
||||
int mWeightCached;
|
||||
PRUint64 mWeightYData64[STGD_SPACE_X];
|
||||
} STCache;
|
||||
|
||||
/*
|
||||
|
@ -604,7 +613,7 @@ extern int displayCategoryReport(STRequest* inRequest, STCategoryNode *root, int
|
|||
extern int recalculateAllocationCost(STRun* aRun, STAllocation* aAllocation, PRBool updateParent);
|
||||
extern void htmlHeader(STRequest* inRequest, const char* aTitle);
|
||||
extern void htmlFooter(STRequest* inRequest);
|
||||
extern void htmlAnchor(STRequest* inRequest, const char* aHref, const char* aText, const char* aTarget);
|
||||
extern void htmlAnchor(STRequest* inRequest, const char* aHref, const char* aText, const char* aTarget, STOptions* inOptions);
|
||||
extern char *FormatNumber(PRInt32 num);
|
||||
|
||||
/*
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
** All types of options have some combination of the following elements:
|
||||
**
|
||||
** option_name The name of the option.
|
||||
** option_genre Area the option effects; STOptionGenre.
|
||||
** default_value The default value for the option.
|
||||
** array_size Used to size a string array.
|
||||
** multiplier Some numbers prefer conversion.
|
||||
|
@ -80,40 +81,40 @@
|
|||
** We cover those that you do not define herein.
|
||||
*/
|
||||
#if !defined(ST_CMD_OPTION_BOOL)
|
||||
#define ST_CMD_OPTION_BOOL(option_name, option_help)
|
||||
#define ST_CMD_OPTION_BOOL(option_name, option_genre, option_help)
|
||||
#endif
|
||||
#if !defined(ST_WEB_OPTION_BOOL)
|
||||
#define ST_WEB_OPTION_BOOL(option_name, option_help)
|
||||
#define ST_WEB_OPTION_BOOL(option_name, option_genre, option_help)
|
||||
#endif
|
||||
#if !defined(ST_CMD_OPTION_STRING)
|
||||
#define ST_CMD_OPTION_STRING(option_name, default_value, option_help)
|
||||
#define ST_CMD_OPTION_STRING(option_name, option_genre, default_value, option_help)
|
||||
#endif
|
||||
#if !defined(ST_WEB_OPTION_STRING)
|
||||
#define ST_WEB_OPTION_STRING(option_name, default_value, option_help)
|
||||
#define ST_WEB_OPTION_STRING(option_name, option_genre, default_value, option_help)
|
||||
#endif
|
||||
#if !defined(ST_CMD_OPTION_STRING_ARRAY)
|
||||
#define ST_CMD_OPTION_STRING_ARRAY(option_name, array_size, option_help)
|
||||
#define ST_CMD_OPTION_STRING_ARRAY(option_name, option_genre, array_size, option_help)
|
||||
#endif
|
||||
#if !defined(ST_WEB_OPTION_STRING_ARRAY)
|
||||
#define ST_WEB_OPTION_STRING_ARRAY(option_name, array_size, option_help)
|
||||
#define ST_WEB_OPTION_STRING_ARRAY(option_name, option_genre, array_size, option_help)
|
||||
#endif
|
||||
#if !defined(ST_CMD_OPTION_STRING_PTR_ARRAY)
|
||||
#define ST_CMD_OPTION_STRING_PTR_ARRAY(option_name, option_help)
|
||||
#define ST_CMD_OPTION_STRING_PTR_ARRAY(option_name, option_genre, option_help)
|
||||
#endif
|
||||
#if !defined(ST_WEB_OPTION_STRING_PTR_ARRAY)
|
||||
#define ST_WEB_OPTION_STRING_PTR_ARRAY(option_name, option_help)
|
||||
#define ST_WEB_OPTION_STRING_PTR_ARRAY(option_name, option_genre, option_help)
|
||||
#endif
|
||||
#if !defined(ST_CMD_OPTION_UINT32)
|
||||
#define ST_CMD_OPTION_UINT32(option_name, default_value, multiplier, option_help)
|
||||
#define ST_CMD_OPTION_UINT32(option_name, option_genre, default_value, multiplier, option_help)
|
||||
#endif
|
||||
#if !defined(ST_WEB_OPTION_UINT32)
|
||||
#define ST_WEB_OPTION_UINT32(option_name, default_value, multiplier, option_help)
|
||||
#define ST_WEB_OPTION_UINT32(option_name, option_genre, default_value, multiplier, option_help)
|
||||
#endif
|
||||
#if !defined(ST_CMD_OPTION_UINT64)
|
||||
#define ST_CMD_OPTION_UINT64(option_name, default_value, multiplier, option_help)
|
||||
#define ST_CMD_OPTION_UINT64(option_name, option_genre, default_value, multiplier, option_help)
|
||||
#endif
|
||||
#if !defined(ST_WEB_OPTION_UINT64)
|
||||
#define ST_WEB_OPTION_UINT64(option_name, default_value, multiplier, option_help)
|
||||
#define ST_WEB_OPTION_UINT64(option_name, option_genre, default_value, multiplier, option_help)
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -121,24 +122,24 @@
|
|||
** This basically means such options are accessible from both the command
|
||||
** line and from the web options.
|
||||
*/
|
||||
#define ST_ALL_OPTION_BOOL(option_name, option_help) \
|
||||
ST_CMD_OPTION_BOOL(option_name, option_help) \
|
||||
ST_WEB_OPTION_BOOL(option_name, option_help)
|
||||
#define ST_ALL_OPTION_STRING(option_name, default_value, option_help) \
|
||||
ST_CMD_OPTION_STRING(option_name, default_value, option_help) \
|
||||
ST_WEB_OPTION_STRING(option_name, default_value, option_help)
|
||||
#define ST_ALL_OPTION_STRING_ARRAY(option_name, array_size, option_help) \
|
||||
ST_CMD_OPTION_STRING_ARRAY(option_name, array_size, option_help) \
|
||||
ST_WEB_OPTION_STRING_ARRAY(option_name, array_size, option_help)
|
||||
#define ST_ALL_OPTION_STRING_PTR_ARRAY(option_name, option_help) \
|
||||
ST_CMD_OPTION_STRING_PTR_ARRAY(option_name, option_help) \
|
||||
ST_WEB_OPTION_STRING_PTR_ARRAY(option_name, option_help)
|
||||
#define ST_ALL_OPTION_UINT32(option_name, default_value, multiplier, option_help) \
|
||||
ST_CMD_OPTION_UINT32(option_name, default_value, multiplier, option_help) \
|
||||
ST_WEB_OPTION_UINT32(option_name, default_value, multiplier, option_help)
|
||||
#define ST_ALL_OPTION_UINT64(option_name, default_value, multiplier, option_help) \
|
||||
ST_CMD_OPTION_UINT64(option_name, default_value, multiplier, option_help) \
|
||||
ST_WEB_OPTION_UINT64(option_name, default_value, multiplier, option_help)
|
||||
#define ST_ALL_OPTION_BOOL(option_name, option_genre, option_help) \
|
||||
ST_CMD_OPTION_BOOL(option_name, option_genre, option_help) \
|
||||
ST_WEB_OPTION_BOOL(option_name, option_genre, option_help)
|
||||
#define ST_ALL_OPTION_STRING(option_name, option_genre, default_value, option_help) \
|
||||
ST_CMD_OPTION_STRING(option_name, option_genre, default_value, option_help) \
|
||||
ST_WEB_OPTION_STRING(option_name, option_genre, default_value, option_help)
|
||||
#define ST_ALL_OPTION_STRING_ARRAY(option_name, option_genre, array_size, option_help) \
|
||||
ST_CMD_OPTION_STRING_ARRAY(option_name, option_genre, array_size, option_help) \
|
||||
ST_WEB_OPTION_STRING_ARRAY(option_name, option_genre, array_size, option_help)
|
||||
#define ST_ALL_OPTION_STRING_PTR_ARRAY(option_name, option_genre, option_help) \
|
||||
ST_CMD_OPTION_STRING_PTR_ARRAY(option_name, option_genre, option_help) \
|
||||
ST_WEB_OPTION_STRING_PTR_ARRAY(option_name, option_genre, option_help)
|
||||
#define ST_ALL_OPTION_UINT32(option_name, option_genre, default_value, multiplier, option_help) \
|
||||
ST_CMD_OPTION_UINT32(option_name, option_genre, default_value, multiplier, option_help) \
|
||||
ST_WEB_OPTION_UINT32(option_name, option_genre, default_value, multiplier, option_help)
|
||||
#define ST_ALL_OPTION_UINT64(option_name, option_genre, default_value, multiplier, option_help) \
|
||||
ST_CMD_OPTION_UINT64(option_name, option_genre, default_value, multiplier, option_help) \
|
||||
ST_WEB_OPTION_UINT64(option_name, option_genre, default_value, multiplier, option_help)
|
||||
|
||||
|
||||
|
||||
|
@ -152,11 +153,13 @@
|
|||
*/
|
||||
|
||||
ST_ALL_OPTION_STRING(CategoryName,
|
||||
CategoryGenre,
|
||||
ST_ROOT_CATEGORY_NAME,
|
||||
"Specify a category to focus upon.\n"
|
||||
"Generated reports will focus on allocations in this category.\n")
|
||||
"Specify a category for reports to focus upon.\n"
|
||||
"See http://lxr.mozilla.org/mozilla/source/tools/trace-malloc/rules.txt\n")
|
||||
|
||||
ST_ALL_OPTION_UINT32(OrderBy,
|
||||
DataSortGenre,
|
||||
ST_SIZE, /* for dp :-D */
|
||||
1,
|
||||
"Determine the sort order.\n"
|
||||
|
@ -167,120 +170,134 @@ ST_ALL_OPTION_UINT32(OrderBy,
|
|||
"4 by performance cost.\n")
|
||||
|
||||
ST_ALL_OPTION_STRING_ARRAY(RestrictText,
|
||||
DataSetGenre,
|
||||
ST_SUBSTRING_MATCH_MAX,
|
||||
"Exclude allocations which do not have this text in their backtrace.\n"
|
||||
"Multiple restrictions are treated as a logical AND operation.\n")
|
||||
|
||||
ST_ALL_OPTION_UINT32(SizeMin,
|
||||
DataSetGenre,
|
||||
0,
|
||||
1,
|
||||
"Exclude allocations that are below this byte size.\n")
|
||||
|
||||
ST_ALL_OPTION_UINT32(SizeMax,
|
||||
DataSetGenre,
|
||||
0xFFFFFFFF,
|
||||
1,
|
||||
"Exclude allocations that are above this byte size.\n")
|
||||
|
||||
ST_ALL_OPTION_UINT32(LifetimeMin,
|
||||
DataSetGenre,
|
||||
ST_DEFAULT_LIFETIME_MIN,
|
||||
ST_TIMEVAL_RESOLUTION,
|
||||
"Allocations must live this number of seconds or be ignored.\n")
|
||||
|
||||
ST_ALL_OPTION_UINT32(LifetimeMax,
|
||||
DataSetGenre,
|
||||
ST_TIMEVAL_MAX / ST_TIMEVAL_RESOLUTION,
|
||||
ST_TIMEVAL_RESOLUTION,
|
||||
"Allocations living longer than this number of seconds will be ignored.\n")
|
||||
|
||||
ST_ALL_OPTION_UINT32(TimevalMin,
|
||||
DataSetGenre,
|
||||
0,
|
||||
ST_TIMEVAL_RESOLUTION,
|
||||
"Allocations existing solely before this second will be ignored.\n"
|
||||
"Live allocations at this second and after can be considered.\n")
|
||||
|
||||
ST_ALL_OPTION_UINT32(TimevalMax,
|
||||
DataSetGenre,
|
||||
ST_TIMEVAL_MAX / ST_TIMEVAL_RESOLUTION,
|
||||
ST_TIMEVAL_RESOLUTION,
|
||||
"Allocations existing solely after this second will be ignored.\n"
|
||||
"Live allocations at this second and before can be considered.\n")
|
||||
|
||||
ST_ALL_OPTION_UINT32(AllocationTimevalMin,
|
||||
DataSetGenre,
|
||||
0,
|
||||
ST_TIMEVAL_RESOLUTION,
|
||||
"Live and dead allocations created before this second will be ignored.\n")
|
||||
|
||||
ST_ALL_OPTION_UINT32(AllocationTimevalMax,
|
||||
DataSetGenre,
|
||||
ST_TIMEVAL_MAX / ST_TIMEVAL_RESOLUTION,
|
||||
ST_TIMEVAL_RESOLUTION,
|
||||
"Live and dead allocations created after this second will be ignored.\n")
|
||||
|
||||
ST_ALL_OPTION_UINT32(AlignBy,
|
||||
DataSizeGenre,
|
||||
ST_DEFAULT_ALIGNMENT_SIZE,
|
||||
1,
|
||||
"All allocation sizes are made to be a multiple of this number.\n"
|
||||
"Closer to actual heap conditions; set to 1 for true sizes.\n")
|
||||
|
||||
ST_ALL_OPTION_UINT32(Overhead,
|
||||
DataSizeGenre,
|
||||
ST_DEFAULT_OVERHEAD_SIZE,
|
||||
1,
|
||||
"After alignment, all allocations are made to increase by this number.\n"
|
||||
"Closer to actual heap conditions; set to 0 for true sizes.\n")
|
||||
|
||||
ST_ALL_OPTION_UINT32(ListItemMax,
|
||||
UIGenre,
|
||||
500,
|
||||
1,
|
||||
"Specifies the maximum number of list items to present in each list.\n")
|
||||
|
||||
ST_ALL_OPTION_UINT64(WeightMin,
|
||||
DataSetGenre,
|
||||
LL_INIT(0, 0),
|
||||
LL_INIT(0, 1),
|
||||
"Exclude allocations that are below this weight (lifespan * size).\n")
|
||||
|
||||
ST_ALL_OPTION_UINT64(WeightMax,
|
||||
DataSetGenre,
|
||||
LL_INIT(0xFFFFFFFF, 0xFFFFFFFF),
|
||||
LL_INIT(0, 1),
|
||||
"Exclude allocations that are above this weight (lifespan * size).\n")
|
||||
|
||||
#if ST_WANT_GRAPHS
|
||||
|
||||
ST_ALL_OPTION_UINT32(GraphTimevalMin,
|
||||
0,
|
||||
ST_TIMEVAL_RESOLUTION,
|
||||
"Have all graphs exclude data prior to this second.\n")
|
||||
|
||||
ST_ALL_OPTION_UINT32(GraphTimevalMax,
|
||||
ST_TIMEVAL_MAX / ST_TIMEVAL_RESOLUTION,
|
||||
ST_TIMEVAL_RESOLUTION,
|
||||
"Have all graphs exclude data beyond this second.\n")
|
||||
|
||||
#endif /* ST_WANT_GRAPHS */
|
||||
|
||||
ST_CMD_OPTION_STRING(FileName,
|
||||
DataSetGenre,
|
||||
"-",
|
||||
"Specifies trace-malloc input file.\n"
|
||||
"\"-\" indicates stdin will be used as input.\n")
|
||||
|
||||
ST_CMD_OPTION_STRING(CategoryFile,
|
||||
CategoryGenre,
|
||||
"rules.txt",
|
||||
"Specifies the category rules file.\n"
|
||||
"This file contains rules about how to categorize allocations.\n")
|
||||
|
||||
|
||||
ST_CMD_OPTION_UINT32(HttpdPort,
|
||||
ServerGenre,
|
||||
1969,
|
||||
1,
|
||||
"Specifies the default port the web server will listen on.\n")
|
||||
|
||||
ST_CMD_OPTION_STRING(OutputDir,
|
||||
BatchModeGenre,
|
||||
".",
|
||||
"Specifies a directory to output batch mode requests.\n"
|
||||
"The directory must exist and must not use a trailing slash.\n")
|
||||
|
||||
ST_CMD_OPTION_STRING_PTR_ARRAY(BatchRequest,
|
||||
BatchModeGenre,
|
||||
"This implicitly turns on batch mode.\n"
|
||||
"Save each requested file into the output dir, then exit.\n")
|
||||
|
||||
ST_CMD_OPTION_UINT32(Contexts,
|
||||
ServerGenre,
|
||||
1,
|
||||
1,
|
||||
"How many configurations to cache at the cost of a lot of memory.\n"
|
||||
"Dedicated servers can cache more client configurations for performance.\n")
|
||||
|
||||
ST_CMD_OPTION_BOOL(Help,
|
||||
"Show command line help.\n")
|
||||
UIGenre,
|
||||
"Show command line help.\n"
|
||||
"See http://www.mozilla.org/projects/footprint/spaceTrace.html\n")
|
||||
|
||||
/*
|
||||
** END, THE OPTIONS
|
||||
|
|
Загрузка…
Ссылка в новой задаче