Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qgigf-00Gzrz-HQ for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Sep 2023 09:31:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qgige-007J52-32 for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Sep 2023 09:30:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qgigd-007J4r-Os for pgsql-hackers@lists.postgresql.org; Thu, 14 Sep 2023 09:30:59 +0000 Received: from smtp.outgoing.loopia.se ([93.188.3.37]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qgiga-0050e5-T9 for pgsql-hackers@postgresql.org; Thu, 14 Sep 2023 09:30:58 +0000 Received: from s807.loopia.se (localhost [127.0.0.1]) by s807.loopia.se (Postfix) with ESMTP id A6DDC2FAE5DC for ; Thu, 14 Sep 2023 11:30:55 +0200 (CEST) Received: from s981.loopia.se (unknown [172.22.191.6]) by s807.loopia.se (Postfix) with ESMTP id 976D62E29E9B; Thu, 14 Sep 2023 11:30:55 +0200 (CEST) Received: from s474.loopia.se (unknown [172.22.191.5]) by s981.loopia.se (Postfix) with ESMTP id 954AF22B17DC; Thu, 14 Sep 2023 11:30:55 +0200 (CEST) X-Virus-Scanned: amavisd-new at amavis.loopia.se X-Spam-Flag: NO X-Spam-Score: -1.01 X-Spam-Level: X-Spam-Status: No, score=-1.01 tagged_above=-999 required=6.2 tests=[ALL_TRUSTED=-1, T_SCC_BODY_TEXT_LINE=-0.01] autolearn=disabled Received: from s934.loopia.se ([172.22.191.6]) by s474.loopia.se (s474.loopia.se [172.22.190.14]) (amavisd-new, port 10024) with UTF8LMTP id BdyvPqIwvIvp; Thu, 14 Sep 2023 11:30:55 +0200 (CEST) X-Loopia-Auth: user X-Loopia-User: daniel@yesql.se X-Loopia-Originating-IP: 89.255.232.193 Received: from smtpclient.apple (customer-89-255-232-193.stosn.net [89.255.232.193]) (Authenticated sender: daniel@yesql.se) by s934.loopia.se (Postfix) with ESMTPSA id 3264D7CEADF; Thu, 14 Sep 2023 11:30:55 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.3\)) Subject: Re: Small patch modifying variable name to reflect the logic involved From: Daniel Gustafsson In-Reply-To: Date: Thu, 14 Sep 2023 11:30:54 +0200 Cc: PostgreSQL Hackers Content-Transfer-Encoding: 7bit Message-Id: References: To: Krishnakumar R X-Mailer: Apple Mail (2.3696.120.41.1.3) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 14 Sep 2023, at 08:28, Krishnakumar R wrote: > Please find a small patch to improve code readability by modifying > variable name to reflect the logic involved - finding diff between end > and start time of WAL sync. - INSTR_TIME_ACCUM_DIFF(PendingWalStats.wal_sync_time, duration, start); + INSTR_TIME_SET_CURRENT(end); + INSTR_TIME_ACCUM_DIFF(PendingWalStats.wal_sync_time, end, start); Agreed, the duration is the result of the INSTR_TIME_ACCUM_DIFF calculation, not what's stored in the instr_time variable. -- Daniel Gustafsson