This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Some (small) c++ compilation profiling data (oprofile)
On Fri, May 17, 2002 at 09:09:29PM +0100, Neil Booth wrote:
> Is it possible to break it down into per-line or per-block info?
I get similar results even with cc1 compiling gdb 5.2 with gcc 3.1
release
Again, not really scientific but :
(This is subject to frailties in bfd_find_nearest_line(),
and the inaccuracy of delayed profiling interrupt delivery ..)
/* time count, time %age, mem ref count, mem reg %age */
141 /* ht_lookup 149193 3.769% 27240 2.39% */
142 /* 6140 0.1551% 2092 0.1836% */
143 {
144 /* 2387 0.0603% 1013 0.0889% */
145 unsigned int hash = calc_hash (str, len);
146 unsigned int hash2;
147 unsigned int index;
148 size_t sizemask;
149 hashnode node;
150
151 /* 2242 0.05664% 769 0.06748% */
152 sizemask = table->nslots - 1;
153 /* 583 0.01473% 168 0.01474% */
154 index = hash & sizemask;
155
156 /* hash2 must be odd, so we're guaranteed to visit every possible
157 location in the table during rehashing. */
158 /* 3173 0.08016% 834 0.07319% */
159 hash2 = ((hash * 17) & sizemask) | 1;
160 /* 3075 0.07768% 742 0.06512% */
161 table->searches++;
162
163 /* 37996 0.9599% 9582 0.8409% */
164 for (;;)
165 {
166 /* 2734 0.06907% 597 0.05239% */
167 node = table->entries[index];
168
169 /* 35114 0.8871% 4398 0.386% */
170 if (node == NULL)
171 break;
172
173 /* 40593 1.026% 2864 0.2513% */
174 if (HT_LEN (node) == len && !memcmp (HT_STR (node), str, len))
175 {
176 /* 752 0.019% 238 0.02089% */
177 if (insert == HT_ALLOCED)
178 /* The string we search for was placed at the end of the
179 obstack. Release it. */
180 obstack_free (&table->stack, (PTR) str);
181 return node;
182 }
183
184 /* 1690 0.04269% 185 0.01623% */
185 index = (index + hash2) & sizemask;
186 /* 158 0.003992% 53 0.004651% */
187 table->collisions++;
188 }
189
190 /* 1337 0.03378% 81 0.007108% */
191 if (insert == HT_NO_INSERT)
192 return NULL;
193
194 /* 480 0.01213% 32 0.002808% */
195 node = (*table->alloc_node) (table);
196 /* 492 0.01243% 194 0.01702% */
197 table->entries[index] = node;
198
199 /* 416 0.01051% 191 0.01676% */
200 HT_LEN (node) = len;
201 /* 401 0.01013% 137 0.01202% */
202 if (insert == HT_ALLOC)
203 /* 5804 0.1466% 1527 0.134% */
204 HT_STR (node) = obstack_copy0 (&table->stack, str, len);
205 else
206 HT_STR (node) = str;
207
208 /* 1178 0.02976% 576 0.05055% */
209 if (++table->nelements * 4 >= table->nslots * 3)
210 /* Must expand the string table. */
211 ht_expand (table);
212
213 /* 569 0.01437% 225 0.01975% */
214 return node;
215 /* 1879 0.04747% 742 0.06512% */
216 }
Time spent flat profile
08077920 26096 0.66096 cpp_get_token <-------
081c14e0 26168 0.662783 for_each_rtx
080ddea0 26397 0.668583 mark_set_1
080df430 26792 0.678588 force_fit_type
080a5b90 27734 0.702447 build_abbrev_table
08074d80 29575 0.749076 _cpp_lex_token
081dc530 31426 0.795958 make_node
080b4a70 33041 0.836863 copy_rtx_if_shared
0819c8c0 35049 0.887721 constrain_operands
08053550 39056 0.989211 lookup_tag
0807e2c0 41751 1.05747 calc_hash
0827bb4c 43155 1.09303 htab_find_slot_with_hash
080f9600 55710 1.41102 ggc_mark_trees
08074480 59073 1.4962 parse_identifier
081ecc10 63328 1.60397 ggc_set_mark
081a0230 65396 1.65635 record_reg_classes
08074160 68204 1.72747 skip_block_comment
08054cd0 70567 1.78732 grokdeclarator
081a6840 76667 1.94182 find_reloads
08074e60 79376 2.01044 _cpp_lex_direct
081eca40 85556 2.16696 ggc_alloc
0807e3b0 148459 3.76017 ht_lookup <-----------
080495c0 216145 5.47452 yyparse_1
08057000 342612 8.67768 finish_struct
Memory reference profile
08074330 11393 1.00108 skip_whitespace
08077920 11847 1.04098 cpp_get_token
08054cd0 13246 1.1639 grokdeclarator
081c14e0 13660 1.20028 for_each_rtx
08057000 13929 1.22392 finish_struct
0807e2c0 15400 1.35317 calc_hash
080b4a70 15728 1.38199 copy_rtx_if_shared
08074d80 15870 1.39447 _cpp_lex_token
080ddea0 16961 1.49034 mark_set_1
0827bb4c 18860 1.6572 htab_find_slot_with_hash
081a6840 22227 1.95305 find_reloads
081ecc10 22354 1.96421 ggc_set_mark
08074480 22822 2.00533 parse_identifier
0807e3b0 27204 2.39037 ht_lookup
08074160 29261 2.57112 skip_block_comment
081eca40 35127 3.08655 ggc_alloc
081a0230 35556 3.12425 record_reg_classes
08074e60 42443 3.7294 _cpp_lex_direct
080495c0 73993 6.50164 yyparse_1
Time spent in glibc for cc1
0001be38 3489 1.02573 __errno_location
00030e88 7041 2.06998 __strtoul_internal
00030800 7588 2.23079 __strtol_internal
00075ff0 7664 2.25314 _IO_default_xsputn
00077464 11101 3.26358 _IO_str_init_static
0007f180 16413 4.82525 strlen
00080c64 17500 5.14482 memcpy
00079868 19319 5.67959 chunk_free
0007e1f8 21627 6.35811 strcmp
0007455c 21746 6.3931 fputs_unlocked
00078e60 40065 11.7787 chunk_alloc
00080858 146960 43.2047 memset
--
"It is very difficult to prophesy, especially when it pertains to the
future."
- Patrick Kurzawe