]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - pr_exec.c
-LoadProgs now expects to be called after InitProg, so it wont do any
[xonotic/darkplaces.git] / pr_exec.c
index 5a5243e90dbb74039fe7578c9669ddeb3f90428a..2393ed1dd4d127d0939f31cee067f20e589cd555 100644 (file)
--- a/pr_exec.c
+++ b/pr_exec.c
@@ -215,6 +215,14 @@ void PR_Profile_f (void)
        mfunction_t *f, *best;
        int i, num, max/*, howmany*/;
 
+       if (!sv.active)
+       {
+               Con_Printf("no server running, can't profile\n");
+               return;
+       }
+
+       Con_Print( "Server Profile:\n[Profile] [BuiltinProfile] [CallCount]\n" );
+
        //howmany = 10;
        //if (Cmd_Argc() == 2)
        //      howmany = atoi(Cmd_Argv(1));
@@ -235,7 +243,7 @@ void PR_Profile_f (void)
                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;
@@ -248,7 +256,7 @@ void PR_PrintState(void)
        int i;
        if (pr_xfunction)
        {
-               for (i = -4;i <= 0;i++)
+               for (i = -7;i <= 0;i++)
                        if (pr_xstatement + i >= pr_xfunction->first_statement)
                                PR_PrintStatement (pr_statements + pr_xstatement + i);
        }
@@ -380,7 +388,7 @@ void PR_ExecuteProgram (func_t fnum, const char *errormessage)
        eval_t  *ptr;
        int             profile, startprofile, cachedpr_trace, exitdepth;
 
-       if (!fnum || fnum >= progs->numfunctions)
+       if (!fnum || fnum >= (unsigned) progs->numfunctions)
        {
                if (pr_global_struct->self)
                        ED_Print(PROG_TO_EDICT(pr_global_struct->self));