socsvn commit: r237815 - soc2012/gmiller/locking-head/lib/libthr/thread

gmiller at FreeBSD.org gmiller at FreeBSD.org
Sat Jun 16 22:04:37 UTC 2012


Author: gmiller
Date: Sat Jun 16 22:04:34 2012
New Revision: 237815
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237815

Log:
  Implement pthread_resetstatistics_np().
  

Modified:
  soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c

Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c
==============================================================================
--- soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c	Sat Jun 16 21:39:00 2012	(r237814)
+++ soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c	Sat Jun 16 22:04:34 2012	(r237815)
@@ -307,6 +307,33 @@
 }
 
 void
+pthread_resetstatistics_np()
+{
+	struct pthread *curthread = _get_curthread();
+	u_int hash;
+	struct acquisition_point *acq_point;
+	struct acquisition *acq;
+
+	THR_CRITICAL_ENTER(curthread);
+
+	for (hash = 0; hash < LOCK_PROF_HASH_SIZE; hash++) {
+		while (!SLIST_EMPTY(&lock_hash[hash])) {
+			acq_point = SLIST_FIRST(&lock_hash[hash]);
+			SLIST_REMOVE_HEAD(&lock_hash[hash], acq_point_next);
+			free(acq_point);
+		}
+	}
+
+	while (!LIST_EMPTY(&acq_head)) {
+		acq = LIST_FIRST(&acq_head);
+		LIST_REMOVE(acq, acq_next);
+		free(acq);
+	}
+
+	THR_CRITICAL_LEAVE(curthread);
+}
+
+void
 pthread_lockprof_enable_np()
 {
 	lockprof_enabled = 1;


More information about the svn-soc-all mailing list