]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Added more detailed statistics about thread_new_segment() calls.
authorBart Van Assche <bvanassche@acm.org>
Sat, 19 Apr 2008 15:16:45 +0000 (15:16 +0000)
committerBart Van Assche <bvanassche@acm.org>
Sat, 19 Apr 2008 15:16:45 +0000 (15:16 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7891

exp-drd/drd_barrier.c
exp-drd/drd_barrier.h
exp-drd/drd_main.c
exp-drd/drd_mutex.c
exp-drd/drd_mutex.h
exp-drd/drd_rwlock.c
exp-drd/drd_rwlock.h
exp-drd/drd_semaphore.c
exp-drd/drd_semaphore.h

index c1273cf3f5a6127e071edd1db57393272b377cb4..96e2b74cf5db2f3018fea647685ba829b4654b7b 100644 (file)
@@ -60,6 +60,7 @@ static const char* barrier_type_name(const BarrierT bt);
 // Local variables.
 
 static Bool s_trace_barrier = False;
+static ULong s_barrier_segment_creation_count;
 
 
 // Function definitions.
@@ -343,6 +344,7 @@ void barrier_post_wait(const DrdThreadId tid, const Addr barrier,
     }
 
     thread_new_segment(tid);
+    s_barrier_segment_creation_count++;
 
     if (--p->post_waiters_left <= 0)
     {
@@ -386,3 +388,8 @@ static const char* barrier_type_name(const BarrierT bt)
   }
   return "?";
 }
+
+ULong get_barrier_segment_creation_count(void)
+{
+  return s_barrier_segment_creation_count;
+}
index 54deb4929a8a531ae6b1bd2ef39aec3d3aeb02a4..f525f155561156e00e0a4fa4b349d4c6f391a402 100644 (file)
@@ -50,6 +50,7 @@ void barrier_post_wait(const DrdThreadId tid, const Addr barrier,
                        const BarrierT barrier_type, const Bool waited);
 void barrier_thread_delete(const DrdThreadId threadid);
 void barrier_stop_using_mem(const Addr a1, const Addr a2);
+ULong get_barrier_segment_creation_count(void);
 
 
 #endif /* __DRD_BARRIER_H */
index d501cb8d07cbffcc15471e9a9d60c7fea0cd4984..3b9563af59d78e1e51663df11aa8e84a51ce71c0 100644 (file)
@@ -50,7 +50,6 @@
 #include "pub_tool_mallocfree.h"  // VG_(malloc)(), VG_(free)()
 #include "pub_tool_options.h"     // command line options
 #include "pub_tool_replacemalloc.h"
-#include "pub_tool_replacemalloc.h"
 #include "pub_tool_threadstate.h" // VG_(get_running_tid)()
 #include "pub_tool_tooliface.h"
 
@@ -1078,6 +1077,12 @@ void drd_fini(Int exitcode)
                  sg_get_created_segments_count(),
                  sg_get_max_alive_segments_count(),
                  thread_get_discard_ordered_segments_count());
+    VG_(message)(Vg_UserMsg,
+                 "           (%lld m, %lld rw, %lld s, %lld b)",
+                 get_mutex_segment_creation_count(),
+                 get_rwlock_segment_creation_count(),
+                 get_semaphore_segment_creation_count(),
+                 get_barrier_segment_creation_count());
     VG_(message)(Vg_UserMsg,
                  "  bitmaps: %lld level 1 / %lld level 2 bitmap refs",
                  bm_get_bitmap_creation_count(),
index c28487d4abb4303deb11c6c3400c13778e8ee618..dca84a74fee5e9a0841ac6c7d0a8f3dd3b128a20 100644 (file)
@@ -45,6 +45,7 @@ static Bool mutex_is_locked(struct mutex_info* const p);
 
 static Bool s_trace_mutex;
 static ULong s_mutex_lock_count;
+static ULong s_mutex_segment_creation_count;
 
 
 // Function definitions.
@@ -284,6 +285,7 @@ void mutex_post_lock(const Addr mutex, const Bool took_lock,
       thread_combine_vc2(drd_tid, &p->last_locked_segment->vc);
     }
     thread_new_segment(drd_tid);
+    s_mutex_segment_creation_count++;
 
     p->owner = drd_tid;
     s_mutex_lock_count++;
@@ -374,6 +376,7 @@ void mutex_unlock(const Addr mutex, const MutexT mutex_type)
 
     thread_get_latest_segment(&p->last_locked_segment, drd_tid);
     thread_new_segment(drd_tid);
+    s_mutex_segment_creation_count++;
   }
 }
 
@@ -457,3 +460,8 @@ ULong get_mutex_lock_count(void)
 {
   return s_mutex_lock_count;
 }
