// 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"
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;
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)));
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;
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);
- }
}
/**
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
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.