History

tcc -bench: show text/data/bss binary output sizes

grischka committed 6 years ago

Commit cdc3df91 parent ae1796f3 files · +9 −0Browse files

Unified · Split

3 files
  1. libtcc.c +2 −0
  2. tcc.h +1 −0
  3. tccelf.c +6 −0
libtcc.c+2−0
@@ -2115,6 +2115,8 @@ PUB_FUNC void tcc_print_stats(TCCState *s1, unsigned total_time) · 2114 unmodified lines
21152115 (double)total_time/1000,
21162116 (unsigned)total_lines*1000/total_time,
21172117 (double)total_bytes/1000/total_time);
2118+ fprintf(stderr, "* text %d, data %d, bss %d bytes\n",
2119+ s1->total_output[0], s1->total_output[1], s1->total_output[2]);
21182120 #ifdef MEM_DEBUG
21192121 fprintf(stderr, "* %d bytes memory used\n", mem_max_size);
21202122 #endif
tcc.h+1−0
@@ -918,6 +918,7 @@ struct TCCState { · 917 unmodified lines
918918 int total_idents;
919919 int total_lines;
920920 int total_bytes;
921+ int total_output[3];
921922
922923 /* option -dnum (for general development purposes) */
923924 int g_debug;
tccelf.c+6−0
@@ -202,6 +202,12 @@ ST_FUNC void tccelf_end_file(TCCState *s1) · 201 unmodified lines
202202 }
203203 }
204204 tcc_free(tr);
205+
206+ /* record text/data/bss output for -bench info */
207+ for (i = 0; i < 3; ++i) {
208+ s = s1->sections[i + 1];
209+ s1->total_output[i] += s->data_offset - s->sh_offset;
210+ }
205211 }
206212
207213 ST_FUNC Section *new_section(TCCState *s1, const char *name, int sh_type, int sh_flags)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t