socsvn commit: r237736 - in soc2012/gmiller/locking-head: include
lib/libthr/thread
gmiller at FreeBSD.org
gmiller at FreeBSD.org
Fri Jun 15 01:59:06 UTC 2012
Author: gmiller
Date: Fri Jun 15 01:59:03 2012
New Revision: 237736
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237736
Log:
Add pthread_lockprof_enable_mp() and pthread_lockprof_disable_mp() to turn
lock profiling on and off dynamically. Profiling is still enabled by default.
Modified:
soc2012/gmiller/locking-head/include/pthread_np.h
soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c
Modified: soc2012/gmiller/locking-head/include/pthread_np.h
==============================================================================
--- soc2012/gmiller/locking-head/include/pthread_np.h Thu Jun 14 22:19:23 2012 (r237735)
+++ soc2012/gmiller/locking-head/include/pthread_np.h Fri Jun 15 01:59:03 2012 (r237736)
@@ -90,6 +90,9 @@
void pthread_getstatistics_begin_np(struct pthread_statistics_np *);
int pthread_getstatistics_next_np(struct pthread_statistics_np *);
void pthread_getstatistics_end_np(struct pthread_statistics_np *);
+void pthread_resetstatistics_np(void);
+void pthread_lockprof_enable_np(void);
+void pthread_lockprof_disable_np(void);
#endif
Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c
==============================================================================
--- soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c Thu Jun 14 22:19:23 2012 (r237735)
+++ soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c Fri Jun 15 01:59:03 2012 (r237736)
@@ -62,7 +62,8 @@
struct timespec wait_time;
};
-LIST_HEAD(acq_head, acquisition) acq_head = LIST_HEAD_INITIALIZER(acq_head);
+static LIST_HEAD(acq_head, acquisition) acq_head =
+ LIST_HEAD_INITIALIZER(acq_head);
struct acq_point_head mutex_hash[LOCK_PROF_HASH_SIZE];
@@ -71,6 +72,8 @@
struct acquisition_point *last_record;
};
+static int lockprof_enabled;
+
void
_lock_profile_init()
{
@@ -79,6 +82,8 @@
for (i = 0; i < LOCK_PROF_HASH_SIZE; i++) {
SLIST_INIT(&mutex_hash[i]);
}
+
+ lockprof_enabled = 1;
}
static struct acquisition *
@@ -132,7 +137,7 @@
struct pthread *curthread = _get_curthread();
struct acquisition *acq;
- if (file == NULL) {
+ if (file == NULL || !lockprof_enabled) {
return;
}
@@ -163,7 +168,7 @@
_mutex_obtain_failed(struct pthread_mutex *m, struct timespec *wait_time,
const char *file)
{
- if (file == NULL) {
+ if (file == NULL || !lockprof_enabled) {
return;
}
@@ -360,4 +365,16 @@
}
}
+void
+pthread_lockprof_enable_np()
+{
+ lockprof_enabled = 1;
+}
+
+void
+pthread_lockprof_disable_np()
+{
+ lockprof_enabled = 0;
+}
+
#endif /* LOCK_PROFILING */
More information about the svn-soc-all
mailing list