Made --drd-stats=yes output even more verbose.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10356
This commit is contained in:
Bart Van Assche 2009-06-21 11:51:23 +00:00
parent 7c518a0c3f
commit 2a99145bc2
3 changed files with 84 additions and 15 deletions

View File

@ -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"

View File

@ -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
@ -1487,6 +1508,34 @@ ULong DRD_(thread_get_update_conflict_set_count)(void)
return s_update_conflict_set_count;
}
/**
* 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.

View File

@ -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);