From patchwork Thu Jun 5 12:37:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 356367 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E0F9E140093 for ; Thu, 5 Jun 2014 22:36:08 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:in-reply-to; q=dns; s=default; b=ReAb r8uE8IGADofcDDbESKDB0XlyPyLP+2YwGGRv11MpVxq2Tq0u/+0fiHzVFNQeBKPp m5ev4zlL+NWtu4O1fpzaTqodGGESdFQfqTUq6dfT6Q4QAdRqVG228vtlnzNtbvsr yppM4n6QVvOncM/4f4YTMzexWGnjxf5CH4S1Pg4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:in-reply-to; s=default; bh=+LmcCuQsfC wFdEhy3xEhS8JMvQg=; b=TwLEigqOfdhmpZuYXYGqETI2qwIkT4rreKXaFsTY+E g+3ZD5B6gT5W3nk3+1gI/EXmX7p6iHB3pCThviFBgszXLgmIpH4vGdOEZSwkVNEF PuAuPvYN4avpbuHnf6KZlqGiye74j+Jk0virRK+xrR/2zaKV4vGq/J9aKCfKkEkH 8= Received: (qmail 12178 invoked by alias); 5 Jun 2014 12:36:03 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 12168 invoked by uid 89); 5 Jun 2014 12:36:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.9 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Date: Thu, 5 Jun 2014 18:07:01 +0530 From: Siddhesh Poyarekar To: =?utf-8?B?T25kxZllaiBCw61sa2E=?= Cc: Torvald Riegel , "Carlos O'Donell" , Andi Kleen , libc-alpha@sourceware.org Subject: Re: [PATCH] Converted benchmark to benchtest. Message-ID: <20140605123701.GF9145@spoyarek.pnq.redhat.com> References: <1397248605.10643.18269.camel@triegel.csb> <53497694.4040901@redhat.com> <20140412194007.GA1284@domone.podge> <1397402907.10643.19303.camel@triegel.csb> <534B8B38.8090402@redhat.com> <8761m9iekn.fsf@tassilo.jf.intel.com> <87mwfifiks.fsf@tassilo.jf.intel.com> <53603208.8060205@redhat.com> <1399033983.32485.5900.camel@triegel.csb> <20140503104831.GA16118@domone.podge> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20140503104831.GA16118@domone.podge> User-Agent: Mutt/1.5.22.1-rc1 (2013-10-16) On Sat, May 03, 2014 at 12:48:31PM +0200, Ondřej Bílka wrote: > Its nice to have but orthogonal on proposed change, so it should not > block this patch This looks like something that could easily use the $bench-inputs format since you're really just looking for mean times. I haven't checked to see if a failed branch would be expensive compared to the lock/unlock cycle we're testing, but I'm guessing that it should get cached and hence not have an impact since we don't interleave the rdlock and wrlock calls. Siddhesh diff --git a/benchtests/Makefile b/benchtests/Makefile index 63a5a7f..d74de80 100644 --- a/benchtests/Makefile +++ b/benchtests/Makefile @@ -25,7 +25,7 @@ include ../Makeconfig bench-math := acos acosh asin asinh atan atanh cos cosh exp exp2 ffs ffsll \ log log2 modf pow rint sin sincos sinh sqrt tan tanh -bench-pthread := pthread_once +bench-pthread := pthread_once pthread_rwlock_test bench := $(bench-math) $(bench-pthread) diff --git a/benchtests/pthread_rwlock_test-inputs b/benchtests/pthread_rwlock_test-inputs new file mode 100644 index 0000000..9122afb --- /dev/null +++ b/benchtests/pthread_rwlock_test-inputs @@ -0,0 +1,8 @@ +## args: int +## includes: pthread.h +## include-sources: pthread_rwlock_test-source.c + +##name: rdlock +0 +##name: rwlock +1 diff --git a/benchtests/pthread_rwlock_test-source.c b/benchtests/pthread_rwlock_test-source.c new file mode 100644 index 0000000..c679f7b --- /dev/null +++ b/benchtests/pthread_rwlock_test-source.c @@ -0,0 +1,13 @@ + +static pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER; + +static void +pthread_rwlock_test (int write) +{ + if (write) + pthread_rwlock_wrlock (&rwlock); + else + pthread_rwlock_rdlock (&rwlock); + + pthread_rwlock_unlock (&rwlock); +}