]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Made --drd-stats=yes output even more verbose.
authorBart Van Assche <bvanassche@acm.org>
Sun, 21 Jun 2009 11:51:23 +0000 (11:51 +0000)
committerBart Van Assche <bvanassche@acm.org>
Sun, 21 Jun 2009 11:51:23 +0000 (11:51 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10356

drd/drd_main.c
drd/drd_thread.c
drd/drd_thread.h

index 233c139541e4bc8c508680f8965ea1fd4721b409..7df13a4dedfa44bbd77389c4803d1aae3c1c9272 100644 (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"
index ef52f56378829f109db207de609ab8e3f93056ef..d61ae066865b457b94004274f848352d7e5244b8 100644 (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.
index 49347ce249c6c88ee0c59f06d45eec3a9c873e8f..affbba3ac99f1560f0be3161acfed66c243a8446 100644 (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);