|
From: Christoph B. <bar...@or...> - 2006-10-24 13:57:50
|
Finally the result of opannotate on the most timeconsuming function:
:ExeContext* VG_(record_ExeContext) ( ThreadId tid )
7296101 23.2144 :{ /* vgPlain_record_ExeContext total: 28374282 90.2800 */
: Int i;
: Addr ips[VG_DEEPEST_BACKTRACE];
: Bool same;
: UWord hash;
: ExeContext* new_ec;
: ExeContext* list;
: UInt n_ips;
:
7 2.2e-05 : init_ExeContext_storage();
276 8.8e-04 : vg_assert(VG_(clo_backtrace_size) >= 1 &&
: VG_(clo_backtrace_size) <= VG_DEEPEST_BACKTRACE);
:
61 1.9e-04 : n_ips = VG_(get_StackTrace) (tid, ips
VG_(clo_backtrace_size) );
104 3.3e-04 : tl_assert(n_ips >= 1);
:
: /* Now figure out if we've seen this one before. First
hash it so
: as to determine the list number. */
:
: hash = 0;
333 0.0011 : for (i = 0; i < n_ips; i++) {
541 0.0017 : hash ^= ips[i];
225 7.2e-04 : hash = (hash << 29) | (hash >> 3);
: }
171 5.4e-04 : hash = hash % N_EC_LISTS;
:
: /* And (the expensive bit) look a matching entry in the
list. */
:
: ec_searchreqs++;
:
2 6.4e-06 : list = ec_list[hash];
:
: while (True) {
688333 2.1901 : if (list == NULL) break;
: ec_searchcmps++;
: same = True;
6002376 19.0981 : for (i = 0; i < n_ips; i++) {
11124624 35.3958 : if (list->ips[i] != ips[i]) {
: same = False;
: break;
: }
: }
: if (same) break;
3260252 10.3733 : list = list->next;
: }
:
15 4.8e-05 : if (list != NULL) {
: /* Yay! We found it. */
: return list;
: }
:
: /* Bummer. We have to allocate a new context record. */
: ec_totstored++;
:
: new_ec = VG_(arena_malloc)( VG_AR_EXECTXT,
: sizeof(struct _ExeContext)
: + n_ips * sizeof(Addr) );
:
: for (i = 0; i < n_ips; i++)
: new_ec->ips[i] = ips[i];
:
: new_ec->n_ips = n_ips;
: new_ec->next = ec_list[hash];
818 0.0026 : ec_list[hash] = new_ec;
:
: return new_ec;
43 1.4e-04 :}
|