Print correct values in tcc_print_stats (yarpgen v1)

Value 0 and values >2GB where printed wrong during tests with yarpgen (v1)
Starting the output with a hashtag make it compatible to TAP

--
Regards ... Detlef
This commit is contained in:
Detlef Riekenberg 2023-03-23 20:02:19 +01:00
parent afa05caacf
commit e7262accb6
2 changed files with 6 additions and 8 deletions

View file

@ -2161,23 +2161,21 @@ LIBTCCAPI void tcc_set_options(TCCState *s, const char *r)
PUB_FUNC void tcc_print_stats(TCCState *s1, unsigned total_time)
{
if (total_time < 1)
if (!total_time)
total_time = 1;
if (total_bytes < 1)
total_bytes = 1;
fprintf(stderr, "* %d idents, %d lines, %d bytes\n"
"* %0.3f s, %u lines/s, %0.1f MB/s\n",
fprintf(stderr, "# %d idents, %d lines, %u bytes\n"
"# %0.3f s, %u lines/s, %0.1f MB/s\n",
total_idents, total_lines, total_bytes,
(double)total_time/1000,
(unsigned)total_lines*1000/total_time,
(double)total_bytes/1000/total_time);
fprintf(stderr, "* text %u, data.rw %u, data.ro %u, bss %u bytes\n",
fprintf(stderr, "# text %u, data.rw %u, data.ro %u, bss %u bytes\n",
s1->total_output[0],
s1->total_output[1],
s1->total_output[2],
s1->total_output[3]
);
#ifdef MEM_DEBUG
fprintf(stderr, "* %d bytes memory used\n", mem_max_size);
fprintf(stderr, "# %d bytes memory used\n", mem_max_size);
#endif
}

2
tcc.h
View file

@ -1001,7 +1001,7 @@ struct TCCState {
/* benchmark info */
int total_idents;
int total_lines;
int total_bytes;
unsigned int total_bytes;
unsigned int total_output[4];
/* option -dnum (for general development purposes) */