Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ltax0-0001TP-DT for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Jun 2021 19:11:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ltawz-0003YL-9V for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Jun 2021 19:11:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ltawz-0003YD-27 for pgsql-hackers@lists.postgresql.org; Wed, 16 Jun 2021 19:11:45 +0000 Received: from sfr-1.cri.mines-paristech.fr ([77.158.180.225] helo=smtp.cri.ensmp.fr) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ltaww-0003Jh-VS for pgsql-hackers@postgresql.org; Wed, 16 Jun 2021 19:11:44 +0000 Received: from pseudo (185.141.6.84.rev.sfr.net [84.6.141.185]) by smtp.cri.ensmp.fr (Postfix) with ESMTPSA id 91EFAC013F; Wed, 16 Jun 2021 21:13:36 +0200 (CEST) Date: Wed, 16 Jun 2021 21:11:41 +0200 (CEST) From: Fabien COELHO X-X-Sender: fabien@pseudo To: Yugo NAGATA cc: Gregory Smith , PostgreSQL-development , david.christensen@crunchydata.com Subject: Re: pgbench logging broken by time logic changes In-Reply-To: <20210617025138.04a35c3ae9a6cd40c077cea0@sraoss.co.jp> Message-ID: References: <20210617025138.04a35c3ae9a6cd40c077cea0@sraoss.co.jp> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="2056645051-1365396352-1623870702=:2407635" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --2056645051-1365396352-1623870702=:2407635 Content-Type: text/plain; format=flowed; charset=US-ASCII > pg_time_now(). This uses INSTR_TIME_SET_CURRENT in it, but this macro > can call clock_gettime(CLOCK_MONOTONIC[_RAW], ) instead of gettimeofday > or clock_gettime(CLOCK_REALTIME, ). When CLOCK_MONOTONIC[_RAW] is used, > clock_gettime doesn't return epoch time. Therefore, we can use > INSTR_TIME_SET_CURRENT aiming to calculate a duration, but we should > not have used this to get the current timestamp. > > I think we can fix this issue by using gettimeofday for logging as before > this was changed. I attached the patch. I cannot say that I'm thrilled by having multiple tv stuff back in several place. I can be okay with one, though. What about the attached? Does it make sense? -- Fabien. --2056645051-1365396352-1623870702=:2407635 Content-Type: text/x-diff; name=pgbench-epoch-1.patch Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename=pgbench-epoch-1.patch ZGlmZiAtLWdpdCBhL3NyYy9iaW4vcGdiZW5jaC9wZ2JlbmNoLmMgYi9zcmMv YmluL3BnYmVuY2gvcGdiZW5jaC5jDQppbmRleCBkNzQ3OTkyNWNiLi41ZmUy YTkyODZmIDEwMDY0NA0KLS0tIGEvc3JjL2Jpbi9wZ2JlbmNoL3BnYmVuY2gu Yw0KKysrIGIvc3JjL2Jpbi9wZ2JlbmNoL3BnYmVuY2guYw0KQEAgLTY3Miwx MSArNjcyLDExIEBAIHN0YXRpYyBjb25zdCBQc3FsU2NhbkNhbGxiYWNrcyBw Z2JlbmNoX2NhbGxiYWNrcyA9IHsNCiBzdGF0aWMgaW5saW5lIHBnX3RpbWVf dXNlY190DQogcGdfdGltZV9ub3codm9pZCkNCiB7DQotCWluc3RyX3RpbWUJ bm93Ow0KKwlzdHJ1Y3QgdGltZXZhbCB0djsNCiANCi0JSU5TVFJfVElNRV9T RVRfQ1VSUkVOVChub3cpOw0KKwlnZXR0aW1lb2ZkYXkoJnR2LCBOVUxMKTsN CiANCi0JcmV0dXJuIChwZ190aW1lX3VzZWNfdCkgSU5TVFJfVElNRV9HRVRf TUlDUk9TRUMobm93KTsNCisJcmV0dXJuIHR2LnR2X3NlYyAqIDEwMDAwMDAg KyB0di50dl91c2VjOw0KIH0NCiANCiBzdGF0aWMgaW5saW5lIHZvaWQNCg== --2056645051-1365396352-1623870702=:2407635--