From owner-svn-soc-all@FreeBSD.ORG Sat Jun 16 22:04:37 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 305A4106564A for ; Sat, 16 Jun 2012 22:04:35 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 16 Jun 2012 22:04:35 +0000 Date: Sat, 16 Jun 2012 22:04:35 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120616220435.305A4106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r237815 - soc2012/gmiller/locking-head/lib/libthr/thread X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jun 2012 22:04:37 -0000 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;