From patchwork Tue Sep 3 12:55:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chung-Lin Tang X-Patchwork-Id: 1156974 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-105012-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=mentor.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="bW3cH8mI"; dkim-atps=neutral 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 46N6PZ1zczz9sBF for ; Tue, 3 Sep 2019 22:55:29 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:reply-to:from:subject:to:message-id:date :mime-version:content-type; q=dns; s=default; b=NyTuAqxDXRlwa9qx /kJrvfllhUZNot0o6Q965WmJwFFelt4JQEcY1iFAD9FIoPLk109X+gydasHAtQK3 VfhAun7eB0h6CS3YZ2mJ0LA5WielNRsBfJs5+kbZ67+r8MfhH65/vfNPwvL7Kcxo tR1++ZnZUif16axL8tEdm2ab2Lg= 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:reply-to:from:subject:to:message-id:date :mime-version:content-type; s=default; bh=Y831pufupiIWtftuQ931pY 0SAGw=; b=bW3cH8mI4K1rZO6AwEf1qO7DFhPV+vckcuuJqUwQT3VGNa8SWkza1r aWNHRWgkZy4zFmGn0FOEwSshv9N0J3wsCcgxp2RNK4ZsnVc7c7rJvPYMWvrZtbUT x+Lru+DGkqMiC21Q+nzqqu95aD6ypL2XNTOse6Kg4paNMv9LwG444= Received: (qmail 100181 invoked by alias); 3 Sep 2019 12:55:23 -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 100168 invoked by uid 89); 3 Sep 2019 12:55:23 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=H*UA:Intel, H*u:Intel, H*UA:Macintosh, H*u:Macintosh X-HELO: esa4.mentor.iphmx.com IronPort-SDR: 6iu16jlw+jrjeVsM8Y2QQG7n2KgydXt29aE7CXe6fLef6+sMAdkbwTItQaA8N8KfJjthp3vXKm M09qje96oQm8yMzKhnQEBf4JyrEeAhd1I9vzDhr3y7uUhLqAxgYrN5P3dXLob+r7e+Pz+mecG2 JlxSdgxyMAV3HqC7vxXrFm8WVAJKElz8tlL6MVK9ct971TeJYnVWg6JvrnxfStm+5wddL6NmF2 BgWj7ZRHvWthKbpoCKJ4tRRwCYGADjFYTxFnKteewEo7BRNiat3yaYfm+QTEfxvK1TGPss3VaF MxI= IronPort-SDR: lZMkRrYb2F71rvwM/jaTaN8aBxuurpKv7VDog2WJYjN7wICX2i/vHlkA48bF2duui2+qsoddaR XxePX60t/ZZAbAhZBMhlqi6x+HK5wRIk3p69+9mX/j3KQoiZ2wm5nPdky8fZcFlf6ssmfyxRtS prkNBA1vTnDZVSN9TT9EY5kgLo2HWG72TxUYEUefKmFu+TYNC/H6F3kV3j9YlFFCq0r/GtZBr+ xLodGWYb0gHTwyeFJp1i3BKny8nYV4sRHUBjn5lBU8hdiwE0bmRiMQArHC+CuZcm/W7+pfT9vU XaY= Reply-To: From: Chung-Lin Tang Subject: [PATCH] Small fix to HP timing printing To: GNU C Library Message-ID: Date: Tue, 3 Sep 2019 20:55:12 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 Hi, when developing my dynamic linker DSO sorting patch [1], and measuring its cycle performance, I found a small error in the HP_TIMING_PRINT trailing zero setting; the '\0' should be set at MIN(Len,string length), instead of always at the 'Len' position. Encountered some weirdness in printing counter results because of this. Okay for master? [1] https://sourceware.org/ml/libc-alpha/2019-07/msg00472.html https://sourceware.org/ml/libc-alpha/2019-07/msg00473.html Thanks, Chung-Lin * sysdeps/generic/hp-timing-common.h (HP_TIMING_PRINT): Correct position of string null termination. Reviewed-by: Adhemerval Zanella diff --git a/sysdeps/generic/hp-timing-common.h b/sysdeps/generic/hp-timing-common.h index 8749d25647..1fc92d1bd7 100644 --- a/sysdeps/generic/hp-timing-common.h +++ b/sysdeps/generic/hp-timing-common.h @@ -56,5 +56,5 @@ char *__cp = _itoa ((Val), __buf + sizeof (__buf), 10, 0); \ size_t __cp_len = MIN (__buf + sizeof (__buf) - __cp, __len); \ memcpy (__dest, __cp, __cp_len); \ - __dest[__len - 1] = '\0'; \ + __dest[__cp_len - 1] = '\0'; \ } while (0)