mirror of
https://github.com/mirror/tinycc.git
synced 2025-01-29 06:10:09 +08:00
tcc -bench: show text/data/bss binary output sizes
This commit is contained in:
parent
ae1796fc34
commit
cdc3df949b
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,
|
||||
(unsigned)total_lines*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
|
||||
fprintf(stderr, "* %d bytes memory used\n", mem_max_size);
|
||||
#endif
|
||||
|
1
tcc.h
1
tcc.h
@ -918,6 +918,7 @@ struct TCCState {
|
||||
int total_idents;
|
||||
int total_lines;
|
||||
int total_bytes;
|
||||
int total_output[3];
|
||||
|
||||
/* option -dnum (for general development purposes) */
|
||||
int g_debug;
|
||||
|
6
tccelf.c
6
tccelf.c
@ -202,6 +202,12 @@ ST_FUNC void tccelf_end_file(TCCState *s1)
|
||||
}
|
||||
}
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user