tcc -bench: show text/data/bss binary output sizes
This commit is contained in:
parent
ae1796fc34
commit
cdc3df949b
3 changed files with 9 additions and 0 deletions
2
libtcc.c
2
libtcc.c
|
|
@ -2115,6 +2115,8 @@ PUB_FUNC void tcc_print_stats(TCCState *s1, unsigned total_time)
|
||||||
(double)total_time/1000,
|
(double)total_time/1000,
|
||||||
(unsigned)total_lines*1000/total_time,
|
(unsigned)total_lines*1000/total_time,
|
||||||
(double)total_bytes/1000/total_time);
|
(double)total_bytes/1000/total_time);
|
||||||
|
fprintf(stderr, "* text %d, data %d, bss %d bytes\n",
|
||||||
|
s1->total_output[0], s1->total_output[1], s1->total_output[2]);
|
||||||
#ifdef MEM_DEBUG
|
#ifdef MEM_DEBUG
|
||||||
fprintf(stderr, "* %d bytes memory used\n", mem_max_size);
|
fprintf(stderr, "* %d bytes memory used\n", mem_max_size);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
1
tcc.h
1
tcc.h
|
|
@ -918,6 +918,7 @@ struct TCCState {
|
||||||
int total_idents;
|
int total_idents;
|
||||||
int total_lines;
|
int total_lines;
|
||||||
int total_bytes;
|
int total_bytes;
|
||||||
|
int total_output[3];
|
||||||
|
|
||||||
/* option -dnum (for general development purposes) */
|
/* option -dnum (for general development purposes) */
|
||||||
int g_debug;
|
int g_debug;
|
||||||
|
|
|
||||||
6
tccelf.c
6
tccelf.c
|
|
@ -202,6 +202,12 @@ ST_FUNC void tccelf_end_file(TCCState *s1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tcc_free(tr);
|
tcc_free(tr);
|
||||||
|
|
||||||
|
/* record text/data/bss output for -bench info */
|
||||||
|
for (i = 0; i < 3; ++i) {
|
||||||
|
s = s1->sections[i + 1];
|
||||||
|
s1->total_output[i] += s->data_offset - s->sh_offset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ST_FUNC Section *new_section(TCCState *s1, const char *name, int sh_type, int sh_flags)
|
ST_FUNC Section *new_section(TCCState *s1, const char *name, int sh_type, int sh_flags)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue