Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Jun 2012 22:04:35 +0000
From:      gmiller@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r237815 - soc2012/gmiller/locking-head/lib/libthr/thread
Message-ID:  <20120616220435.305A4106564A@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120616220435.305A4106564A>