diff options
author | bart <bart@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2009-06-21 11:51:23 +0000 |
---|---|---|
committer | bart <bart@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2009-06-21 11:51:23 +0000 |
commit | e5214666ead5aebb79ad662deacff0a952cba70d (patch) | |
tree | c61627fe4789fa4ef50724ad34a603e457fd65cf | |
parent | 6584b69b02252e0a5792f7e2a6894c51adce075c (diff) | |
download | valgrind-e5214666ead5aebb79ad662deacff0a952cba70d.tar.gz |
Made --drd-stats=yes output even more verbose.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10356 a5019735-40e9-0310-863c-91ae7b9d1cf9
-rw-r--r-- | drd/drd_main.c | 31 | ||||
-rw-r--r-- | drd/drd_thread.c | 65 | ||||
-rw-r--r-- | drd/drd_thread.h | 3 |
3 files changed, 84 insertions, 15 deletions
diff --git a/drd/drd_main.c b/drd/drd_main.c index 233c13954..7df13a4de 100644 --- a/drd/drd_main.c +++ b/drd/drd_main.c @@ -575,21 +575,38 @@ static void DRD_(fini)(Int exitcode) // thread_print_all(); if (VG_(clo_verbosity) > 1 || DRD_(s_print_stats)) { + ULong pu = DRD_(thread_get_update_conflict_set_count)(); + ULong pu_seg_cr = DRD_(thread_get_update_conflict_set_new_sg_count)(); + ULong pu_mtx_cv = DRD_(thread_get_update_conflict_set_sync_count)(); + ULong pu_join = DRD_(thread_get_update_conflict_set_join_count)(); + VG_(message)(Vg_UserMsg, - " thread: %lld context switches", + " thread: %lld context switches.", DRD_(thread_get_context_switch_count)()); VG_(message)(Vg_UserMsg, - "confl set: %lld full updates and %lld partial updates.", + "confl set: %lld full updates and %lld partial updates;", DRD_(thread_get_compute_conflict_set_count)(), - DRD_(thread_get_update_conflict_set_count)()); + pu); VG_(message)(Vg_UserMsg, - " segments: created %lld segments, max %lld alive," - " %lld discard points", - DRD_(sg_get_segments_created_count)(), + " %lld partial updates during segment creation,", + pu_seg_cr); + VG_(message)(Vg_UserMsg, + " %lld because of mutex/sema/cond.var. operations,", + pu_mtx_cv); + VG_(message)(Vg_UserMsg, + " %lld because of barrier/rwlock operations and", + pu - pu_seg_cr - pu_mtx_cv - pu_join); + VG_(message)(Vg_UserMsg, + " %lld partial updates because of thread join" + " operations.", + pu_join); + VG_(message)(Vg_UserMsg, + " segments: created %lld segments, max %lld alive,", DRD_(sg_get_max_segments_alive_count)(), DRD_(thread_get_discard_ordered_segments_count)()); VG_(message)(Vg_UserMsg, - " and %lld merges.", + " %lld discard points and %lld merges.", + DRD_(sg_get_segments_created_count)(), DRD_(sg_get_segment_merge_count)()); VG_(message)(Vg_UserMsg, "segmnt cr: %lld mutex, %lld rwlock, %lld semaphore and" diff --git a/drd/drd_thread.c b/drd/drd_thread.c index ef52f5637..d61ae0668 100644 --- a/drd/drd_thread.c +++ b/drd/drd_thread.c @@ -61,6 +61,9 @@ static ULong s_context_switch_count; static ULong s_discard_ordered_segments_count; static ULong s_compute_conflict_set_count; static ULong s_update_conflict_set_count; +static ULong s_update_conflict_set_new_sg_count; +static ULong s_update_conflict_set_sync_count; +static ULong s_update_conflict_set_join_count; static ULong s_conflict_set_bitmap_creation_count; static ULong s_conflict_set_bitmap2_creation_count; static ThreadId s_vg_running_tid = VG_INVALID_THREADID; @@ -939,7 +942,10 @@ void DRD_(thread_new_segment)(const DrdThreadId tid) new_sg = DRD_(sg_new)(tid, tid); thread_append_segment(tid, new_sg); if (tid == DRD_(g_drd_running_tid) && last_sg) + { DRD_(thread_update_conflict_set)(tid, &last_sg->vc); + s_update_conflict_set_new_sg_count++; + } tl_assert(thread_conflict_set_up_to_date(DRD_(g_drd_running_tid))); @@ -972,8 +978,25 @@ void DRD_(thread_combine_vc_join)(DrdThreadId joiner, DrdThreadId joinee) VG_(free)(str1); VG_(free)(str2); } - DRD_(vc_combine)(&DRD_(g_threadinfo)[joiner].last->vc, - &DRD_(g_threadinfo)[joinee].last->vc); + if (joiner == DRD_(g_drd_running_tid)) + { + VectorClock old_vc; + + DRD_(vc_copy)(&old_vc, &DRD_(g_threadinfo)[joiner].last->vc); + DRD_(vc_combine)(&DRD_(g_threadinfo)[joiner].last->vc, + &DRD_(g_threadinfo)[joinee].last->vc); + DRD_(thread_update_conflict_set)(joiner, &old_vc); + s_update_conflict_set_join_count++; + DRD_(vc_cleanup)(&old_vc); + } + else + { + DRD_(vc_combine)(&DRD_(g_threadinfo)[joiner].last->vc, + &DRD_(g_threadinfo)[joinee].last->vc); + } + + thread_discard_ordered_segments(); + if (DRD_(sg_get_trace)()) { char* str; @@ -981,12 +1004,6 @@ void DRD_(thread_combine_vc_join)(DrdThreadId joiner, DrdThreadId joinee) VG_(message)(Vg_DebugMsg, "After join: %s", str); VG_(free)(str); } - thread_discard_ordered_segments(); - - if (joiner == DRD_(g_drd_running_tid)) - { - thread_compute_conflict_set(&DRD_(g_conflict_set), joiner); - } } /** @@ -1020,8 +1037,12 @@ void DRD_(thread_combine_vc_sync)(DrdThreadId tid, const Segment* sg) VG_(free)(str1); VG_(free)(str2); } + thread_discard_ordered_segments(); + DRD_(thread_update_conflict_set)(tid, &old_vc); + s_update_conflict_set_sync_count++; + DRD_(vc_cleanup)(&old_vc); } else @@ -1488,6 +1509,34 @@ ULong DRD_(thread_get_update_conflict_set_count)(void) } /** + * Return how many times the conflict set has been updated partially + * because a new segment has been created. + */ +ULong DRD_(thread_get_update_conflict_set_new_sg_count)(void) +{ + return s_update_conflict_set_new_sg_count; +} + +/** + * Return how many times the conflict set has been updated partially + * because of combining vector clocks due to synchronization operations + * other than reader/writer lock or barrier operations. + */ +ULong DRD_(thread_get_update_conflict_set_sync_count)(void) +{ + return s_update_conflict_set_sync_count; +} + +/** + * Return how many times the conflict set has been updated partially + * because of thread joins. + */ +ULong DRD_(thread_get_update_conflict_set_join_count)(void) +{ + return s_update_conflict_set_join_count; +} + +/** * Return the number of first-level bitmaps that have been created during * conflict set updates. */ diff --git a/drd/drd_thread.h b/drd/drd_thread.h index 49347ce24..affbba3ac 100644 --- a/drd/drd_thread.h +++ b/drd/drd_thread.h @@ -177,6 +177,9 @@ ULong DRD_(thread_get_report_races_count)(void); ULong DRD_(thread_get_discard_ordered_segments_count)(void); ULong DRD_(thread_get_compute_conflict_set_count)(void); ULong DRD_(thread_get_update_conflict_set_count)(void); +ULong DRD_(thread_get_update_conflict_set_new_sg_count)(void); +ULong DRD_(thread_get_update_conflict_set_sync_count)(void); +ULong DRD_(thread_get_update_conflict_set_join_count)(void); ULong DRD_(thread_get_conflict_set_bitmap_creation_count)(void); ULong DRD_(thread_get_conflict_set_bitmap2_creation_count)(void); |