-Both vms now record how often a function has been called and the profile cmd
now outputs the callcount with the other information.
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5319
d7cf8633-e32d-0410-b094-
e92efae38249
int profile; // runtime
int builtinsprofile; // cost of builtin functions called by this function
+ int callcount; // times the functions has been called since the last profile call
int s_name;
int s_file; // source file defined in
return;
}
+ Con_Print( "Server Profile:\n[Profile] [BuiltinProfile] [CallCount]\n" );
+
//howmany = 10;
//if (Cmd_Argc() == 2)
// howmany = atoi(Cmd_Argv(1));
if (best)
{
//if (num < howmany)
- Con_Printf("%7i %7i %s\n", best->profile, best->builtinsprofile, PR_GetString(best->s_name));
+ Con_Printf("%7i %7i %7i %s\n", best->profile, best->builtinsprofile, best->callcount, PR_GetString(best->s_name));
num++;
best->profile = 0;
best->builtinsprofile = 0;
Host_Error("Bad function number");
newf = &pr_functions[OPA->function];
+ newf->callcount++;
if (newf->first_statement < 0)
{
Con_Print("prvm_profile <program name>\n");
return;
}
-
+
PRVM_Begin;
if(!PRVM_SetProgFromString(Cmd_Argv(1)))
return;
+ Con_Printf( "%s Profile:\n[Profile] [BuiltinProfile] [CallCount]\n", PRVM_NAME );
+
num = 0;
do
{
if (best)
{
//if (num < howmany)
- Con_Printf("%s: %7i %7i %s\n", PRVM_NAME, best->profile, best->builtinsprofile, PRVM_GetString(best->s_name));
+ Con_Printf("%7i %7i %7i %s\n", best->profile, best->builtinsprofile, best->callcount, PRVM_GetString(best->s_name));
num++;
best->profile = 0;
best->builtinsprofile = 0;
PRVM_ERROR("NULL function in %s", PRVM_NAME);
newf = &prog->functions[OPA->function];
+ newf->callcount++;
if (newf->first_statement < 0)
{