Re: Refactor calculations to use instr_time

2023-03-30 Thread Andres Freund
Hi, I pushed this version! Thanks all, for the contribution and reviews. > > I would either put WalUsage into PgStat_PendingWalStats (so that it has > > all the same members as PgStat_WalStats), or figure out a way to > > maintain WalUsage separately from PgStat_WalStats or something else. > > W

Re: Refactor calculations to use instr_time

2023-03-23 Thread Nazir Bilal Yavuz
Hi, Thanks for the review. On Fri, 17 Mar 2023 at 02:02, Melanie Plageman wrote: > I think you want one less L here? > WALLSTAT_ACC_INSTR_TIME_TYPE -> WALSTAT_ACC_INSTR_TIME_TYPE Done. > Also, I don't quite understand why TYPE is at the end of the name. I > think it would still be clear withou

Re: Refactor calculations to use instr_time

2023-03-16 Thread Melanie Plageman
On Thu, Mar 09, 2023 at 04:02:44PM +0300, Nazir Bilal Yavuz wrote: > From dcd49e48a0784a95b8731df1c6ee7c3a612a8529 Mon Sep 17 00:00:00 2001 > From: Nazir Bilal Yavuz > Date: Thu, 9 Mar 2023 15:35:38 +0300 > Subject: [PATCH v5] Refactor instr_time calculations > > Also, some calculations are refac

Re: Refactor calculations to use instr_time

2023-03-09 Thread Nazir Bilal Yavuz
Hi, There was a warning while applying the patch, v5 is attached. Regards, Nazir Bilal Yavuz Microsoft From dcd49e48a0784a95b8731df1c6ee7c3a612a8529 Mon Sep 17 00:00:00 2001 From: Nazir Bilal Yavuz Date: Thu, 9 Mar 2023 15:35:38 +0300 Subject: [PATCH v5] Refactor instr_time calculations In inst

Re: Refactor calculations to use instr_time

2023-02-22 Thread Nazir Bilal Yavuz
Hi, Thanks for the review. On Wed, 22 Feb 2023 at 05:50, Kyotaro Horiguchi wrote: > > PgStat_PendingStats should be included in typedefs.list. Done. > > + * Created for accumulating wal_write_time and wal_sync_time as a instr_time > + * but instr_time can't be used as a type where it ends up o

Re: Refactor calculations to use instr_time

2023-02-21 Thread Kyotaro Horiguchi
At Tue, 21 Feb 2023 16:11:19 +0300, Nazir Bilal Yavuz wrote in > I agree. The patch is updated. Thanks, that part looks good to me. I'd like to provide some additional comments. PgStat_PendingStats should be included in typedefs.list. + * Created for accumulating wal_write_time and wal_sync_

Re: Refactor calculations to use instr_time

2023-02-21 Thread Nazir Bilal Yavuz
Hi, Thanks for the review. On Mon, 20 Feb 2023 at 06:01, Kyotaro Horiguchi wrote: > > At Fri, 17 Feb 2023 13:53:36 +0300, Nazir Bilal Yavuz > wrote in > > Thanks for the review. I updated the patch. > > > WalUsageAccumDiff(&diff, &pgWalUsage, &prevWalUsage); > - PendingWalStats.w

Re: Refactor calculations to use instr_time

2023-02-19 Thread Kyotaro Horiguchi
At Fri, 17 Feb 2023 13:53:36 +0300, Nazir Bilal Yavuz wrote in > Thanks for the review. I updated the patch. WalUsageAccumDiff(&diff, &pgWalUsage, &prevWalUsage); - PendingWalStats.wal_records = diff.wal_records; - PendingWalStats.wal_fpi = diff.wal_fpi; - PendingWalS

Re: Refactor calculations to use instr_time

2023-02-17 Thread Nazir Bilal Yavuz
Hi, On 2/16/23 19:13, Andres Freund wrote: +#define WALSTAT_ACC(fld, var_to_add) \ + (stats_shmem->stats.fld += var_to_add.fld) +#define WALLSTAT_ACC_INSTR_TIME_TYPE(fld) \ + (stats_shmem->stats.fld += INSTR_TIME_GET_MICROSEC(PendingWalStats.fld)) + WALSTAT_ACC(wal_records, di

Re: Refactor calculations to use instr_time

2023-02-16 Thread Andres Freund
Hi, On 2023-02-16 16:19:02 +0300, Nazir Bilal Yavuz wrote: > What do you think? Here's a small review: > +#define WALSTAT_ACC(fld, var_to_add) \ > + (stats_shmem->stats.fld += var_to_add.fld) > +#define WALLSTAT_ACC_INSTR_TIME_TYPE(fld) \ > + (stats_shmem->stats.fld += INSTR_TIME_GET_MIC

Refactor calculations to use instr_time

2023-02-16 Thread Nazir Bilal Yavuz
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_ti