+
+ULong get_mutex_segment_creation_count(void)
+{
+  return s_mutex_segment_creation_count;
+}
index 52880ffb649b0bc9e6b369d272b554afc3c8047c..77f24e941507ce835b76817b460f81f34804a442 100644 (file)
@@ -55,6 +55,7 @@ Bool mutex_is_locked_by(const Addr mutex, const DrdThreadId tid);
 int mutex_get_recursion_count(const Addr mutex);
 void mutex_thread_delete(const DrdThreadId tid);
 ULong get_mutex_lock_count(void);
+ULong get_mutex_segment_creation_count(void);
 
 
 #endif /* __DRD_MUTEX_H */
index 7e23173153d9cc861d1311c667b34319c4d30470..dd1d0c6673082a882a8043d6c7af4d2d0b3b0159 100644 (file)
@@ -50,6 +50,7 @@ struct rwlock_thread_info
 // Local functions.
 
 static void rwlock_cleanup(struct rwlock_info* p);
+static ULong s_rwlock_segment_creation_count;
 
 
 // Local variables.
@@ -350,6 +351,7 @@ void rwlock_post_rdlock(const Addr rwlock, const Bool took_lock)
   {
     rwlock_combine_other_vc(p, drd_tid, False);
     thread_new_segment(drd_tid);
+    s_rwlock_segment_creation_count++;
   }
 }
 
@@ -423,6 +425,7 @@ void rwlock_post_wrlock(const Addr rwlock, const Bool took_lock)
   tl_assert(q->writer_nesting_count == 1);
   rwlock_combine_other_vc(p, drd_tid, True);
   thread_new_segment(drd_tid);
+  s_rwlock_segment_creation_count++;
 }
 
 /**
@@ -479,6 +482,7 @@ void rwlock_pre_unlock(const Addr rwlock)
     thread_get_latest_segment(&q->last_unlock_segment, drd_tid);
     q->last_lock_was_writer_lock = False;
     thread_new_segment(drd_tid);
+    s_rwlock_segment_creation_count++;
   }
 }
 
@@ -508,3 +512,8 @@ void rwlock_thread_delete(const DrdThreadId tid)
     }
   }
 }
+
+ULong get_rwlock_segment_creation_count(void)
+{
+  return s_rwlock_segment_creation_count;
+}
index 6abc203b676bd9c45efaaf5eb086b9a0702c9a80..77e3abfe67e9004946b33581f51b52478e522ae6 100644 (file)
@@ -48,6 +48,7 @@ void rwlock_pre_wrlock(const Addr rwlock);
 void rwlock_post_wrlock(const Addr rwlock, const Bool took_lock);
 void rwlock_pre_unlock(const Addr rwlock);
 void rwlock_thread_delete(const DrdThreadId tid);
+ULong get_rwlock_segment_creation_count(void);
 
 
 #endif /* __DRD_RWLOCK_H */
index dc5c9f5f812cb968d0181838ea86893d583e2597..38d3b9a1b4c238f7f4d4a362c973631f20112360 100644 (file)
@@ -43,6 +43,7 @@ static void semaphore_cleanup(struct semaphore_info* p);
 // Local variables.
 
 static Bool s_trace_semaphore;
+static ULong s_semaphore_segment_creation_count;
 
 
 // Function definitions.
@@ -222,6 +223,7 @@ void semaphore_post_wait(const DrdThreadId tid, const Addr semaphore,
     thread_combine_vc2(tid, &p->last_sem_post_segment->vc);
   }
   thread_new_segment(tid);
+  s_semaphore_segment_creation_count++;
 }
 
 /** Called before sem_post(). */
@@ -244,6 +246,7 @@ void semaphore_pre_post(const DrdThreadId tid, const Addr semaphore)
     p->last_sem_post_tid = tid;
     thread_new_segment(tid);
     thread_get_latest_segment(&p->last_sem_post_segment, tid);
+    s_semaphore_segment_creation_count++;
   }
 }
 
@@ -264,3 +267,8 @@ void semaphore_post_post(const DrdThreadId tid, const Addr semaphore,
 
 void semaphore_thread_delete(const DrdThreadId threadid)
 { }
+
+ULong get_semaphore_segment_creation_count(void)
+{
+  return s_semaphore_segment_creation_count;
+}
index c55dc9df682e3286dddd2f5111334fb3fabfc0e4..2b5107fa6775a513dd796a7012d9d0dc4aab467d 100644 (file)
@@ -49,6 +49,7 @@ void semaphore_pre_post(const DrdThreadId tid, const Addr semaphore);
 void semaphore_post_post(const DrdThreadId tid, const Addr semaphore,
                          const Bool waited);
 void semaphore_thread_delete(const DrdThreadId tid);
+ULong get_semaphore_segment_creation_count(void);
 
 
 #endif /* __DRD_SEMAPHORE_H */