Resurrect the stats output.

This commit is contained in:
Bill Currie 2011-03-09 15:51:17 +09:00
parent 8368f57fbf
commit cbbbf87e20
2 changed files with 27 additions and 20 deletions

View file

@ -44,6 +44,7 @@ static __attribute__ ((used)) const char rcsid[] = "$Id$";
#include "QF/dstring.h"
#include "QF/qendian.h"
#include "QF/quakeio.h"
#include "QF/va.h"
#include "codespace.h"
#include "debug.h"
@ -776,6 +777,7 @@ qfo_to_progs (qfo_t *qfo, int *size)
int locals_size = 0;
int locals_start;
int big_locals = 0;
int big_func = 0;
*size = RUP (sizeof (dprograms_t), 16);
progs = calloc (1, *size);
@ -914,10 +916,35 @@ qfo_to_progs (qfo_t *qfo, int *size)
qfo_func_t *qf = qfo->funcs + i;
qfo_mspace_t *space = qfo->spaces + qf->locals_space;
if (qf->locals_space == big_locals)
big_func = i;
for (j = 0; j < space->num_defs; j++)
space->defs[j].offset -= df->parm_start;
}
if (options.verbosity >= 0) {
const char *big_function = "";
if (big_func)
big_function = va (" (%s)", strings + qfo->funcs[big_func].name);
printf ("%6i strofs\n", progs->numstrings);
printf ("%6i statements\n", progs->numstatements);
printf ("%6i functions\n", progs->numfunctions);
printf ("%6i global defs\n", progs->numglobaldefs);
printf ("%6i fielddefs\n", progs->numfielddefs);
printf ("%6i globals\n", progs->numglobals);
printf (" %6i near globals\n",
qfo->spaces[qfo_near_data_space].data_size + locals_size);
printf (" %6i locals size%s\n", locals_size, big_function);
printf (" %6i far globals\n",
qfo->spaces[qfo_far_data_space].data_size);
printf (" %6i type globals\n",
qfo->spaces[qfo_type_space].data_size);
printf ("%6i entity fields\n", progs->entityfields);
}
if (options.verbosity >= -1)
printf ("%6i TOTAL SIZE\n", *size);
return progs;
}

View file

@ -202,30 +202,10 @@ WriteProgs (dprograms_t *progs, int size)
for (i = 0; i < progs->numglobals; i++)
globals[i].integer_var = LittleLong (globals[i].integer_var);
#if 0 //FIXME
if (options.verbosity >= 0) {
if (!big_function)
big_function = "";
printf ("%6i strofs\n", pr.strings->size);
printf ("%6i statements\n", pr.code->size);
printf ("%6i functions\n", pr.num_functions);
printf ("%6i global defs\n", numglobaldefs);
printf ("%6i fielddefs\n", numfielddefs);
printf ("%6i globals\n", pr.data->size);
printf (" %6i near globals\n", pr.near_data->size);
printf (" %6i locals size (%s)\n", num_localdefs, big_function);
printf (" %6i far globals\n", pr.far_data->size);
printf ("%6i entity fields\n", pr.entity_data->size);
}
#endif
if (!(h = Qopen (options.output_file, "wb")))
Sys_Error ("%s: %s\n", options.output_file, strerror(errno));
Qwrite (h, progs, size);
// if (options.verbosity >= -1)
// printf ("%6i TOTAL SIZE\n", (int) Qtell (h));
Qclose (h);
return 0;