📄 proflfun.c
字号:
{
struct FunctionDefinition *theFunction;
int i;
for (theFunction = GetFunctionList(theEnv);
theFunction != NULL;
theFunction = theFunction->next)
{
OutputProfileInfo(theEnv,ValueToString(theFunction->callFunctionName),
(struct constructProfileInfo *)
TestUserData(ProfileFunctionData(theEnv)->ProfileDataID,
theFunction->usrData),
NULL,NULL,NULL,NULL);
}
for (i = 0; i < MAXIMUM_PRIMITIVES; i++)
{
if (EvaluationData(theEnv)->PrimitivesArray[i] != NULL)
{
OutputProfileInfo(theEnv,EvaluationData(theEnv)->PrimitivesArray[i]->name,
(struct constructProfileInfo *)
TestUserData(ProfileFunctionData(theEnv)->ProfileDataID,
EvaluationData(theEnv)->PrimitivesArray[i]->usrData),
NULL,NULL,NULL,NULL);
}
}
}
/*************************************************/
/* OutputConstructsCodeInfo: */
/*************************************************/
#if IBM_TBC && (! DEFFUNCTION_CONSTRUCT) && (! DEFGENERIC_CONSTRUCT) && (! OBJECT_SYSTEM) && (! DEFRULE_CONSTRUCT)
#pragma argsused
#endif
static void OutputConstructsCodeInfo(
void *theEnv)
{
#if (! DEFFUNCTION_CONSTRUCT) && (! DEFGENERIC_CONSTRUCT) && (! OBJECT_SYSTEM) && (! DEFRULE_CONSTRUCT)
#pragma unused(theEnv)
#endif
#if DEFFUNCTION_CONSTRUCT
DEFFUNCTION *theDeffunction;
#endif
#if DEFRULE_CONSTRUCT
struct defrule *theDefrule;
#endif
#if DEFGENERIC_CONSTRUCT
DEFGENERIC *theDefgeneric;
DEFMETHOD *theMethod;
unsigned methodIndex;
char methodBuffer[512];
#endif
#if OBJECT_SYSTEM
DEFCLASS *theDefclass;
HANDLER *theHandler;
unsigned handlerIndex;
#endif
#if DEFGENERIC_CONSTRUCT || OBJECT_SYSTEM
char *prefix, *prefixBefore, *prefixAfter;
#endif
char *banner;
banner = "\n*** Deffunctions ***\n\n";
#if DEFFUNCTION_CONSTRUCT
for (theDeffunction = (DEFFUNCTION *) EnvGetNextDeffunction(theEnv,NULL);
theDeffunction != NULL;
theDeffunction = (DEFFUNCTION *) EnvGetNextDeffunction(theEnv,theDeffunction))
{
OutputProfileInfo(theEnv,EnvGetDeffunctionName(theEnv,theDeffunction),
(struct constructProfileInfo *)
TestUserData(ProfileFunctionData(theEnv)->ProfileDataID,theDeffunction->header.usrData),
NULL,NULL,NULL,&banner);
}
#endif
banner = "\n*** Defgenerics ***\n";
#if DEFGENERIC_CONSTRUCT
for (theDefgeneric = (DEFGENERIC *) EnvGetNextDefgeneric(theEnv,NULL);
theDefgeneric != NULL;
theDefgeneric = (DEFGENERIC *) EnvGetNextDefgeneric(theEnv,theDefgeneric))
{
prefixBefore = "\n";
prefix = EnvGetDefgenericName(theEnv,theDefgeneric);
prefixAfter = "\n";
for (methodIndex = EnvGetNextDefmethod(theEnv,theDefgeneric,0);
methodIndex != 0;
methodIndex = EnvGetNextDefmethod(theEnv,theDefgeneric,methodIndex))
{
theMethod = GetDefmethodPointer(theDefgeneric,methodIndex);
EnvGetDefmethodDescription(theEnv,methodBuffer,510,theDefgeneric,methodIndex);
if (OutputProfileInfo(theEnv,methodBuffer,
(struct constructProfileInfo *)
TestUserData(ProfileFunctionData(theEnv)->ProfileDataID,theMethod->usrData),
prefixBefore,prefix,prefixAfter,&banner))
{
prefixBefore = NULL;
prefix = NULL;
prefixAfter = NULL;
}
}
}
#endif
banner = "\n*** Defclasses ***\n";
#if OBJECT_SYSTEM
for (theDefclass = (DEFCLASS *) EnvGetNextDefclass(theEnv,NULL);
theDefclass != NULL;
theDefclass = (DEFCLASS *) EnvGetNextDefclass(theEnv,theDefclass))
{
prefixAfter = "\n";
prefix = EnvGetDefclassName(theEnv,theDefclass);
prefixBefore = "\n";
for (handlerIndex = EnvGetNextDefmessageHandler(theEnv,theDefclass,0);
handlerIndex != 0;
handlerIndex = EnvGetNextDefmessageHandler(theEnv,theDefclass,handlerIndex))
{
theHandler = GetDefmessageHandlerPointer(theDefclass,handlerIndex);
if (OutputProfileInfo(theEnv,EnvGetDefmessageHandlerName(theEnv,theDefclass,handlerIndex),
(struct constructProfileInfo *)
TestUserData(ProfileFunctionData(theEnv)->ProfileDataID,
theHandler->usrData),
prefixBefore,prefix,prefixAfter,&banner))
{
prefixBefore = NULL;
prefix = NULL;
prefixAfter = NULL;
}
}
}
#endif
banner = "\n*** Defrules ***\n\n";
#if DEFRULE_CONSTRUCT
for (theDefrule = (struct defrule *) EnvGetNextDefrule(theEnv,NULL);
theDefrule != NULL;
theDefrule = (struct defrule *) EnvGetNextDefrule(theEnv,theDefrule))
{
OutputProfileInfo(theEnv,EnvGetDefruleName(theEnv,theDefrule),
(struct constructProfileInfo *)
TestUserData(ProfileFunctionData(theEnv)->ProfileDataID,theDefrule->header.usrData),
NULL,NULL,NULL,&banner);
}
#endif
}
/*********************************************************/
/* SetProfilePercentThresholdCommand: H/L access routine */
/* for the set-profile-percent-threshold command. */
/*********************************************************/
globle double SetProfilePercentThresholdCommand(
void *theEnv)
{
DATA_OBJECT theValue;
double newThreshold;
if (EnvArgCountCheck(theEnv,"set-profile-percent-threshold",EXACTLY,1) == -1)
{ return(ProfileFunctionData(theEnv)->PercentThreshold); }
if (EnvArgTypeCheck(theEnv,"set-profile-percent-threshold",1,INTEGER_OR_FLOAT,&theValue) == FALSE)
{ return(ProfileFunctionData(theEnv)->PercentThreshold); }
if (GetType(theValue) == INTEGER)
{ newThreshold = (double) DOToLong(theValue); }
else
{ newThreshold = (double) DOToDouble(theValue); }
if ((newThreshold < 0.0) || (newThreshold > 100.0))
{
ExpectedTypeError1(theEnv,"set-profile-percent-threshold",1,
"number in the range 0 to 100");
return(-1.0);
}
return(SetProfilePercentThreshold(theEnv,newThreshold));
}
/****************************************************/
/* SetProfilePercentThreshold: C access routine for */
/* the set-profile-percent-threshold command. */
/****************************************************/
globle double SetProfilePercentThreshold(
void *theEnv,
double value)
{
double oldPercentThreshhold;
if ((value < 0.0) || (value > 100.0))
{ return(-1.0); }
oldPercentThreshhold = ProfileFunctionData(theEnv)->PercentThreshold;
ProfileFunctionData(theEnv)->PercentThreshold = value;
return(oldPercentThreshhold);
}
/*********************************************************/
/* GetProfilePercentThresholdCommand: H/L access routine */
/* for the get-profile-percent-threshold command. */
/*********************************************************/
globle double GetProfilePercentThresholdCommand(
void *theEnv)
{
EnvArgCountCheck(theEnv,"get-profile-percent-threshold",EXACTLY,0);
return(ProfileFunctionData(theEnv)->PercentThreshold);
}
/****************************************************/
/* GetProfilePercentThreshold: C access routine for */
/* the get-profile-percent-threshold command. */
/****************************************************/
globle double GetProfilePercentThreshold(
void *theEnv)
{
return(ProfileFunctionData(theEnv)->PercentThreshold);
}
/**********************************************************/
/* SetProfileOutputString: Sets the output string global. */
/**********************************************************/
globle char *SetProfileOutputString(
void *theEnv,
char *value)
{
char *oldOutputString;
if (value == NULL)
{ return(ProfileFunctionData(theEnv)->OutputString); }
oldOutputString = ProfileFunctionData(theEnv)->OutputString;
ProfileFunctionData(theEnv)->OutputString = value;
return(oldOutputString);
}
#if (! RUN_TIME)
/******************************************************************/
/* ProfileClearFunction: Profiling clear routine for use with the */
/* clear command. Removes user data attached to user functions. */
/******************************************************************/
static void ProfileClearFunction(
void *theEnv)
{
struct FunctionDefinition *theFunction;
int i;
for (theFunction = GetFunctionList(theEnv);
theFunction != NULL;
theFunction = theFunction->next)
{
theFunction->usrData =
DeleteUserData(theEnv,ProfileFunctionData(theEnv)->ProfileDataID,theFunction->usrData);
}
for (i = 0; i < MAXIMUM_PRIMITIVES; i++)
{
if (EvaluationData(theEnv)->PrimitivesArray[i] != NULL)
{
EvaluationData(theEnv)->PrimitivesArray[i]->usrData =
DeleteUserData(theEnv,ProfileFunctionData(theEnv)->ProfileDataID,EvaluationData(theEnv)->PrimitivesArray[i]->usrData);
}
}
}
#endif
#endif /* PROFILING_FUNCTIONS */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -