Refactor calculations to use instr_time

From: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Refactor calculations to use instr_time
Date: 2023-02-16 13:19:02
Message-ID: 1feedb83-7aa9-cb4b-5086-598349d3f555@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

In 'instr_time.h' it is stated that:

* When summing multiple measurements, it's recommended to leave the
* running sum in instr_time form (ie, use INSTR_TIME_ADD or
* INSTR_TIME_ACCUM_DIFF) and convert to a result format only at the end.

So, I refactored 'PendingWalStats' to use 'instr_time' instead of
'PgStat_Counter' while accumulating 'wal_write_time' and
'wal_sync_time'. Also, I refactored some calculations to use
'INSTR_TIME_ACCUM_DIFF' instead of using 'INSTR_TIME_SUBTRACT' and
'INSTR_TIME_ADD'. What do you think?

Regards,
Nazir Bilal Yavuz
Microsoft

Attachment Content-Type Size
v1-0001-Refactor-instr_time-calculations.patch text/x-diff 5.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2023-02-16 14:07:59 Re: PATCH: Using BRIN indexes for sorted output
Previous Message houzj.fnst@fujitsu.com 2023-02-16 13:15:28 RE: Support logical replication of DDLs